sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6d697813882b10db6b8619db58b05f0c78e0b6640c254bf88d9d4b5c10d2d395
Python
13,311
353
from __future__ import annotations from functools import reduce from importlib.util import find_spec from typing import TYPE_CHECKING import numpy as np import pandas as pd import pytest from zarr.storage import MemoryStore import anndata as ad from anndata._core.file_backing import to_memory from anndata.experiment...
0960de051054048f3b4030e0335c270215c6ad5710b4297b203f41c33afa8c9b
Python
13,313
288
from fig_utils import * import matplotlib.patheffects as pe def fig1(imgs_norm, masks_true, dat, timings, save_fig=False): fig = plt.figure(figsize=(14, 5.5)) thresholds = dat["thresholds"] grid = plt.GridSpec(2, 5, figure=fig, left=0.05, right=0.98, top=0.94, bottom=0.09, wsp...
6c813dc23649dbbe6a4779ad5c88505d92807f4f12854401aedf394ff66685ef
Python
13,324
368
#!/usr/bin/env python """ searches for tests for packages in the bioconda-recipes repo and on Anaconda, looking in different file locations. If no test can be found for the specified version, it will look for tests for other versions of the same package. A shallow search (default for singularity and conda generation ...
a482dcb26c497e780433b77d00f3608379457c0dc60d16fa782a4544a73d26f2
Python
13,335
365
import logging import os from typing import ( Any, cast, Literal, Union, ) # Playwright browser type names (matches BrowserType.name property) PlaywrightBrowserName = Literal["chromium", "firefox", "webkit"] try: from pyvirtualdisplay import Display except ImportError: Display = None try: ...
76a268bf6ea2e4a2dc19ac2651c8a9f5ce2838613e698912f41ae19d037d9a15
Python
13,336
449
""" Module for additional needed types """ import copy import functools import heapq as hp import random class SetDict(object): """ Type which implements the following operations with a runtime better than O(n): - adding of items (once) - removal of items - random access additional the operat...
366b95da40e8e2787631e3748707097f44120eda8c0f475f49e78a4ac601b50f
Python
13,342
431
"""Unit testing for time dependent algorithms.""" from datetime import datetime, timedelta import pytest import networkx as nx _delta = timedelta(days=5 * 365) class TestCdIndex: """Unit testing for the cd index function.""" def test_common_graph(self): G = nx.DiGraph() G.add_nodes_from([...
279bf9ff457855e42ebb72044f6748d9d082bcc7c3f1d9cec64890bec47dc644
Python
13,345
233
# -*- coding: utf-8 -*- """Auto-generated by geocode_institutions.py. INSTITUTION study coords. Resolve a raw sheet token with: COORDS.get(ALIASES.get(tok, tok)). """ INSTITUTION_ALIASES = { 'Brain Mind Institute': 'EPFL', "Children's Hospital of Philadelphia": 'Children’s Hospital of Philadelphia', 'Colum...
d48a857ad4c6e4da650fbf2074c2740c4f65ac7af0ca093233dff3c53f3b9c4c
Python
13,351
349
import pytest import networkx as nx from networkx.utils import edges_equal, graphs_equal, nodes_equal np = pytest.importorskip("numpy") pd = pytest.importorskip("pandas") class TestConvertPandas: def setup_method(self): self.rng = np.random.RandomState(seed=5) ints = self.rng.randint(1, 11, size...
ae565456bd6a6bdac477a2ef17c8fc99b3c78dfd45b7f06b9e8283f817525611
Python
13,355
282
import socket import os import numpy as np import pandas as pd import re import martian import tenkit.reference as tk_ref import tenkit.preflight as tk_preflight from constants import ALLOWED_FACTORIZATIONS, FRAGMENTS_SCAN_SIZE, NO_BARCODE from utils import motif_format_checker from tools.regions import bed_format_che...
c03a7c6b8874f8e060b94511d13d2a49af79db9716afc0f6e5f7abecdb670136
Python
13,355
309
"""Plot the zero-shot identification analysis results. Parameters ---------- rank_correct : int Accepted correlation rank of the correct synthetic data image condition. project_dir : str Directory of the project folder. """ import argparse import os import numpy as np import matplotlib from matplotlib import pyplo...
3a018af86082ddab46d4bcf40658e962bda34ef957c0e21e6d1ab729f83dcc8e
Python
13,364
424
from abc import abstractmethod import torch import numpy as np try: import cuhals use_cuhals = True except ImportError: use_cuhals = False from .base import VideoFactorizer from .factor import TensorFactor def native_update(Beta, Delta, Sigma, nonneg...
77c675c5570a1de8b1c634f1aa08b73a1a46840159c22bdbe0b00ed17037783e
Python
13,396
250
# generated by datamodel-codegen: # filename: openapi.yaml # timestamp: 2023-08-03T18:47:00+00:00 from __future__ import annotations from datetime import datetime from enum import Enum from typing import ( List, Optional, ) from pydantic import ( AnyUrl, BaseModel, Field, ) class ServiceTy...
958ea62026673809dd7d9541a238cc3e7fae3b59def58b1e296b039f8540824d
Python
13,405
424
from abc import abstractmethod import torch import numpy as np try: import cuhals use_cuhals = True except ImportError: use_cuhals = False from .base import VideoFactorizer from .factor import TensorFactor def native_update(Beta, Delta, Sigma, nonneg...
ccefbf8ce6bb6da0ff63acbfcc3150561612bdcd638270c4037d3bcbd2c04c00
Python
13,407
369
from __future__ import absolute_import import logging import os.path import re from pip._vendor.packaging.version import parse as parse_version from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request from pip._internal.exceptions import BadCom...
83df90eeb339860be3c90d5795ac4c01b2edbb2841f0eca8445ac502dcd921a1
Python
13,408
359
import torch import networkx as nx import numpy as np import os.path as osp import pickle as pkl import sys import scipy.sparse as sp from cogdl.data import Dataset, Graph from cogdl.utils import download_url, untar, Accuracy, CrossEntropyLoss def read_geom_data(folder, dataset_name): graph_adjacency_list_file_p...
ae6fb0544b1d8201422ad516a08953df9fdd2213fb6c1a8b9c284a57b711bbb0
Python
13,417
431
import numpy as np import matplotlib.pyplot as plt import math import power_law import matplotlib as mpl from cycler import cycler from tqdm import tqdm mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk') myfont = 6 myaxis_font = 8 plt.rcParams.update({'font.size': myfont}) line_width = 1 def nonlin(z, act = '...
f8ff9f5e9ea23a3e5b0f087e2dcbc11a8ce2fd38d0099f11045b9b3b8119ba19
Python
13,448
322
# 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...
154a40eebdc47ce6ced7601bf0cea391244d792f9e8be6a30f9a50c4bd0b805c
Python
13,451
400
"""Functions for estimating the small-world-ness of graphs. A small world network is characterized by a small average shortest path length, and a large clustering coefficient. Small-worldness is commonly measured with the coefficient sigma or omega. Both coefficients compare the average clustering coefficient and sh...
51cafd5c87ccf6bbf7341aa09f63a461436ab459a598400f39c4d1109d63e212
Python
13,454
276
import os import sys import tensorflow as tf import numpy as np import learnMSA.protein_language_models.legacy_pretraining.DataPipeline as data import learnMSA.protein_language_models.common as common from learnMSA.protein_language_models.bilinear_symmetric import make_scoring_model from learnMSA.protein_language_model...
97d3f88e19a183ff6e60154c35298b616f1bb47247d3bf92976488289b4ed4b0
Python
13,466
413
"""Functions for encoding and decoding trees. Since a tree is a highly restricted form of graph, it can be represented concisely in several ways. This module includes functions for encoding and decoding trees in the form of nested tuples and Prüfer sequences. The former requires a rooted tree, whereas the latter can b...
40664563d322644b2d8404f5a83c148476c3843b45fc3df0ee572849455fc5b3
Python
13,470
281
import numpy as np import pandas as pd def MichaelisMenten(K_i, C): # K_i: affinity ligand, C: concentration ligand act = C/(K_i+C) return act def CompetitiveBinding(K_A, C_A, K_B, C_B): # K_A: affinity ligand A, C_A: concentration ligand A a = K_A + K_B + C_A + C_B - 1 b = K_B*(C_A - 1) + K_A*(C_B ...
0025676afad3fa16b94e4e928b4f9c079d041825d157d71a6467dc826ae7d75d
Python
13,489
331
import os import os.path import tempfile import numpy as np import pytest import test_utils import xarray as xr from alpineer import image_utils from alpineer.test_utils import make_images_xarray, make_labels_xarray from skimage.measure import regionprops import ark.settings as settings from ark.segmentation import s...
a8a8fdf05583e089487d1c914d31237ccab1b20ef21e9d9d8ef2f661ccc1c978
Python
13,490
507
# -*- coding: utf-8 -*- """ Plot3d Module ============= Plotting routines for 3d display of data. Note ---- This module is using vispy. """ __author__ = 'Christoph Kirst <ckirst@rockefeller.edu>' __license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>' __copyright__ = 'Copyright (c) 2017 ...
fe1e1d442829e5b20a739df857befe0b2331be11b5dd9ce13a5cc72af13cd1a3
Python
13,503
374
import abc import ast import inspect import itertools import re import typing from collections import defaultdict from copy import copy from pathlib import Path import black from ..assets import Mod, Package, SupportedDialect from ..exceptions import ModSourceError, PackageApiError, PackageFileError if typing.TYPE_C...
ee81decc6300b4eacdd39be1606f8befae168bc8f56e0db82d3a468301f8c4cf
Python
13,528
380
# 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...
4c567b07ddf072165e273e96e75f64062a1db0a778c6faef281644b1b5bf83b4
Python
13,548
302
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
5f21cee47acd9e0d982f4058ad17c8b81299354a052d58eb30be211fde4f7920
Python
13,549
382
import copy import pytest import torch from spikingjelly.activation_based import functional, layer, quantize from spikingjelly.activation_based.functional.misc import ( delay, first_spike_index, redundant_one_hot, ) from spikingjelly.activation_based.layer.container import StepModeContainer from spikingje...
4468269da988d2df71c3463c8ed4ca1b4d90c6b561498cf321c57b151ceace2f
Python
13,557
437
""" HDF5 storage engine for the BSB framework. """ import importlib.metadata import json import os import shutil import time from datetime import datetime import h5py import shortuuid from bsb import ( BsbProvenanceUpgradeWarning, Engine, MPILock, ScaffoldWarning, config, report, warn, ) f...
703c8269b75fe5bdbf386700d92c958b7af1c940a3962469365e193c4f372e0e
Python
13,557
412
import json import pathlib from typing import Union import dask import numpy as np import pandas as pd import xarray as xr from cooler import binnify, read_chromsizes from scipy import ndimage def _get_chrom_offsets(bins): _co = {chrom: bins[bins["chrom"] == chrom].index[0] for chrom in bins["chrom"].cat.categor...
cb86e5905e6e9db28196108fbef3db28b9a16828f8eb44d66ca1081f2b622004
Python
13,560
325
"""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 json import logging import re from datetime import timedelta from typing import Union from urllib.parse import urlparse from azure.core.exc...
1e92bb662ab7518958c8c0699e92bf498f0c78ec5a4825acaf8e436ba69dbf00
Python
13,564
377
# 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 copy from collections.abc import Callable, Mapping from dataclasses import dataclass from typing import Any from ax.b...
36ebb698a091ff023b94d8ac6e80f64f3fc79dccc5ac2437efd927470b21e6d4
Python
13,565
341
# 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...
12d18d4dcfb2175322ea24562afc177543452c98d5365b0c1b72b6906173d825
Python
13,566
466
# -*- coding: utf-8 -*- """ ConvolvePointList ================= Convolution on a subset of points only. Paralllel convolution of a kernel at specified points of the source only. Useful to speed up processing in large arrays and only a smaller number of convolution points. Note ---- This module is heavily used in...
7cd0df4b1f7582a678dc44e4263349361c73b4030ffe05893fe0aaae18c0824d
Python
13,566
332
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
c4270347c8b7543cadfa090f016234c59e97140b4a62163c9a50497a09142ed3
Python
13,583
399
import pytest import torch import torch.nn as nn import torch.nn.functional as F from spikingjelly.activation_based import functional, neuron, surrogate from spikingjelly.activation_based.ann2snn.operators import ( SNNElementWiseProduct, SNNMatrixOperator, TDLinear, ) def _table(scale=1.0): return ne...
c6bbd424e64fbdaa0ea96820333b2f1c669082c8b7bd18d4c107967461eab39c
Python
13,594
545
import torch import torch.nn.functional as F from cogdl.options import get_default_args from cogdl.experiments import train cuda_available = torch.cuda.is_available() default_dict = { "hidden_size": 16, "dropout": 0.5, "patience": 2, "epochs": 3, "sampler": "none", "num_layers": 2, "cpu":...
a0bd5a62aa4fd4bbd651fc2386d1563e5bf1614f3533c0d91620e222a68c28f0
Python
13,595
338
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: chrisarcadia @created: 2018/06/04 """ # libraries import Chemical ############################################################################### # Periodic Table Of Elements ## ways of instantiating the periodic table of elements elements = Chemical.Peri...
e5cfe0639e591b42fd68f5d5fa3ac87b656668f0a15b7d6e5d90eb23e524aa53
Python
13,600
227
#!/usr/bin/env python3 # # 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 # ...
ae2ae725608b92a43480a7d30fab7902c45e4c28cacb38cf8150ca5fdac4e950
Python
13,604
302
"""Functions to provide variable documentation.""" import os import os.path as op import json from shutil import copyfile from collections import OrderedDict import sp_experiment from sp_experiment.define_ttl_triggers import provide_trigger_dict def make_events_json_dict(): """Provide a dict to describe all coll...
8f090c5e132f781c6a526ff73a6689638c0b42f14de9f67b2f3e79545988c47a
Python
13,615
384
# 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...
79594ea42fab73e54cb493e6575394cd173b0f0de9f19882b7addf7ee4663e20
Python
13,617
324
import logging import math from typing import ( Any, ) from galaxy import ( exceptions, model, ) from galaxy.model.dataset_collections.types.sample_sheet_util import validate_column_definitions from galaxy.util import string_as_bool log = logging.getLogger(__name__) ERROR_MESSAGE_UNKNOWN_SRC = "Unknown d...
178ae14c091afed2cc77474d583a3af61696f07b9fa5c55b401e7fb76cf2e09b
Python
13,620
320
import contextlib import copy import importlib.metadata import os import pathlib import tempfile import unittest from unittest import mock import toml from bsb import OptionError, ReadOnlyOptionError, option, options from bsb._options import QuietFlag from bsb.cli import handle_command from bsb.option import _clear_p...
2c0c55a9a4f72e6b90c36d3ffedd4aae02ca3c5d42cfe3e44da892ae03c2d455
Python
13,623
357
"""Functions for computing eigenvector centrality.""" import math import networkx as nx from networkx.utils import not_implemented_for __all__ = ["eigenvector_centrality", "eigenvector_centrality_numpy"] @not_implemented_for("multigraph") @nx._dispatchable(edge_attrs="weight") def eigenvector_centrality(G, max_ite...
1da2662600a81ce92e133d101bcb144038e501cdb6577419550323dac7e0ab9c
Python
13,625
351
""" Multiple-kernel ridge solvers ============================= This example demonstrates the different strategies to solve the multiple kernel ridge regression: the *random search*, and the *hyper-gradient descent*. The *random-search* strategy samples some kernel weights vectors from a Dirichlet distribution, then f...
5a0f3644d75516ccc34127a00e89742d7073727bf2b331616faf44b65aee40a5
Python
13,632
400
from pathlib import Path from rich.progress import track from rich import print import os import numpy as np from myterial import amber, orange, salmon from loguru import logger from brainrender.camera import check_camera_param, get_camera_params from brainrender._video import Video import brainrender as br from brain...
a48ed57970aee0423b6ebd956f25411d85b40ac7165a637060bdbae86e2f5df7
Python
13,636
303
"""Mark scikit-learn classes as configurable""" import gin # Clustering import sklearn.cluster # TODO: Delete when https://github.com/google/gin-config/pull/49 gets merged # Most of the classes mentioned in the docs: # https://scikit-learn.org/stable/modules/classes.html gin.external_configurable(sklearn.cluster.Af...
320457994832aaaa2ac841e69358506f9f0e58001e6738da7d286310ad470e7e
Python
13,640
355
# This code is based on decagon from # # https://github.com/mims-harvard/decagon # # Our contribution is the incorporation of GAT # encoder into the bipartite network. from __future__ import division from __future__ import print_function import os import pickle import time from operator import itemgett...
6ec233edb33ec74b8570448eb39e2436a70d7282eb435ea96692e433f3c51080
Python
13,640
364
#!/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 import warnings import numpy as np import numpy.typing as npt fro...
f00db2a32351b590f63e38d93a6e57843b0b2777b5e1fe89bf342a87af9d0484
Python
13,643
358
# 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 collections.abc import Mapping, Sequence from typing import final, Literal import pandas as pd from ax.adapter.base impo...
2260139f4aff3fe8ec0083c8bc7c8effb4244c181234d3d770961c827ca4e01d
Python
13,649
336
# 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...
b290c13d2303f835f2482d7be76fff0008107f59c6ee3f7028beec9082ca31c8
Python
13,649
435
""" ******************** Bipartite Edge Lists ******************** Read and write NetworkX graphs as bipartite edge lists. Format ------ You can read or write three formats of edge lists with these functions. Node pairs with no data:: 1 2 Python dictionary as data:: 1 2 {'weight':7, 'color':'green'} Arbitrary d...
ed6c49e31b89cf5326d54499f5124a55d543412ce303c2907596b06538428cff
Python
13,652
351
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Put the sample index barcode and 10X barcode into read tags in a BAM file. Screen each 10X barcode against the given barcode whitelist """ import itertools import json import random import martian import numpy as np import tenkit.bam as tk_bam import te...
d26e2546db6faf6fc54fa5ec84ff125f2eb0e8f1d235caba0f36a54b9ff71dab
Python
13,664
341
# 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...
e432540798e7251961186e767f4eb5e10e8e1186869c896f4fe27d8013dd4cd8
Python
13,665
239
import re import sys import os import math from scipy import stats print("MIPPI_mutation_sites_mapping_by_category") Disease_list = [] Category_list =[] Disease_category = {} with open(r'E:\OneDrive\学术\PPI article\data\de novo mutation data\20190514_MasterFile_allDNMs-codingLoc_v1.5.txt') as fp: text = ...
8883246c776d26c80395c76986113fb944c9d15193185cca215bcc77ba1a9a85
Python
13,669
371
import pytest import networkx as nx from networkx.utils import edges_equal class TestSubGraphView: gview = staticmethod(nx.subgraph_view) graph = nx.Graph hide_edges_filter = staticmethod(nx.filters.hide_edges) show_edges_filter = staticmethod(nx.filters.show_edges) @classmethod def setup_cl...
a15e133612988d3a5b28a0363b4f105c62d77da9ef4f4d4680ffa413d2939775
Python
13,682
257
import argparse from utils import load_architecture, evaluate, ArgsStruct import torch import os import json from training.covid_torch_dataset import CovidDataset, CovidData, DatasetBuilder from torch.utils.data.dataloader import DataLoader import logging import shutil import time import numpy as np from statistics imp...
630c4add5df15378f612faf2abd08faf97b0ee72ddd44982cc00752239e998be
Python
13,695
344
# 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...
4e3c939e4021c2c58309ab8ad2ecd18c0219836ad36a63204195931c533ee2d5
Python
13,696
344
import pytest import torch from spikingjelly.activation_based import functional, neuron, surrogate def _node(kind, **kwargs): node_type = neuron.TernaryIFNode if kind == "if" else neuron.TernaryLIFNode return node_type(**kwargs) def _scalar_rollout(x_seq, kind, threshold, reset, tau=2.5, decay_input=True):...
53b83e6308b34363b935180afcc66b785d67b4ce04e3d0b73ee177a1df95c33e
Python
13,698
367
""" The httplib2 algorithms ported for use with requests. """ import logging import re import calendar import time from email.utils import parsedate_tz from pip._vendor.requests.structures import CaseInsensitiveDict from .cache import DictCache from .serialize import Serializer logger = logging.getLogger(__name__) ...
e8a8ea1c1dabb366d2d20c5517810222332ae8f4d44081d91bf3d0059d02595e
Python
13,700
400
# 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 math from typing import final import pandas as pd from ax.adapter.base import Adapter from ax.analysis.analysis impor...
e7716b3d23381a6edfa2532e9069b388b548079e191ed9fe2d968b1fc68c8f2f
Python
13,706
308
#!/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 import mock import numpy as np from ax.adapter.base import Da...
14334cf6df52096fc36e85859ebabdabb47930f748e53e739d169f89f48acb57
Python
13,711
233
"""Functions for working with generic files. Functions --------- get_model_name(settings) get_netcdf_da(filename) save_pred_obs(pred_vector, filename) save_tf_model(model, model_name, directory, settings) get_cmip_filenames(settings, verbose=0) """ import xarray as xr import json import pickle import tensorflow as tf...
ca60de1452939a364c52b1427ab43c96f850a6fe2958eda3461e989a7a9c5182
Python
13,725
307
"""Run the MEMOTE test suite and record the total score for tracking. MEMOTE only computes a total score when it builds a report; the raw `memote run` result JSON contains per-test results but no score. So this runs MEMOTE in-process through its Python API and then builds the snapshot report to obtain the score, rathe...
3a7abdc6a7acd51d6aa6d9640143a196f18ed8964bbd5bce040eda3bbd9821f7
Python
13,730
382
""" Requirements file parsing """ from __future__ import absolute_import import optparse import os import re import shlex import sys from pip._vendor.six.moves import filterfalse from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._internal.cli import cmdoptions from pip._internal.download impor...
9fa13d8b0bbf085fb1ff34c31a3488c7d820c1fb6448f9f0cebb3931d4f03c07
Python
13,732
281
# generated by datamodel-codegen: # filename: https://raw.githubusercontent.com/ga4gh/workflow-execution-service-schemas/develop/openapi/workflow_execution_service.openapi.yaml # timestamp: 2025-11-18T17:23:28+00:00 from __future__ import annotations from enum import Enum from typing import ( Any, Option...
a6a7fd48cc1dc31b312011472c7551f06baffd95faaeacc018c968cf8766bfb1
Python
13,735
445
""" Neural dynamics library ======================= .. module:: lib_NeuroDyn :platform: Linux :synopsis: a miscellaneous of neural activity related methods. .. moduleauthor:: Jose M. Esnaola-Acebes <josemesnaola@gmail.com> Noisy signals ------------- .. autosummary:: :toctree: generated/ ou_process ...
b97abb8757c29af714c89861dc3ba3c99bc91f6486960a3e25174b6df7f76ca2
Python
13,735
400
from math import sqrt import pytest import networkx as nx np = pytest.importorskip("numpy") methods = ("tracemin_pcg", "tracemin_lu", "lanczos", "lobpcg") def test_algebraic_connectivity_tracemin_chol(): """Test that "tracemin_chol" raises an exception.""" pytest.importorskip("scipy") G = nx.barbell_gr...
590eaebb37a56dd6c3612a6d34804b61025577949003ae4269ed17214f567617
Python
13,754
383
# -*- coding: utf-8 -*- """ Class will handle the images in terms of folders Moves images to train, test, val folders as needed Separates images *DM.jpg and *CM.jpg """ import fnmatch import glob import os import random from pathlib import Path from shutil import copyfile import cv2 import numpy as np import pandas...
93050437f8481c3ecdddd1d9b8a5b0da7df363dc5beb0a4ba1fdb36d31eaae21
Python
13,761
462
from funlib import evaluate import math import networkx import unittest class TestRandVoi(unittest.TestCase): def test_skeleton_lengths(self): skeletons = networkx.Graph() # length of 2*sqrt(2) skeletons.add_node(1, skeleton_id=1, z=0, y=0, x=0) skeletons.add_node(2, skeleton_id...
5613d98bf7e357ccb41a68527ba294fa528598c5ddfa9f2890d0e0d406615c65
Python
13,763
426
""" Scene - Create a scene, add root and inset if necessary - add actor method - special methods """ import sys from pathlib import Path from vedo import Mesh, Text2D, Assembly import pyinspect as pi from rich import print from loguru import logger from myterial import amber, orange, orange_darker, salmon ...
87939aee8ac56a36d34ea2c8fa3683aee10236cd92aeb297b35847484d5c0de2
Python
13,764
440
""" Unit tests for inhibitory cell density computation (linear program minimizing distances to initial estimates) """ import numpy as np import numpy.testing as npt import pandas as pd import pandas.testing as pdt import pytest import atlas_densities.densities.inhibitory_neuron_densities_optimization as tested from a...
b60aeab4b82fb56ec445a93c0a7166e69b70402736ff27a187f805a73459547d
Python
13,764
247
import torch from nidn.utils.global_constants import EPS_0, PI, SPEED_OF_LIGHT, UNIT_MAGNITUDE from nidn.fdtd_integration.constants import FDTD_GRID_SCALE from nidn.fdtd_integration.compute_fdtd_grid_scaling import _compute_fdtd_grid_scaling from ..fdtd_integration.init_fdtd import init_fdtd from ..fdtd_integration.c...
ad827f9c28b962b5e1dfd22673301de5478b4170279b608dbc305919bbfd6bde
Python
13,772
213
from utils import checkattr def set_method_options(args, **kwargs): # If the 'convenience' option for a specific method is selected, select the corresponding defaults if checkattr(args, 'ewc'): args.weight_penalty = True args.importance_weighting = 'fisher' args.offline = True if c...
7c1e62db024c3e4c33538264f8ae573240fa7eccbce0d6b1a397b79803215977
Python
13,774
305
# -*- coding: utf-8 -*- """ Created on 2021.08.19 @author: Jiahua Rao """ import os import json import numpy as np import pandas as pd from rdkit import Chem from pathlib import Path from sklearn.model_selection import train_test_split from MolRep.Featurization.Graph_embeddings import GraphEmbeddings from MolRep...
759ae5f65a55dcaefcc13f1655967f402344d56b73c2daae0795827b3dd13476
Python
13,776
340
import unittest import numpy as np from bsb_test import RandomStorageFixture from bsb import MPI, CastError, CfgReferenceError, NumpyRng, Scaffold from bsb.config import Configuration from bsb.rng import _stable_ints class _NetworkMixin: """Builds networks whose only interesting configuration is their randomnes...
2aa62cf38f84eafe960ec9136a1db1b5a719ffbb1487e92724e56e5f1f102521
Python
13,789
314
import h5py import tifffile as tiff import importlib.util from ..utils import * cp, np, convolve, gpuAvailable, freeMemory, e = checkForCupy() class Writer: """ A writing object for saving processed images as they are reconstructed """ def __init__(self): # For MGH self.metaLengthbytes...
d5889b6c1b3bd115311cd38dcd11483fa58cc906ca79137770c0068d2433b176
Python
13,793
379
""" Boykov-Kolmogorov algorithm for maximum flow problems. """ from collections import deque from operator import itemgetter import networkx as nx from networkx.algorithms.flow.utils import build_residual_network __all__ = ["boykov_kolmogorov"] @nx._dispatchable( edge_attrs={"capacity": float("inf")}, returns_...
b6bbe9e9853f1cae7e5bb3c641fc10f72e0743197151640c0cdf7016e256cb84
Python
13,805
262
#!/usr/bin/env python # # Copyright (c) 2016 10X Genomics, Inc. All rights reserved. # import cellranger.analysis.constants as analysis_constants import cellranger.library_constants as lib_constants import cellranger.io as cr_io import csv import json import numpy as np import os import scipy.stats import sys import te...
b534eef7bbc154d81c54d9b4544a413a1bca1eb8d40dea51faa1ec51b7108e86
Python
13,806
391
""" Unit tests for densities utils """ from pathlib import Path from unittest.mock import patch import numpy as np import numpy.testing as npt import pandas as pd import pandas.testing as pdt import pytest from voxcell import RegionMap import atlas_densities.densities.utils as tested from atlas_densities.exceptions i...
ee33ab940f790b9b0458ab7da19d011c30999e363a987028d45ded97581bbaee
Python
13,806
397
# 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...
0de3ce58d6a785330eeebc4d15725a239c8911baaf6d493e5818efff94682a87
Python
13,810
380
#!/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 ax.adapter.base import DataLoaderConfig from ax.adapter.data_utils imp...
e47558c5a45629fd1c2a5fcef802658a91aba52c18ee44fe5b8db877682ef1f9
Python
13,816
289
"""Collection type descriptions and the compatibility algebra. Three operations on collection types, each answering a distinct question: - ``accepts(other)``: asymmetric direct-edge check. True iff an output collection of type ``other`` can be connected to an input slot whose declared type is ``self``. Used at wo...
3bdb73f9fd95e66f4f8e79f6c33908ec81644cb016c00c671fb689bd57b73794
Python
13,819
360
from __future__ import annotations from typing import Any, Literal import dask.array as da import geopandas as gpd import numpy as np import xarray as xr from shapely import box from spatialdata import SpatialData from spatialdata._logging import logger from spatialdata.models import Labels2DModel, ShapesModel from s...
6123ffd819d012324b75df6826b496e0ef02b0fc25f0c6ecb329a1b2ba4876db
Python
13,826
416
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from typing import Sequence, Tuple, List, Union import pickle import re import shutil import torch from pathlib import Path RawMSA ...
f1a0f138de91f4a308c83bd347650e36e67295969bd02fc5648f2a5ea3d4c86b
Python
13,828
241
import re import sys import os import math from scipy import stats print("MIPPI_mutation_sites_mapping_by_disease") Disease_list = [] Category_list =[] Disease_category = {} with open(r'E:\OneDrive\学术\PPI article\data\de novo mutation data\20190514_MasterFile_allDNMs-codingLoc_v1.5.txt') as fp: text = f...
e89feac76820e0047c56757409f5fd0b9d6dcd3dbed020833ecc1b833feabcf3
Python
13,829
230
# -*- coding: utf-8 -*- """ Created on Fri Jul 5 10:27:05 2019 @author: schelskim """ from .generaltools import generalTools from .analyzers import Analyzers from .neuriteconstructor import neuriteConstructor #from tools.dataframecleanup import DataframeCleanup import numpy as np import copy import pandas as pd f...
6de74867d06879c5fdf2b8445fccdcc8498a5888004f06cd02557968569696c3
Python
13,830
389
import logging from typing import Tuple, Union import dask.array as da import dask.dataframe as dd import dask_distance as ddst import numpy as np import scipy.spatial.distance as dst from sklearn.base import ( BaseEstimator, ClusterMixin, TransformerMixin, ) from sklearn.utils.validation import check_is_f...
19276fb33efee7353b7c77edb7870000ddee5973cfec6a8eafab2546a8ed7fd7
Python
13,832
339
import tensorflow as tf from src.factory import Factory from src.custom_layers.cs_layers import CompressedSensing, CompressedSensingInception from src.utility import get_root_path from astropy.convolution import Gaussian2DKernel import numpy as np import os import matplotlib.pyplot as plt from scipy import interpolate ...
68e0071bd1c34251de90b429cfbee345909cebd2ef472834780920762664aae4
Python
13,838
445
import sys import numpy as np from copy import deepcopy from ...misc.status import Status from ....utils.default_parameters import default_parameters class Parameters: """ rsHRF-Toolbox Parameters For more information, visit https://github.com/BIDS-Apps/rsHRF/tree/master/rsHRF """ def __init__(se...
28b16f9272e096570c92027ecd4b058c2cceb7d3f4ddf0e82294cfcffbea5c2c
Python
13,839
391
from __future__ import absolute_import import datetime import logging import os import socket from socket import error as SocketError, timeout as SocketTimeout import warnings from .packages import six from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection from .packages.six.moves.http_client imp...
429ffdb416027f03a0188475c5d3bb2916214de7f8acc2d44f9ba1dbd2b32692
Python
13,848
310
# 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...
f3a50ccafd69992f7434c249a24da0bb4aa2c119e47b6c47a944df93d48de701
Python
13,853
411
""" Unit tests for overall cell density computation """ from pathlib import Path import numpy as np import pandas as pd import pandas.testing as pdt import pytest from voxcell import RegionMap # type: ignore import atlas_densities.densities.measurement_to_density as tested from atlas_densities.exceptions import Atla...
0daa2c59e40ea66bddd7a4ad75fc9eb4c28af7eb26118ac4cec33406323d3997
Python
13,885
318
import math import os import tempfile import numpy as np import pandas as pd import pytest import test_utils import ark.settings as settings from ark.analysis import neighborhood_analysis def test_create_neighborhood_matrix(): # get positive expression and distance matrices all_data_pos, dist_mat_pos = test...
d95eca37c9592b61672cfdda15bf0e26b1d2c284c622306a8047ce088ec4d734
Python
13,886
347
#!/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 """ References .. [Papenmeier2025hd] L. Papenmeier, M. Poloczek, and L. Nardi. Understanding High...
8450534fa3f1a834d378b92cd7156accf19d9cad55c1e2ee088758ba46ea0aff
Python
13,905
288
# 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...
6264cf4f9faed13df6f0f89c410f46d712812a864093d68a8fda1ef4e305731e
Python
13,908
328
import math import numpy as np import torch from matplotlib import pyplot as plt from torch import nn import pytorch_lightning as pl # It's a convolutional neural network that takes in signals, passes it through a series of convolutional # layers, and then ends in a linear layer that represents the class scores clas...
5c0b8bcbc004090537c716e4299a7188bb97680fe85441bcd1a3a1c8f99b2653
Python
13,931
335
import os import json import concurrent.futures import torch import numpy as np from skopt import gp_minimize from skopt.utils import use_named_args from skopt.space import Real, Categorical, Integer from MolRep.Utils.utils import NumpyEncoder from MolRep.Utils.logger import Logger from MolRep.Utils.config_from_dict ...
550b9352f7b89352497edde8caa9643dcae955148c835ada86f4c382c801e1ae
Python
13,933
338
import abc import functools import logging import os from typing import ( Annotated, Any, cast, ClassVar, Optional, TypeVar, ) from fsspec import AbstractFileSystem from pydantic import Field from galaxy.exceptions import ( AuthenticationRequired, MessageException, ) from galaxy.files....
e113a631362264d7e5d8c8bb6ef861293d71e9e3bdd1aa8b4e856ceac925852a
Python
13,935
310
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Yang et al "Analyzing Learned Molecular Representations for Property Prediction" & "A Deep Learning Approach to Antibiotic Discovery" -> https://github.com/chemprop/chemprop """ from argparse impo...
a8627d0fffd417779606f994a5a149b2ce5fc2a5e18fc68972ec1ac932f291d3
Python
13,955
423
#THE CODE WAS SET UP FOR GOOGLE COLAB. THE INITIAL PORTION OF THE CODE HELPS COMFIRMING GPU USAGE """ #this is for testing purposes, for getting the most out of GPU import tensorflow as tf tf.test.gpu_device_name() # memory footprint support libraries/code !ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia...