sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
439848d5189c697880fee45cf9dff5bb0f59334c7fd245652dfb865400937d37
Python
3,785
123
"""Tests for SubLOF""" __author__ = ["Alex-JG3"] import datetime import pandas as pd import pytest from skbase.utils.dependencies import _check_soft_dependencies from sktime.detection.lof import SubLOF from sktime.tests.test_switch import run_test_for_class def _daily_datetime_case(): """Return daily Datetime...
54a5dd364e3b4bb5d3754d3d23ac8c3315492d0b67d0bd71af100a3991751b56
Python
3,787
115
from open_spiel.python.egt import alpharank from open_spiel.python.egt import alpharank_visualizer from open_spiel.python.egt import utils, heuristic_payoff_table from open_spiel.python.algorithms.projected_replicator_dynamics import projected_replicator_dynamics import numpy as np def get_alpha_rank_pi(payoff_tabl...
1e2e876bccc307538ac3174cf9464f73f4672ddecb7f413afc16b7148372417c
Python
3,790
112
# SPDX-License-Identifier: LGPL-3.0-or-later """ Attention utilities for SeZM message passing. This module implements the destination-wise envelope-gated softmax used by the SO(2) attention path in the SeZM descriptor. """ from __future__ import ( annotations, ) import torch import torch.nn.functional as F @to...
2301aa0dbb22b1bbf831d9a15e7bbdc27eea495c135cebfac28bc3e7341a829b
Python
3,790
79
#======================================================================================================================= # Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller # Computer Vision Studio # Friedrich Miescher Laboratory of the Max Planck Society # Systems Biology of Development, Univers...
2bda2b5dad17b1b0bddc67aaaa61e3d5fa90a0d138da44a6eadb63590a730c68
Python
3,790
106
"""Unit tests for all time series regressors.""" __author__ = ["mloning", "TonyBagnall", "fkiraly"] import numpy as np import pandas as pd from sktime.datatypes import check_is_mtype from sktime.tests.test_all_estimators import BaseFixtureGenerator, QuickTester # Pairs of message and lambda function to check the t...
bab2be6fc796da54997dcdd3bc9033eff34dfbefc1cba798156d560481feee26
Python
3,790
122
import re import os import sys from pathlib import Path from setuptools import setup def abspath(relpath, _dir=os.path.dirname(__file__)): return os.path.join(_dir, relpath) def find_version(filename): abs_filename = abspath(filename) _version_re = re.compile(r"__version__ = ['\"](.*)['\"]") last = ...
3b5c09f12942dd515ef194c51465f778b4451845bb25699da95a4281bb52a1ec
Python
3,792
116
import pytest import numpy as np import pandas as pd import scanpy as sc from anndata import AnnData from scipy.sparse import csr_matrix from anndata import AnnData from palantir.utils import run_magic_imputation @pytest.fixture def mock_dm_res(): rng = np.random.default_rng() return {"T": csr_matrix(rng.ran...
4b70398daf64a3edc4fc944c247e307bdf09713ba5f25f8cc175db8c52cff16d
Python
3,793
112
# Copyright 2022 DeepMind Technologies Limited # # 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 agr...
e082703e3770de45fd5a1f26e9b38df1a7e1cc3eac32c31219e3702d6728c267
Python
3,794
60
rgb_colors = {'Xx': (0.07, 0.5, 0.7), 'H': (0.75, 0.75, 0.75), 'He': (0.85, 1.0, 1.0), 'Li': (0.8, 0.5, 1.0), 'Be': (0.76, 1.0, 0.0), 'B': (1.0, 0.71, 0.71), 'C': (0.4, 0.4, 0.4), 'N': (0.05, 0.05, 1.0), 'O': (1.0, 0.05, 0.05), 'F': (0.5, 0.7, 1.0), ...
c9a17e214369e82a9102af26c989277b9cf3710c5ea154d72509b8b6932fcd31
Python
3,796
157
# Mocapy: A parallelized Dynamic Bayesian Network toolkit # # Copyright (C) 2004 Thomas Hamelryck # # This library is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License...
1c089b52a77146a1dce912167be79a5233c4210dfa3ff03116a718cfedaa22bc
Python
3,799
73
import warnings import torch from vp_suite.measure import METRIC_CLASSES class PredictionMetricProvider: r""" This class provides bundled access to multiple metrics. With this class's :meth:`get_metrics()` method, all specified metric scores are calculated on the same input prediction and target...
2d1b964630ead10200e9726e1f291209eb27ad3820c05c82bb37cc5a45acd44a
Python
3,800
126
# Copyright 2018-2026 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # 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/LICE...
c802b47716be27441d587478f804f1eab26729dcf93c533e73baf797bf13d490
Python
3,800
80
import tensorflow as tf from tensorflow.contrib import distributions as distr class SingleLayerDecoder(object): def __init__(self, config, is_train): self.batch_size = config.batch_size # batch size self.max_length = config.max_length # input sequence length (number of cities) self....
60915dd953bf8703d2cccd8d71b5a9e14ebacb680f5f243d26da2bcda623d62f
Python
3,804
104
""" @file: wide_resnet_se.py Created on 07.04.19 @project: CrazyAra @author: queensgambit Please describe what the content of this file is about """ from mxnet.gluon import HybridBlock from mxnet.gluon.nn import HybridSequential from DeepCrazyhouse.src.domain.neural_net.architectures.a0_resnet import ( _ValueHead...
ae8062a7a6f45a8725f099a8eaae5352182a450760f2faab4ba6f0b306ec4d44
Python
3,804
88
""" Regional surface data generated from the Brodmann atlas. The label files are generated using Freesurfer. From label files, the vertices the belong to each spcific region are extracted. And from that information the surface files for each region are saved. Parameters: --------- {h}.{l}.label: Label files of ea...
bf998dba41c1bd14dd5cab127fdd60c8cbff9c76c23406ab69ed09b397b06e18
Python
3,804
128
# type: ignore # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------...
91359cf5f3b5c989423899bbc42dd88bb499a7787b17efe8bbce4fbba6ff04f5
Python
3,806
136
"""Tests for bcblib.imaging.stats.""" import numpy as np import nibabel as nib import pytest from bcblib.imaging.stats import ( centre_of_gravity, centre_of_gravity_distance, volume_count, laterality_ratio, reduce_axis, image_stats, percentile, robust_range, histogram, ) def _mak...
66ec404198c5f46219433565e3a84debd23e78f6c85eaaf037fcc5d6d49fe29e
Python
3,807
114
from __future__ import annotations from pathlib import Path import numpy as np import pytest from jetnet.datasets import TopTagging, normalisations from pytest import approx # TODO: use checksum for downloaded files data_dir = Path("./datasets/toptagging") DataClass = TopTagging valid_length = 403000 num_particle...
3c823b970cbdd96675c53872c18bcc964138adf5c103469e24f8fb9987cfcc78
Python
3,810
79
import logging # PyTorch modules import torch from torch.utils.data import DataLoader # Cormorant modules and functions from cormorant.data.utils import initialize_datasets from cormorant.engine import Engine from cormorant.engine import init_logger, init_cuda from cormorant.engine import init_optimizer, init_scheduler...
443d21831ef3a5a2b155f0a28e47df70619fe7dd4e0d9af9159f1905f5aa67b5
Python
3,811
112
# Copyright 2018-2026 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # 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/LICE...
74b0525c4ae5998d6dec340f1a1f8f5c270d552ac205e50beeaf4a4546f17daf
Python
3,814
115
# Copyright 2022 DeepMind Technologies Limited # # 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 agr...
7fbbf0543bdc8b35e4ed531eac98ea1698e676e3358bd60a106babfe9fa8dead
Python
3,816
105
# Copyright 2023 DeepMind Technologies Limited # # 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 agr...
c486c638b01345b24860d25ff65fc05fcd6c7d13868e76d46e1f7e241de7fa4f
Python
3,816
107
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
ac0239f5ee03fe3ebb00797af58a39b7db31299af4e704bea9f8eb1d6594bf9a
Python
3,821
104
import pytest from typing import Union, List from json import JSONDecodeError from requests import RequestException from functools import wraps import siibra def xfail_if_allen_api_unavailable(test_func): @wraps(test_func) def wrapper(*args, **kwargs): try: return test_func(*args, **kwargs...
48b21b6f1e1212cb1821f2ac52d5222d6b25255b9f7b5b358f51d3a1d716c1e9
Python
3,823
122
import numpy as np from scipy import stats # AUC comparison adapted from # https://github.com/Netflix/vmaf/ def compute_midrank(x): """Computes midranks. Args: x - a 1D numpy array Returns: array of midranks """ J = np.argsort(x) Z = x[J] N = len(x) T = np.zeros(N, dtyp...
84a30e695d539ca2aa15a49965fa71f6dbd09ebbf2dc177951915cb46f6bbbcf
Python
3,823
111
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
6313d8a5300e7b89b73a222bbfa2f2668c296e7d83dbc020e3199a0a81b5d38f
Python
3,825
124
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 # mypy: ignore-errors from __future__ import annotations import numpy as np import onnx import onnx.helper as oh import onnx.numpy_helper as onh import onnx.reference as orf def create_model(): """The following model is equivalent ...
8b1ddaa75f9c09f18495e864fb0504b0cc52b16de77bab8504ce0cec48ab3569
Python
3,827
121
# Copyright (c) OpenMMLab. All rights reserved. import functools import torch import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
2905a5a02591448f482b0903a06a1f289827555543d45b2555c4e7a8887c982f
Python
3,829
75
""" Utility functions for dealing with network colors. """ """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IMPORTS """ import warnings SETOFVALIDCOLORS = {'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black'...
ba594d3fd9b99d4ee2610b4e2dec6405a06ed9583073e209bdfa98f098dcae8a
Python
3,831
112
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
c0dff3d2e6d2a66fe41611ae422b6580d5d2921c50df778dd5c61dcb29bef33b
Python
3,832
120
#!/usr/bin/env python3 -u # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Test script to check for invalid use of single-backticks.""" __author__ = ["geetu040"] import argparse import ast import glob import re def find_py_files(folder_path): """Find all Python files in a given folder...
01222036d36f35be629d9eac7c2a34c156c96fd73757ea3f8e2bf90c739033db
Python
3,836
138
from typing import Tuple import torch ######### Weight mixing ########### def mix_zweight_zvec(weight, part, zdim=0): """ Apply the linear matrix in `GWeight` and a part of a `GVec`. Parameters ---------- weight : `torch.Tensor` A tensor of mixing weights to apply to `part`. part :...
3aec8ae42843feda8d4695ae822649d0e7ae499a95fb41411f5128ada65e221c
Python
3,836
113
# Copyright 2019-2021 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # import os import importlib import numpy as np import pandas as pd import numpy....
ad7d239c3ad5bb22856713459db8a27982c46b1394c91bb83973739bbc4cd954
Python
3,837
60
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit import seaborn as sns sns.set(font_scale = 1.5) sns.set_style("ticks") # fitting function def eq_5_fitting_mM(V,conc,alpha, eta): return 1/(1+conc*eta*np.exp(alpha*V)) simulated_voltage=np.linspace(-250,150, 1000) simulated_...
cc70c27dc46ab93d756161c51e636133bba5260e7d9152009be00e753895306a
Python
3,838
102
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
d55acfa525738923104a2b29ad98aaa3ea281a39fea3047eef198088048dc251
Python
3,840
102
import sys import pickle import numpy as np from parameterSetup import ParameterSetup #-------------- # print in the format of a latex table params = ParameterSetup() pickledDir = params.pickledDir paramDir = params.pickledDir args = sys.argv if args[1] == 'test': datasetType = 'test' groupIDs = args[2:] eli...
cc6e8ad0157633881a0ced4369f5244b6d2ad704347b104e9bdc984ae0e3fb81
Python
3,841
102
""" @file: input_representation.py Created on 03.07.23 @project: CrazyAra @author: queensgambit Input representation 3.0 for crazyhouse based on the input representation 3.0 of chess. """ import chess from chess.variant import CrazyhouseBoard import DeepCrazyhouse.src.domain.variants.classical_chess.v3.input_represent...
5734e715dd3817898f36dd4858effd3d4943dc286bcc27012e3a87475e020900
Python
3,842
98
from __future__ import print_function import dxpy import subprocess import time app_id_hardcode_up_version={ "app-FPkkQ4j0gjx97J1X1496B9zF":"purge_haplotig (bitbucket v1.0.3+ 1.Nov.2018)", "applet-FZzYjYQ0j3b9pVP06qg4Q97Y": "purge_dups github ca23030ccf4254dfd2d3a5ea90d0eed41c24f88b", "applet-Fb721zj0j3b1...
70e7c489327504b3b584ccef9a2a6398811d7d0a008b6c80112071ff22d94417
Python
3,843
108
#!/usr/bin/env python3 import inspect from pathlib import Path from git.repo import Repo from rdflib import Graph, URIRef from neurondm import * from pyontutils.utils import subclasses from neurondm.core import NeuronBase, auth, ont_checkout_ok # FIXME temporary until we can rework the config __all__ = [ 'AND', ...
32f61ec9de996bed3c4eda17bdb898056b3ad7c25800308c430db122d1817718
Python
3,844
113
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
4c7e0f6958aea5a0c5dcf350e524f5fda1b217296393a99c2b1289e422f10d0c
Python
3,845
157
# SPDX-License-Identifier: LGPL-3.0-or-later """NeighborGraph: backend-agnostic edge-graph neighbor-list subsystem. The unified edge/graph neighbor-list contract and its supporting machinery: ``graph`` (the ``NeighborGraph``/``GraphLayout`` contract + derived node-validity + edge padding), ``csr`` (backend-agnostic CS...
ba44635906f5f3f20312ce397e951e8a393caf663f22f892dc8842c3cd03d0ba
Python
3,846
128
import matplotlib as mpl from matplotlib.colors import to_rgba, to_rgba_array from numpy.testing import assert_array_equal from seaborn._core.plot import Plot from seaborn._marks.area import Area, Band class TestArea: def test_single_defaults(self): x, y = [1, 2, 3], [1, 2, 1] p = Plot(x=x, y...
d2c53e42f47bc2ec956c102019f5580d2feabcc3ff208796c9e0f3798c2920f3
Python
3,846
108
import sys import numpy as np import nengo import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # Personal stuff to send an email once data collection is finished sys.path.extend(['/home/will']) from e...
027a7be3d3fbfed7c9fccaee3779a2bc57312bc73ccc2e56b33833d91adf6c77
Python
3,847
112
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 26 10:10:25 2020 @author: sam """ from detectron2.data import MetadataCatalog, DatasetCatalog from detectron2.utils.logger import setup_logger setup_logger() import os import cv2 from detectron2.engine import DefaultPredictor, DefaultTrainer from d...
f8556f37b12d110125761ba1d8150d08f5e924273830504ecf15fd421f87b6d0
Python
3,847
167
import torch import numpy as np """ FFT, iFFT, and FFTshift function """ def generic_fftshift(x,axis=[-2,-1],inverse=False): """ Fourier shift to center the low frequency components Parameters ---------- x : torch Tensor Input array inverse : bool whether the shift...
d2940d3711a4d214cd3df337a080c4c4837386023fe13e5c13a4102178db4369
Python
3,848
94
"""encoder.py""" """ Ref: https://github.com/The-AI-Summer/self-attention-cv Author: Yimin Yang Last revision date: Jan 18, 2022 Function: Encoder of AA_TransUNet """ from einops import rearrange from utils import * class ViT(nn.Module): def __init__(self, *, img_dim, in_channe...
8e841c302165fa757d005e0e39915002f313ec30dc3bf19c255c16ba0a315e46
Python
3,852
117
import numpy as np import cv2 from data.utils import vx_vy2v_theta def plot_evolution(gt, pred, mask, fps, filename = 'comparison.mp4', scale_frame = False): n_frames = gt.shape[0] H = gt.shape[2]; W = gt.shape[3] ## Ground-truth frame generation gt_Lab = np.zeros((n_frames, H, W, 3)) gt_vsinco...
f9859dfd87b53ca4a4b4383087d767e67b013c4862a0f94a1ec39096af6bcbc1
Python
3,852
125
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
15d53f84d5e4476d0d964de0532bb6e6be07b5a17d3ab38991acdbd5badd55a2
Python
3,853
120
import re from collections import defaultdict from pyontutils.sheets import Sheet from pyontutils.namespaces import ilxtr, TEMP, rdfs, skos, owl from neurondm.core import Config, NeuronEBM, Phenotype, EntailedPhenotype, log, OntId class NeuronApinatSimple(NeuronEBM): owlClass = ilxtr.NeuronApinatSimple shortn...
129426b76de9915a3d6bdee06d7e7f51ce67287b8f3f66f556e9a7a9211c21e2
Python
3,855
102
import collections as col import logging import os import re import sys import click import numpy as np import pandas as pd import atom3d.datasets.datasets as da import atom3d.splits.splits as spl import atom3d.util.file as fi import atom3d.util.formats as fo logger = logging.getLogger(__name__) def _filter(data...
d93917e831f1969bcdabbffa5ad3ef1d4b3a10b34433604a67b2b61be4b9d963
Python
3,855
141
#!/usr/bin/env python # -*- coding: utf-8 -*- # Note: To use the 'upload' functionality of this file, you must: # $ pip install twine import io import os import sys from shutil import rmtree from setuptools import find_packages, setup, Command # Package meta-data. NAME = 'scCODA' DESCRIPTION = 'A Dirichlet-Multin...
95180432adb20a5e0a60cfcdaa153c562527caa84348b2ab9058fd559a7adec3
Python
3,858
141
# Copyright 2026 DeepMind Technologies Limited # # 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 agr...
e15eaff6db9ccbd1f9ce447a15c7b6b0069cc3a05effbc50fde8cfc0f1f434cb
Python
3,858
105
"""Test suite for numba distances with parameters.""" from collections.abc import Callable import numpy as np import pytest from skbase.utils.dependencies import _check_soft_dependencies from sktime.dists_kernels._numba_distances import distance, distance_factory from sktime.dists_kernels._numba_distances._distance ...
0752426a3a7008cc3eae9d67e7faa373d8da19efbad1a9ab2f8dc147866ccc5e
Python
3,859
151
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 23 23:26:09 2021 Plot example narrow vs wide place fields for fig 4 @author: robert.mok """ import os import numpy as np import torch import matplotlib.pyplot as plt from scipy.stats import binned_statistic_dd import itertools as it maindir = '/U...
36fbf6ceef752b31536d67107d69d7a4b051c625b1184c554151ed8eca45e658
Python
3,860
115
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
97d24274aaad66963e518b5bddf010873cba4c237537bf8855122b93709b4cb9
Python
3,860
115
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
d0472b47887ea97e75a5db9bb03362e28e994cc7939e49d622bc7c10636ee7f4
Python
3,862
142
import random import torch from spikingjelly.clock_driven import functional from poolingNet_cat_1res_mvsec import NeuronPool_Separable_Pool3d from tqdm import tqdm from mvsec_dataset_v2.mvsec_dataset_outdoor import MVSECDataset from eval.vector_loss_functions import * import math # Enable GPU ...
e027116ec80bf2d0cec754fec9e3788169a419d5c4816728f85199ec71aaa7fe
Python
3,862
118
import os import cv2 import numpy as np import torch import torch.utils.data from PIL import Image import torchvision.transforms as transforms class Dataset(torch.utils.data.Dataset): def __init__(self, img_ids, img_dir, labels, img_ext, transform=None): self.img_ids = img_ids self.img_dir = img_di...
42d82b81e5802867769cca539c7325c6ebd04565a111ce53e51b550abbb6d27f
Python
3,865
127
#!/usr/bin/env python # coding: utf-8 import argparse import os import numpy as np import logging import fbpca import itertools import argparse import anndata from robustlink import utils from robustlink.scf import clst_utils from robustlink.scf import basic_utils def pipe_singlemod_clustering( f_ann, ...
e816e4f790981c618bf4820d814e213d4ecf2bb81166a386e985454ce18c924f
Python
3,865
96
import random import numpy as np import cv2 import lmdb import torch import torch.utils.data as data import data.util as util class WGTDataset(data.Dataset): def __init__(self, opt): super(WGTDataset, self).__init__() self.opt = opt self.data_type = self.opt['data_type'] #lmdb or img ...
dead18eaf21f28924cdf570c1498f76b5fb532f100be1fda9c89d042f0c4c418
Python
3,866
112
import numpy as np import pandas as pd from sklearn.cross_decomposition import CCA from sklearn.utils import check_array from sklearn.utils.validation import check_is_fitted, FLOAT_DTYPES from sklearn.metrics import silhouette_samples class CCA_extended(CCA): def __init__(self,*args,**kwargs): super()....
ba0c309ab76d46204c305fe7861eb18246349d26328ad9ed061126ab24896ff8
Python
3,869
134
import rdflib import augpathlib as aug from pyontutils import sheets from pyontutils.core import OntGraph, OntId, populateFromJsonLd from pyontutils.config import auth from pyontutils.namespaces import (rdf, rdfs, owl, ilxtr, NIFRID, definition, editorNote, OntCuries) from pyld.jsonld...
e564e6f35599676a348a65248324a8414ff8e7dc88bd251c82de0048940734b5
Python
3,870
99
# Copyright 2017 The TensorFlow Authors 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 applicab...
106b972da9a1362cc05a5ed3d595b31d8db68b7090e41a9da1375a0f77e9465d
Python
3,874
77
# Copyright 2007 Zachary Pincus # This file is part of CellTool. # # CellTool is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. """Create a PCA shape model from a set of pre-aligned contours. Thi...
6ee35cd0e8e5eebdb444c699326b0083328726c37aa02a0ca9c80655bb30f88b
Python
3,874
98
# Copyright 2023 DeepMind Technologies Limited # # 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 agr...
f7189c5a19e0eefb400af10ce191d8065bbec460a8fdf722aa2f70edde8095ac
Python
3,874
106
#!/usr/bin/python # # Author: Patrick Ohly <patrick.ohly@intel.com> # Copyright: Copyright (C) 2015 Intel Corporation # # This file is licensed under the MIT license, see COPYING.MIT in # this source distribution for the terms. # Runs a command, pipes its output to stdout, and injects status # reports at regu...
9c136a2e8c78e96f1a0b6ccd50082e3791df433dd81d98e3744ddb4f606b0fde
Python
3,875
111
import copy from flair.data import Sentence, Relation from flair.tokenization import SegtokTokenizer, SpaceTokenizer def _create_annotated_sentence() -> Sentence: """ Creates a complexly annotated sentence for testing. "George Washington went to Washington." - Sentence-level label - "George Washin...
b8e815960c231a0111dc0da783f4c4b2f7ae18b2a99fbdb79f7d8056480b9303
Python
3,876
75
""" Functions which are used within the design subpackage, but may not be necessary for the end user. """ """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IMPORTS """ import warnings SETOFVALIDCOLORS = {'aliceblue', 'antiquewhite', 'aqua', '...
d23a4ebe53c90ebd4c8515e4de4758da537ae9514a2b13d68f7eae74fd37884a
Python
3,878
82
import os import torch from torch.utils.data import Dataset import numpy as np from .indexes import * class MVSECDataset(Dataset): def __init__(self, root:str, split: int, condition: str, transform=None): assert split in [1, 2, 3] assert condition in ['train', 'valid', 'test'] ...
057532e7cd706c9973c62bd6aef91ae7b1ed3ed59663d3a62508dcf5b8054775
Python
3,879
127
#!/usr/bin/env python import click from functools import partial from multiprocessing import Pool import os import pandas as pd from pybedtools import BedTool import re import subprocess as sp import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.p...
eb041cc333b0fce740c3a01dc98f81d8dbd12d487c4ed5848097f5808a94943f
Python
3,884
84
""" hyperparameters for the pciSeq method """ import numpy as np DEFAULT = { # list of genes to be excluded during cell-typing, e.g ['Aldoc', 'Id2'] to exclude all spots from Aldoc and Id2 'exclude_genes': [], # Maximum number of loops allowed for the Variational Bayes to run 'max_iter': 1000, #...
e9b7bbd94fa09a58a396368606f79ec3c81254b9b48c2cbb33dd404dec508598
Python
3,885
104
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
63c932475c5b83115d3608fe32f468cf9e748016614930ae9544671937595aac
Python
3,886
105
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
0d8cdf51301ac4d23b4bc3b4e6ed784c6e891959eea396045eb537ba10b0c5e0
Python
3,887
131
# Copyright 2019 The TensorFlow Authors. 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 applica...
9c5985d0d57a8c680d9d9e25c66f9c2e4bbeadcb36398247509b827b349343ec
Python
3,887
112
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from ..builder import LOSSES from .utils import weight_reduce_loss def asymmetric_loss(pred, target, weight=None, gamma_pos=1.0, gamma_neg=4.0, ...
fa863aa9aa6a817da26f191a0433bd4966b4fe6fe7df1f9d8f69940ce41f2750
Python
3,887
112
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
bef802c5e082449a481263af6d57b1c012b2c4c6df56f2355031f9594aef4b63
Python
3,889
94
""" entrainment.py - calculate spike entrainment for a periodic stimulus This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (Spirou, Manis, Ellisman), DC R01 DC004551 (Manis, 2013-2019, Early development) DC R01 DC019053 (Manis, 2020-2025, Later development) Distributed under M...
963b87b1caeb8ee8152301f6654cdca283ff0b5fb6dda90150063f86df1d97db
Python
3,892
103
from sklearn import metrics import numpy as np import torch import importlib import sys import OT_crispr_attn import torch.nn.functional as F config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else "" config = importlib.import_module(config_path + "config") class Ranking(object): def __i...
48bd74f896f4015b9accd6cda4f6bbae21d9a39ed904f8128554b492308837d7
Python
3,894
87
# Copyright 2007 Zachary Pincus # This file is part of CellTool. # # CellTool is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. """Plot a set of contours, optionally showing the ordering of their ...
0edcd2bd310fdf6f7b5ab5ecb1eed1823dab0f0fb768f8a4516015323c46a1bf
Python
3,896
95
#!/usr/bin/python import numpy as np import pickle import math import gzip import argparse from itertools import islice '''Convert Hi-C data from HiC-DC+ normalized (txt.gz) format to diagonal.txt Usage Example: [yangr2@lilac-ln02 script]$ screen (base) bash-4.2$ bsub -n 2 -W 40:00 -R 'span[hosts=1] rusage[mem=64]' ...
6dbddb019d142b62d3b5febd1f847a2480539f654053924fc8e15cdf6c467766
Python
3,896
144
#%% [markdown] # # Simulation #%% import datetime import time import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from graspologic.simulations import er_corr from pkg.io import FIG_PATH, OUT_PATH from pkg.io import glue as default_glue from pkg.io import savefig from pkg.match...
a0b98b9d1d19b6a7f12eae46c0b47d1515240415f75fa935d75ca4bcdd16e122
Python
3,896
103
from allennlp.predictors import SentenceTaggerPredictor from akkadian.data import dump_object_to_file, load_object_from_file, compute_accuracy from akkadian.build_data import preprocess from akkadian.hmm import hmm_train, hmm_preprocess, hmm_viterbi from akkadian.memm import memm_train, build_extra_decoding_arguments, ...
6c447234582b3919599ee81d6fe38ee5a7fd243f70764eaf3e3c7cc238395f38
Python
3,899
105
# Copyright 2023 DeepMind Technologies Limited # # 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 agr...
ce29df4c936877e4df49cbfe77ce7f3015083d71647abf804a738a78e7b027b2
Python
3,900
106
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def pow(x: np.ndarray, y: np.ndarray) -> np.ndarray: # noqa: A001 retur...
09d4abfcdcfda0a4e680b7b01ee40de377d5b778ec64026b394776116876f5d7
Python
3,903
124
from jetnet.datasets import TopTagging, normalisations import numpy as np import pytest from pytest import approx from torch.utils.data import DataLoader # TODO: use checksum for downloaded files data_dir = "./datasets/toptagging" DataClass = TopTagging valid_length = 403000 num_particles = 200 split = "valid" ...
1da545868dd8a857ed2d0dcd067755321d427239acbaf7c886af0861c9d1e620
Python
3,905
117
# Copyright 2018-2025 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # 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/LICE...
658470cd297f83dcfc35355ecbd4e2ca1f7fd3660b9ed31155e6593ee28fdb58
Python
3,905
118
import numpy as np from keras.optimizers import * import os import pandas as pd from scripts import models_util from scripts import training_util import scipy as sp import keras # Global dictionaries name_to_optimizer_dict = {'Nadam': Nadam, 'SGD': SGD, 'RMSprop': RMSprop, 'Adagrad': Adagrad, 'Adadelta': A...
164f389e8b55edffe6fc22208dff443bcbf2db1bdd3561ce595f980e1df9167a
Python
3,907
123
import numpy as np import cv2 as cv import img_processing as img_utils def predict_Q_values_of_section(img_path, sl_value, sgc_model, ql_model): q1_value, q2_value, q3_value, q4_value, q5_value = 0, 0, 0, 0, 0 original_img = cv.imread(img_path) if sl_value < 24: # Send to registration sect...
463f39cb610c3d87924c87050c9aabe48129f6bd47767aa7bed8a6069ccf8796
Python
3,907
119
#!/usr/bin/env python3 import rospy import numpy as np from std_msgs.msg import Float32MultiArray from geometry_msgs.msg import Twist from sensor_msgs.msg import LaserScan from rospy.numpy_msg import numpy_msg import torch from sns_toolbox.networks import Network from sns_toolbox.neurons import NonSpikingNeuron from s...
676d187896f09a64f02a13ab76e58d3d20d19af2a9b6407411f06a986ca99a77
Python
3,907
123
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.helper import make_tensor class TreeEnsemble(Base): @staticmeth...
73636f1faa0959cb423e5bcaa4a0fde20730a088cc239c1256ca251983accc0e
Python
3,909
136
import sys from cyvcf2 import VCF import numpy as np from matplotlib import pyplot as plt import seaborn as sns from sklearn.metrics import roc_curve np.random.seed(42) colors = sns.color_palette() dpi = 120 # python ab-truth.py eval/fp.vcf.gz eval/tp.vcf.gz eval/fn.vcf.gz fp_path = sys.argv[1] tp_path = sys.argv[2...
2c107f7f55eb09d6f77d62c6c62cffdb3cf16ca39a9be60494e1ff51962cd871
Python
3,910
98
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Unit tests for (dunder) composition functionality attached to the base class.""" __author__ = ["fkiraly"] __all__ = [] import pytest from sklearn.preprocessing import StandardScaler from sktime.classification.compose import ClassifierPipeline ...
8fa23b14095106ad49936df6ce225b95b29756d0a4e24eeacbe6270b656c8e67
Python
3,910
103
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
572902167f12c58bbad427a0e3e4df1db65ee95aafb8891d6240fc8e21154e12
Python
3,912
126
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.reference.ops.op_rms_normalization import _rms_normalization def c...
df8a2556471f9a61a6c975d3967b6d113e077d90fadaa52746f05bd2173cb879
Python
3,912
108
""" Author: Yifan Jiang (yifanyifan.jiang@mail.utoronto.ca) and Peidi Xu (peidi@di.ku.dk) Description: Given a bifurcation, finds the optimal position of the branching point and the optimal radii. """ import numpy as np from scipy.optimize import minimize class GD_Optimizer: def __init__(self, loc...
93c909f3edd833187cdc5c2c24b211b6afc47b4ad6d55095ba6ec1d2c550d6a8
Python
3,913
119
from __future__ import annotations from dataclasses import asdict from dataclasses import dataclass import json import mimetypes import os from typing import TYPE_CHECKING import uuid from optuna._convert_positional_args import convert_positional_args from optuna.study import Study from optuna.trial import FrozenTria...
f1b76980e23d39c341919887c06ae38d8b908a42419a7a58feafdf5600cfa3ec
Python
3,913
162
import _pickle as pickle import sys from scipy import stats import numpy import multiprocessing print('''$1: Index Data\n$2: Output file''') INDEX_DATA_FILE=sys.argv[1] OUT_FILE=sys.argv[2] class Person_PCC_Data: import numpy def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header): self.EXP = EXP ...
2419a8f123113271502df8f27dcead88249c915f1a7e93d5f3d7bf6348d49850
Python
3,914
114
import io import os import tarfile import threading import time from concurrent.futures import ThreadPoolExecutor import pytest from siibra.retrieval import cache as cache_module from siibra.retrieval import repositories from siibra.retrieval.cache import CACHE def make_tarball(path, files): """Write a tarball ...
a5c715839c3687ad27165d38634e5fb5da55178c6da57e49c57275a281473c88
Python
3,914
136
import numpy as np import pandas as pd import pytest from pandas.testing import assert_frame_equal from seaborn._core.groupby import GroupBy from seaborn._stats.aggregation import Agg, Est class AggregationFixtures: @pytest.fixture def df(self, rng): n = 30 return pd.DataFrame(dict( ...
6db3af834b504b31862f9806071ad7f8a8112e1924f17c924641da4de25c327e
Python
3,917
108
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...