sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
64c6e63af18e92fec71c8efc804aaf6c9dd29a875981af971d2f56ec30b479c5
Python
8,590
262
import itertools import math import numpy import pandas import pytest import scipy.spatial from ..euclidean_join import ( euclidean_distance, euclidean_join, euclidean_pairs, ) def _brute_force(first, second, radius, strict): result = set() for p, q in itertools.product(map(tuple, first), map(tu...
6355adb425d8ab32857280e86c9cdaf62845a4efb636d789b23dab519dedddce
Python
8,594
232
from datetime import timedelta from urllib.parse import urlencode from django.test import override_settings from django.utils import timezone from django.utils.dateparse import parse_datetime from organizations.tests.factories import OrganizationFactory from projects.tests.factories import ProjectFactory from rest_fra...
5561afc919251257ac77cf8c10efe63711932c4961cd66bba70db9bacb897eec
Python
8,597
220
"""Galaxy file source plugin for Aspera ascp transfers. This plugin provides download-only functionality using the Aspera ascp command-line tool. It is designed as a configured plugin (not stock) requiring explicit configuration with embedded SSH keys. Architecture: - ascp.py (this file): Galaxy plugin configuration ...
856f0bba722cafbfd7cc667d13aca835c28c29d8b0e0f850e79b332be1d91700
Python
8,600
243
import logging import random import numpy as np from gunpowder.nodes.batch_filter import BatchFilter from gunpowder.coordinate import Coordinate logger = logging.getLogger(__name__) class SimpleAugment(BatchFilter): '''Randomly mirror and transpose all :class:`Arrays<Array>` and :class:`Graph` in a batch. ...
58185cf290772ebbcddce30ae5569496d3a6629a9850306bf39d40f72977bdb1
Python
8,603
225
#!/usr/bin/env python3 # 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. # pyre-strict import numpy as np import numpy.typing as npt import pandas as pd import plotly.graph_objs as go from ...
6108cbc6c667c7bfc25f6b09de7374714889cc2ee9e9487214deae7dba31e46d
Python
8,621
285
import pytest import networkx as nx def test_tikz_attributes(): G = nx.path_graph(4, create_using=nx.DiGraph) pos = {n: (n, n) for n in G} G.add_edge(0, 0) G.edges[(0, 0)]["label"] = "Loop" G.edges[(0, 0)]["label_options"] = "midway" G.nodes[0]["style"] = "blue" G.nodes[1]["style"] = "l...
1a705ae4b984c5df70b15e47c75814dfc8a06885d47f33c913e1aa9989d5bd05
Python
8,623
214
#!/usr/bin/env python3 # 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. # pyre-strict from copy import deepcopy import numpy as np from ax.adapter.base import DataLoaderConfig from ax.ada...
b7cb80b136d0c871aa25466a58be5de20ff2195f77e2f708608f6ab619348fe0
Python
8,623
230
# Copyright (c) MONAI Consortium # 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, so...
4a8f9c9a34c91cecb2d5c76a54da1bed4759a379d7fb11c84d73c1ea8b5749ee
Python
8,625
246
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ | Title: part 3 of the preprocessing | Date: 2021-02-01 | Author(s): Theodor Rumetshofer | Description: This is doing the second part of the preprocessing for the Leiden and Lund cohort. Subjects from the Leiden cohort w...
7fc05270a022221a2b786cf6c30774cd18a3d45d8b8422ecf427b128f1d5dd84
Python
8,626
208
#!/usr/bin/env python3 # 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. # pyre-strict from ax.adapter.base import Adapter, DataLoaderConfig from ax.adapter.data_utils import extract_experi...
e6b6400464e4f7c7dea8708b5717182b48568be1a6983710cd1f1c2935571e3d
Python
8,629
238
from brian2.synapses.synapses import SynapticPathway from brian2.core.functions import Function from brian2.core.variables import ArrayVariable import numpy as np from brian2lava.utils.utils import mode_dependent @mode_dependent def code_object( self, owner, name, abstract_code, ...
1c2e0efa2b326c0885a357459039f5b04846711b72cd6569ddc965f4094c9d44
Python
8,635
232
import unittest import numpy as np from bsb_test import ( NetworkFixture, NumpyTestCase, RandomStorageFixture, get_test_config, ) from bsb import Configuration, InputError, RedoError class TestSingleTypeCompilation( RandomStorageFixture, NetworkFixture, unittest.TestCase, engine_name="hdf5" ): ...
1c6620ac2605dd00558a5208df0bbe94b21f788837b5b5ac89985c6aac029c3f
Python
8,635
222
import os import numpy as np import pandas as pd from glob import glob from nilearn.image import * from nilearn.plotting import plot_stat_map, plot_glass_brain, find_cut_slices from nistats.second_level_model import SecondLevelModel from nistats.thresholding import map_threshold from scipy.ndimage import binary_erosion...
d84a790667b3e9fd4ada9b60afb7c21a0475fc809611420de510a5e96632ec9c
Python
8,635
222
import os import numpy as np import pandas as pd from glob import glob from nilearn.image import * from nilearn.plotting import plot_stat_map, plot_glass_brain, find_cut_slices from nistats.second_level_model import SecondLevelModel from nistats.thresholding import map_threshold from scipy.ndimage import binary_erosion...
61cf1c9d48213d3d902459a74a2d9493017baa5f6ead048ffe6bec8079ab32ee
Python
8,638
209
import argparse import os import dgl import numpy as np import torch import torch.nn.functional as F from dgl.data import register_data_args from pytorch_lightning.metrics.classification import Accuracy from pytorch_lightning.metrics.functional import auroc from reactome_model import * from reactome_pro...
41ead599fadae6407c77ae3b4a3dc19c346a9de8e8e3b1ccf35eff78f7ca00a1
Python
8,642
191
#!/usr/bin/env python ####################################################################### ####################################################################### ## Created on April 4th 2019 to check nf-core/chipseq design file ####################################################################### ###############...
155d412847c31081b7177d9a0d4b6a3cd6066a0ba849a9f35311d3bda64c8a1d
Python
8,643
218
# MIT License # # Copyright (c) 2019 Lucas K Wagner # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merg...
9e7cbbb79835950595375293e05e342b8a706b709db29effeb4bb03826a22aae
Python
8,645
239
import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab import * import numpy as np import random import math import time import os import glob def rmsd(x,y): Nx = len(x) Ny = len(y) if Nx!=Ny: print('WARNING! Nx!=Ny. Could not cal...
7f2b23891d3b809c69442784d75092d2391bfcdbb7417d0c5ab67f888a655478
Python
8,648
210
# 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. # pyre-strict from ax.analysis.best_trials import BestTrials from ax.api.client import Client from ax.api.configs import RangeParameterConf...
8fc4f4ad8d9f89f10ac2d49a4602a5984664ec721836b0c734dcf5779eb6980a
Python
8,649
260
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
fa7c70e17172ba9c00b859771ca50343fafce01233a22be7bac75d228bced090
Python
8,650
267
import pandas as pd import numpy as np from tqdm.auto import tqdm from pathlib import Path import os,json from dataclasses import dataclass,field from typing import Optional from transformers import ( AutoModelForCausalLM, AutoTokenizer, AutoConfig, HfArgumentParser, TrainingArguments, MODEL_FOR...
3af5c1c2c9ea75d9391fd28b993a709dcf9c0af44d88b96843bdffa89779d75f
Python
8,652
225
from nipype.interfaces import afni as afni import os import glob import click from .job_manager import BatchManager, Job from .config_json_parser import ClpipeConfigParser import logging import sys from .error_handler import exception_handler from nipype import MapNode, Node, Workflow import nipype.utils import pandas ...
d7c090c319a7d2b02e39333202fd483c976135eb9de6dc18080658ebc7853afb
Python
8,653
225
from nipype.interfaces import afni as afni import os import glob import click from .job_manager import BatchManager, Job from .config_json_parser import ClpipeConfigParser import logging import sys from .error_handler import exception_handler from nipype import MapNode, Node, Workflow import nipype.utils import pandas ...
9b5ac22fa91460cf8eddeacee9b1a06a2133a703f4c24d25f8d42f7f8a3ebe93
Python
8,656
174
import datetime # Usage: rename this file to experiment_config.py, # adjust according to your needs, # and run the experiments with `python run.py --config_file experiment_config.py` ##### variable parameters ##### # variables that define the experiments # network or data parameters can be varied # one experiment wil...
5c77790f1051d22697dbe68678000f1b0a6d1e206e90c91961587b5d8b8bfd74
Python
8,657
258
"""Benchmarks for a certain set of algorithms""" import random import networkx as nx from benchmarks.utils import ( benchmark_name_from_func_call, fetch_drug_interaction_network, weighted_graph, ) from networkx.algorithms import community class UndirectedAlgorithmBenchmarks: timeout = 120 nodes ...
f04f7bcb17c667b1f03548e3a0d318ac9f9b270a8a8dc88478237274424e4b23
Python
8,657
286
# -*- coding: utf-8 -*- """Docking_GD_Parallel.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1P4GssDPNRBrGwGPIuuTlIdHmC0J2TjxJ """ import os import sys if len(sys.argv) != 7: print('Wrong input parameters\n\n') print(len(...
51248b36078ea4049b54b80c91777514dc8c6588fe9c86de21bff38648b4a199
Python
8,662
284
from pathlib import Path from typing import AbstractSet, Tuple from unittest.mock import patch import numpy as np import pandas as pd import pytest from .. import NeurolangDL from ..neurosynth_utils import StudyID, get_ns_term_study_associations @pytest.fixture def metadata(): return pd.DataFrame( [ ...
8eea96bf29aec1e75969496ec46bd3a1c3ec831286c2c5a2ea8c5322ce7af9ee
Python
8,662
177
import natsort import numpy as np import mdtraj from pathlib import Path import argparse import os import concurrent.futures from tqdm import tqdm import csv def quickly_list_pdb_files(path): file_list = [] with os.scandir(path) as entries: for entry in entries: if entry.is_file() and entr...
20b4601527d431b510f0f1b733e1e0950cce559957a5fe58b745177bf617009e
Python
8,663
242
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.""" import hashlib import logging import os import shutil from copy import deepcopy from datetime import datetime import ujson as json from core.utils...
2a3a5a12f6b27aee92a8231e9eff1068c53adba598906d1abd55c935a88124cf
Python
8,670
204
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
e29e9b4033db80f0ad56f9c95bb99df6f554430606ffa245a013ed575de50165
Python
8,672
306
import operator import typing import pytest from ....datalog.basic_representation import DatalogProgram from ....datalog.expressions import Fact from ....datalog.negation import DatalogProgramNegationMixin from nl_expr.exceptions import ( ForbiddenDisjunctionError, ForbiddenExpressionError, ProtectedKeywo...
b2385b48b7354bad37f91a5800193d00f5b89c424c42225ef4c5cdc85c6652c4
Python
8,673
234
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
e859d8274599c1f34f26ff77f335e0015391d596d09b4a2b5d18754d3b580e41
Python
8,676
206
import logging import os import random import time from abc import abstractmethod from typing import List, Optional import numpy as np import sqlalchemy from sqlalchemy import exc from rlmolecule.alphazero.alphazero_vertex import AlphaZeroVertex from rlmolecule.mcts.mcts_problem import MCTSProblem from rlmolecule.sql...
4d0c5e9ff0afed923e7a549af941403862a3060239f71e653cb703fcb9b4818c
Python
8,677
222
# #!/usr/bin/env python # """ # Compare predictions with Neuroglancer using Dask for parallel data loading. # # This script loads prediction probability maps (and optional labels) from a Zarr container, # adds them as layers (with a chosen shader) to a neuroglancer viewer, and sets up an # interactive grid layout...
b85592cde6552b869521136b1de364320f1f661d2eb1822c6aaae2174e8e9be6
Python
8,677
204
#!/usr/bin/env python3 # 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. # pyre-strict from copy import deepcopy from unittest.mock import MagicMock import numpy as np from ax.adapter.base...
7b505f74b74c554fb626c5415e2a15447908e856ea2e2d2c6f32359eb1901267
Python
8,681
258
from numpy import random from ..interval_algebra import ( converse, meets, before, starts, during, finishes, equals, overlaps, negate, get_intervals_relations ) from ..regions import Region from copy import deepcopy def app(x, z, first, second, elements): elements.remove(x) elements.remove(z) ...
304e8bd0e8ccba34a1088c8c4b19922157edc5a9348818a875e531ec7b0f5d4d
Python
8,688
219
from meld_classifier.evaluation import Evaluator from meld_classifier.experiment import Experiment, load_config from meld_classifier.meld_cohort import MeldCohort import argparse import numpy as np import json import os import importlib import sys import h5py from meld_classifier.paths import EXPERIMENT_PATH import sub...
742fa434eb58bf309b6550c2ff5cb526660c6d4e2c19bf38d50c4b5de2cc6d9f
Python
8,691
200
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import tqdm import os from .native_api import NativeAPI from .rcc import rcc, rcc3D def dme_estimate(positions, framenum, crlb, framesperbin, imgshape, coarseFramesPerBin=None, coarseSigma=None, perSpotC...
cbeb1c52fbf94e32c7abb207697ea821ddd62607e37a3093d5d49c962d3521a7
Python
8,696
265
import torch import torch.nn as nn import torch.nn.functional as F from cogdl.utils.srgcn_utils import act_attention, act_map, act_normalization from cogdl.utils import spmm, add_remaining_self_loops from torch_sparse import spspmm from .. import BaseModel class NodeAdaptiveEncoder(nn.Module): def __init__(self,...
2463b0a8fd5a7f4eb3ea4ae96f93b1e4f040f6aafbc4c63cc2987ad83e9d52ab
Python
8,701
224
import os import inspect import importlib import torch import random import numpy as np import pandas as pd import tensorflow as tf import pathlib import easypheno.model def get_list_of_implemented_models() -> list: """ Create a list of all implemented models based on files existing in 'model' subdirectory o...
9db64677e217eb44b5d510466e89543272f23932dfdb831616562cc946ea1fad
Python
8,705
292
import argparse import os import csv import math import matplotlib.pyplot as plt RESULTS_FILE = "results.csv" EPOCH_IDX = 0 LR_IDX = 1 EVAL_LOSS_IDX = 4 EVAL_ACC_IDX = 5 SPLITTER = '?' # graph_results def graph_results(input_dirs="./saved_models/results", output_dir=None, model_names=None, epoch_start...
58bab65da4b394ec231bf893cebe8243fe8521b2a1908fe1967c5df172b31bbe
Python
8,706
219
""" General functions for training an experiment. """ import numpy as np import torch import torch.nn as nn import time import settings import roblib from models import BCSLayer, Memorynet, set_seed from datasets import load_aux_patterns, load_traintest_patterns import experiments import os.path import uti...
386ea6a2a9ab3f5cea6ec73e1d25f2c7f977427faca120b3578b829592b4c820
Python
8,708
274
from typing import Optional from itertools import chain from functools import partial import torch import torch.nn as nn from .gin import GIN from .gat import GAT from .gcn import GCN # from .dot_gat import DotGAT from .loss_func import sce_loss from graphmae.utils import create_norm, drop_edge def setup_module(m_t...
200f7552a41abf33553bd0b87abd4bd0af3b8a98a1726423647fbbfefef268bf
Python
8,709
239
import pathlib import subprocess from concurrent.futures import ProcessPoolExecutor, as_completed import numpy as np import pandas as pd import xarray as xr from Bio import SeqIO, motifs from ..mcds import RegionDS from ..mcds.utilities import write_ordered_chunks def _get_motif_threshold(motif, method, threshold_v...
781022c000d6260080232263805dfece7f3d54f2067ed896316c9c729167c8c5
Python
8,717
263
import collections import pickle import pytest import networkx as nx from networkx.utils.configs import BackendPriorities, Config # Define this at module level so we can test pickling class ExampleConfig(Config): """Example configuration.""" x: int y: str def _on_setattr(self, key, value): ...
13a373b93bdf68e88259652b6a4fd05034fe3d6b7c31570c47353f63816cd253
Python
8,718
280
import numpy as np import scipy.sparse as sp import scipy.io as spio import isolearn.io as isoio from scipy.stats import pearsonr import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.colors as colors import matplotlib as mpl from matplotlib.text import TextPath from matplotlib.patches impo...
99074c5d7cbbec352375ffa1642ac09601795e0a0ab63e17c51101231bcdefbe
Python
8,720
258
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Functions used to preprocess data and initialize things Created on Wed May 19 09:56:01 2021 @author: townesf """ import numpy as np from os import path from math import ceil from copy import deepcopy from scipy import sparse from contextlib import suppress from scan...
7261c9a9ca66320e3d54baa0493be6c85824e57e412988d0700d766d2f362c23
Python
8,722
269
""" The objects to place in the grid. Objects define all the regions in the grid with a modified update equation, such as for example regions with anisotropic permittivity etc. Available Objects: - Object - AnisotropicObject """ ## Imports # typing from ..utils.global_constants import ETA_0 from .typing_ import ...
2e627b33f898a9561f453b021a6972380b23391f6e0cfd207e0b3575a59c497d
Python
8,723
278
""" The original fdtd module supports several backends. In NIDN, however, we only support torch. The ``cuda`` backends are only available for computers with a GPU. """ ## Imports # Numpy Backend import numpy # numpy has to be present from functools import wraps # used only by test runner. # default must be idx ...
56ca6a9728744fc423f549f00155ecc25adcb3508e3c4fc7355bca5374f7e887
Python
8,723
212
from collections import defaultdict import pyBigWig import pysam from ._doc import * from .utilities import parse_chrom_size, parse_mc_pattern class ContextCounter: def __init__(self, mc_contexts): self.mc_counts = defaultdict(float) # key is context pattern like CHN, CGN self.cov_counts = defa...
7b3654b3e97c95a8d5264d644eabc359cc028e5eb82f3cafc58f81f5259b3170
Python
8,723
213
#!/usr/bin/env python # Identification of potential RNA G-quadruplexes by G4RNA screener. # Copyright (C) 2018 Jean-Michel Garant # # This program 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 Foundatio...
33f1d2eb5ec28da3f69fe10f597385e560820670801ddc498992a2262a3ac180
Python
8,724
203
#!/usr/bin/env python3 # 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. # pyre-strict from dataclasses import dataclass from typing import Any from ax.adapter.registry import Generators f...
d9a8ad84b9c71bb2f02ce7f2bca050d74f9ec0986a2ebd58b0adfb7ced78182d
Python
8,735
248
# MIT License # # Copyright (c) 2019-2024 The PyQMC Developers # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, m...
172fe674d3aa1256c29c9076726e0263ff59d4f1bb5add98573d92b4c0d1a34d
Python
8,742
259
# -*- coding: utf-8 -*- # Author: Florian Boudin # Date: 09-10-2018 """Kea keyphrase extraction model. Supervised approach to keyphrase extraction described in: * Thuy Dung Nguyen and Minh-Thang Luong. WINGNUS: Keyphrase Extraction Utilizing Document Logical Structure. *Proceedings of SemEval*, pages 166–169, 20...
892118225d5708ad10ca6afb01eea20118f565bcd1ea820d32d5640dec3e222f
Python
8,743
176
import datetime # Usage: rename this file to experiment_config.py, # adjust according to your needs, # and run the experiments with `python run.py --config_file experiment_config.py` ##### variable parameters ##### # variables that define the experiments # network or data parameters can be varied # one experiment wil...
bf58162b1f32887459e289365c693a7a5b57280b204861fd100a26e9062c5b05
Python
8,752
299
import os, fnmatch import numpy as np import scipy.io import tifffile as tiff import h5py class Processed: """ A class used to load and save already processed datasets (or image files) in .mgh,.tif,.h5 or .mat format """ def __init__(self): self.nMetaBytes = int(1024 * 1024) self.stor...
8f407a8b5d510b1e8d0d10b2751b2a2aeadd6f5eb89fa9f414233444d2814ac0
Python
8,754
267
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import os import random import sys from itertools import product NAME = "comments" def read_rules(name): rules = [] with open(os.path.join(sys.argv[1], f"{name}.csv")) as f: reader = csv.DictReader(f) ...
d95e87688e4b4e1d2bb91dc82208dfb379f2347768f2f927b1a426ce786171bc
Python
8,754
270
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 5 11:24:49 2020 @author: amelie """ from brian2 import * from scipy import signal from cells.RS_FEF import * from cells.FS_FEF import * from cells.SI_FEF import * from cells.VIP_FEF import * from FEF_visuomotor_tests import * from FEF_contrast_d...
35d4708a4b8b2a8c86d03b580dc30277f4de1ad127b3137d1ab407ea5bcef261
Python
8,759
216
import contextlib import sys import typing import nest from bsb import ( AdapterError, SimulationData, SimulationResult, SimulatorAdapter, options, report, warn, ) from tqdm import tqdm from .exceptions import ( KernelWarning, NestConnectError, NestKernelError, NestModelErr...
f9126dbb46eb23942c592aaff49f579d02de56c4509852c98c8b1119e2479aeb
Python
8,759
261
"""Tests for the :mod:`networkx.algorithms.triads` module.""" import itertools from collections import defaultdict from random import sample import pytest import networkx as nx def test_triadic_census(): """Tests the triadic_census function.""" G = nx.DiGraph() G.add_edges_from(["01", "02", "03", "04",...
7c14ddf49cc3913a8d433ec6050092f654a15353f7956450ecbf84e568527650
Python
8,765
274
import math import pytest import networkx as nx from networkx.algorithms.planar_drawing import triangulate_embedding def test_graph1(): embedding_data = {0: [1, 2, 3], 1: [2, 0], 2: [3, 0, 1], 3: [2, 0]} check_embedding_data(embedding_data) def test_graph2(): embedding_data = { 0: [8, 6], ...
79ffb1629e36a2c72f25cb00e342c3ea5d9c577cc72b1172c2ee19819b6f28b6
Python
8,773
238
import pytest from himalaya.backend import ALL_BACKENDS, set_backend from himalaya.backend._utils import _dtype_to_str from himalaya.utils import assert_array_almost_equal @pytest.mark.parametrize('backend', ALL_BACKENDS) def test_apply_argmax(backend): backend = set_backend(backend) for array in [ ...
9cc9d168fe873133abc89cc0f5aee89574c1f79240256956ddf68f0246f7db7b
Python
8,778
166
import re import sys import os import math from scipy import stats print("ALL_PPI_mutation_sites_mapping_with_allonco") output = open(r'E:\OneDrive\学术\PPI article\data\mapped data\3. DNM_complex_mapping\ALL_Complex_PPI_mutation_sites_allonco.txt','w+') with open(r'E:\OneDrive\学术\PPI article\data\mapped data\...
e3cc1408e506df74b595c5a1f4c0ac84883fd0bde26546948ca50f933903c40a
Python
8,778
245
from itertools import chain, tee from nl_expr.exceptions import NeuroLangException from nl_expr.expressions import Constant from nl_expr.logic.unification import ( apply_substitution_arguments, compose_substitutions, most_general_unifier_arguments, ) from nl_expr.utils.orderedset import OrderedSet from .. ...
26e9ce641c90ef5dcf25868b64b7397adb131f9bb0048f0817008c39f8604a5f
Python
8,780
230
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache Licen...
9a29c7495ecac93cf47775f2ce39af129de47bd22a11a563827fbd38be4a6e75
Python
8,785
321
import neuroglancer import operator import logging import numpy as np logger = logging.getLogger(__name__) class ScalePyramid(neuroglancer.LocalVolume): """A neuroglancer layer that provides volume data on different scales. Mimics a LocalVolume. Args: volume_layers (``list`` of ``LocalVol...
204bbca6c867cfa3c55a1a66697f5d42b507ce471f86328bba7a2d166f7b91d4
Python
8,786
186
"""A setuptools based setup module. See: https://packaging.python.org/guides/distributing-packages-using-setuptools/ https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages import pathlib here = pathlib.Path(__file__).parent.resolve() # Get the...
25e86454792e98358c9f1c15e50fede410e23af581290ab04de520b007c358f7
Python
8,793
198
"""Implements the Time-Aware PC (TPC) Algorithm for finding Causal Functional Connectivity from Time Series. """ import time import numpy as np import pandas as pd from timeawarepc.tpc_helpers import * from timeawarepc.pcalg import estimate_skeleton, estimate_cpdag, ci_test_gauss import rpy2.robjects as robjects from r...
83636090b07526245918a7921e06ba7d72041ff1b9b51e6fbc93876d40393387
Python
8,795
164
import os from os.path import join as opj import subprocess from subprocess import Popen import shutil import argparse import numpy as np import nibabel as nb from scripts.data_preparation.extract_features import io_meld from scripts.data_preparation.extract_features.create_identity_reg import create_identity from meld...
d9a7ebcd3fd71930b654e898b3a6130c6d836d788b2681a26e2f5d4c703634b7
Python
8,795
244
import subprocess from concurrent.futures import ProcessPoolExecutor, as_completed import numpy as np import pandas as pd import xarray as xr from ..mcds import RegionDS from ..mcds.utilities import update_dataset_config, write_ordered_chunks def _call_dmr_single_chrom( dms_dir, output_dir, chrom, p...
ea5e2cbbbbdc095029910fba2b9691d15d6b8009b4ce96877d63d35a58f92bb8
Python
8,795
250
import re from unittest import mock import numpy as np import pytest from zarr.core import Array from zarr.util import (all_equal, flatten, guess_chunks, human_readable_size, info_html_report, info_text_report, is_total_slice, json_dumps, normalize_chunks, ...
9adfbed0051cffca9ecf64a36ae1075677ad0b70ccc0c0252cc13a9206fc2dcd
Python
8,796
302
"""Test trophic levels, trophic differences and trophic coherence""" import pytest import networkx as nx np = pytest.importorskip("numpy") pytest.importorskip("scipy") def test_trophic_levels(): """Trivial example""" G = nx.DiGraph() G.add_edge("a", "b") G.add_edge("b", "c") d = nx.trophic_lev...
70a979a030d8ec4a57508575421a4c39805d3ef8be6c25b7c2ac2e2c9bc727a1
Python
8,797
287
import os import os.path as osp import numpy as np from collections import defaultdict import torch from cogdl.data import Graph, Dataset from cogdl.utils import download_url from cogdl.utils import Accuracy, CrossEntropyLoss class GCCDataset(Dataset): url = "https://github.com/cenyk1230/gcc-data/raw/master" ...
996cdc8ca99473b9444eabc343ab13455431aad468f96ee5f688fb4c58f4744c
Python
8,798
229
#!/usr/bin/env python # # Copyright (c) 2017 10X Genomics, Inc. All rights reserved. # import collections import cPickle import errno import h5py import itertools import numpy as np import os import scipy.sparse as sp_sparse import sklearn.neighbors as sk_neighbors import subprocess import tables import time import ten...
fd22d0d646f40200476b5ed3da37eaeef73d98e941ba575c8d5f05c53d0b6136
Python
8,800
247
""" Dinitz' algorithm for maximum flow problems. """ from collections import deque import networkx as nx from networkx.algorithms.flow.utils import build_residual_network from networkx.utils import pairwise __all__ = ["dinitz"] @nx._dispatchable( edge_attrs={"capacity": float("inf")}, returns_graph=True, prese...
bfb0b91585517ad61b93702bf9ac47765f0dd93ccf20551fbbf2ecc198639165
Python
8,803
218
import copy from inspect import getmembers, isfunction import matplotlib import numpy as np class EditorTool(object): def __init__(self, canvas, editor_gui, ax, figure_panel): self.canvas = canvas self.ax = ax self.figure_panel = figure_panel self.active = False # self.chil...
3b934599b06f9c62266a60f8c1519dc279faa85fe57b73ecf535be7b89c2bcc9
Python
8,807
281
import pytest import networkx as nx def test_modularity_increase(): G = nx.LFR_benchmark_graph( 250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10 ) partition = [{u} for u in G.nodes()] mod = nx.community.modularity(G, partition) partition = nx.community.louvain_communities(G...
270693d9fe14a20c60af1d7bdd806363d3bdf72861cf88882094aeeaa944348f
Python
8,809
209
# -*- coding: utf-8 -*- import pandas as pd import os import re import copy import numpy as np import time def goDeeper(props,this_path,a,max_a,conditions,folders): a += 1 for newFolder in os.listdir(this_path): print(newFolder) if conditions[a-1] != "": if newFold...
518f72b5010fd29b3bc99ebf40cc69c6feaaf8ed407edc2810ca9f3170dd2627
Python
8,812
238
# -*- coding: utf-8 -*- """ Created on Fri Nov 22 10:46:47 2019 @author: Amelie Aussel """ from brian2 import * defaultclock.dt = 0.01*ms eq_HTC_buffer_mdPul=''' dV/dt=(-INa-IK-IL-IKL-IH-ITLT-ITHT-IAHP-IGJ-Iapp-Iapp2-J-Isyn)/Cm_HTC : volt J : amp * meter ** -2 Iapp = randn() * gapp : amp * mete...
298bca2baef8ecdfb47c60f7e223f65fe9785184efcf7ef70eee4ce0c5848226
Python
8,814
197
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
e7a5ffa3e6c3ae5b834660fddd12524d174ed2232a5643d2c56b2cdef0558c95
Python
8,814
245
''' CUDA_VISIBLE_DEVICES=2 python Explainer_Experiments.py --model_name CMPNN \ --attribution_name GradInput \ --data_path ../MolRep/Datasets/Metabolism/admet_exp_hlm_t1-2_20210412_TriCLF.csv \ ...
6731206b4d4034a1699b38f7beb764e09c5b7b0a59d8b321b8c210112e300262
Python
8,815
205
""" Tools for analyzing motifs in the genome. Copyright (c) 2019 10x Genomics, Inc. All rights reserved. """ import tempfile import pyfasta import MOODS import MOODS.scan import MOODS.tools import MOODS.parsers from Bio import motifs from tools import ReferenceManager ALLOWED_FORMATS = ['bed', 'motif', 'position',...
97c781094374dfa4dfac36412be9fa8dcc3a4013226628ec3a8db9f4d0ccdbf2
Python
8,816
298
from nl_expr.logic.unification import most_general_unifier, apply_substitution from nl_expr.logic.expression_processing import extract_logic_free_variables from nl_expr.expressions import Symbol, Constant, Expression from nl_expr.expression_walker import ReplaceSymbolWalker from .exceptions import ( ParseException,...
8bd818545b45403e6f43ba70fcdf91946830b5041b4ef3ffe70d3bb8863a776d
Python
8,823
210
from collections.abc import Sequence import sys if sys.version_info >= (3, 12): from typing import override else: from typing_extensions import override import numpy as np import tensorflow as tf from hidten.tf.emitter.multivariate_normal import (T_shapelike, T_TFTensor, ...
f1d3eb144bf2a48ffa36a3e6381ab5904e4e62c39cf6769ec751f798a257e370
Python
8,824
210
# -*- coding: utf-8 -*- import pandas as pd import os import re import copy import numpy as np import time def goDeeper(props,this_path,a,max_a,conditions,folders): a += 1 for newFolder in os.listdir(this_path): print(newFolder) if conditions[a-1] != "": if newFo...
108c953e91ef7b33a29df401025acc75ba232b69394e01f5ffffe263ffecc6fc
Python
8,825
222
import math from typing import Optional import torch import torch.nn as nn from .. import functional, surrogate from .base_node import BaseNode __all__ = ["ParametricLIFNode"] class ParametricLIFNode(BaseNode): def __init__( self, init_tau: float = 2.0, decay_input: bool = True, ...
8627fbd81a794b204ba9ecca58b0ced4b7a80806b2d07ef93eb42f6895f1782b
Python
8,828
275
"""test annotations_combinator""" import numpy as np import numpy.testing as npt import voxcell import atlas_densities.combination.annotations_combinator as tested def test_is_ancestor(): hierachy = { "id": 1, "acronym": "root", "children": [ { "id": 2, ...
482c6408b5819f90e89e09f47b0c2210e1655d17dee9bd0a4e1b69282cf4aa9a
Python
8,831
228
#!/usr/bin/env python """Create a mask to ignore predictions at the boundary of objects using Dask. This script replicates the original behavior exactly by dividing the input labels volume (stored in a Zarr container) into blocks of a specified chunk size, growing each block by a context (set by the maximum of th...
498dccb228d7cb374d3dcf1a2b9210b2ea41a0cf09ebbcb9e8380db46bec6fd8
Python
8,835
236
from __future__ import absolute_import, division, unicode_literals from collections import MutableMapping from xml.dom import minidom, Node import weakref from . import base from .. import constants from ..constants import namespaces from .._utils import moduleFactoryFactory def getDomBuilder(DomImplementation): ...
38d4e022e8a1b6a8a924a33784f1a852bd31b657655be81dff157c5ae3c0feb1
Python
8,841
282
""" SkeletonProcessing ================== Utils to post process skeletons. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)' __copyright__ = 'Copyright © 2020 by Christoph Kirst' __webpage__ = 'http://idisco.info' __download_...
a2d28314f52a71a537d721c19d4c92229ea38228c53dba81429c5080cc602638
Python
8,841
256
import copy import os import torch import torch.nn as nn import numpy as np from .. import ModelWrapper from cogdl.wrappers.tools.memory_moco import MemoryMoCo, NCESoftmaxLoss, moment_update from cogdl.utils.optimizer import LinearOptimizer from collections import defaultdict from sklearn.model_selection import Stra...
44c1920f0608f07be95c7c46c87609aead643981d5dbe9381114e5b7c2353841
Python
8,842
186
import argparse from loader import BioDataset import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tqdm import tqdm import numpy as np from model import GNN from sklearn.metrics import roc_auc_score import pandas as pd from util import ExtractSubstru...
b828fd7529944c65a6c59f813558e7f17fef568050f073dc476cfe89777b7198
Python
8,842
214
"""Dynamo capture of FlexSN's callable scan body.""" import torch from ..._ops.flexsn.hop import _hop_scan __all__: list[str] = [] def _flatten_result(value) -> tuple: if isinstance(value, torch.Tensor): return (value,) if isinstance(value, (tuple, list)): return tuple(leaf for item in valu...
4c87efa34c5541acda5cdea83e26500aa4e564330efcb00ca30fc5a483769e56
Python
8,846
211
import os import time import numpy as np from math import sqrt class DANN(object): def __init__(self, learning_rate=0.05, hidden_layer_size=25, lambda_adapt=1., maxiter=200, epsilon_init=None, adversarial_representation=True, seed=12342, verbose=False): """ Domain Adversari...
3f1f387139cdcb54da3eceedc67cdffe84a118db95fe1eee073e1d23a8253317
Python
8,850
314
from typing import Optional import torch import triton import triton.language as tl from ..triton_layout import ( _block_minor, _neuron_grid, _neuron_indices, _spatial_offsets, _time_offset, _triton_layout_args, ) from ..triton_surrogate import _surrogate_gradient from .autograd import _check,...
4ab46b13c77d47130e00003c61f15df2b12b4994fc93d1ba819c9eb0bc493de3
Python
8,850
211
# -*- coding: utf-8 -*- import pandas as pd import os import re import copy import numpy as np import time def goDeeper(props,this_path,a,max_a,conditions,folders): a += 1 for newFolder in os.listdir(this_path): print(newFolder) if conditions[a-1] != "": if newFo...
438983c6eb497d0b55dc54196632cdb19c58f2ec0644fb5858eabfe26c386535
Python
8,854
219
import hashlib import logging import random from datetime import datetime from sqlalchemy import func from galaxy import ( model, util, ) from galaxy.tool_util.deps.dependencies import ToolInfo log = logging.getLogger(__name__) VALID_JOB_HASH_STRATEGIES = ["job", "user", "history", "workflow_invocation"] ...
5fbf3d09b956cae29321b08a65d04193cc897392ae584eb12e3d523ad76995a8
Python
8,858
228
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
53cca8cff78d4194f0acef8beb7fffb8ad35b5c459085724834e2fbd7987232a
Python
8,860
218
from dotmap import DotMap from tqdm import tqdm from loguru import logger import torch from nidn.fdtd_integration.constants import FDTD_GRID_SCALE from nidn.fdtd_integration.compute_fdtd_grid_scaling import _compute_fdtd_grid_scaling from nidn.utils.global_constants import UNIT_MAGNITUDE from ..trcwa.get_frequency_po...
7614ebedf774918d87b2254ec8ad76c970b678090c9a3c14492ba78823e77df7
Python
8,860
206
#!/usr/bin/env python3 # 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. # pyre-strict from __future__ import annotations from logging import Logger from typing import TYPE_CHECKING from ...