sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e67ee78f76dd97f1d34f21767f37bcd4e900a1f6db2f5f1f0eb7efe2bb2e03fe
Python
5,857
146
import unittest import numpy as np from bsb import Configuration, ConfigurationError, Scaffold from bsb_test import NumpyTestCase, RandomStorageFixture class TestIoMolecular( RandomStorageFixture, NumpyTestCase, unittest.TestCase, engine_name="hdf5", ): def setUp(self): super().setUp() ...
a75cfefa19d4bf44cc7b0c860aed969d2ebcd7176a84ea11c1e91011a14b44ed
Python
5,859
178
""" Plot Figure 3 """ import numpy as np import strinf as si # # # PARAMETERS # # # ZOOM = 1.5 SAVE = True SHOW = True PANEL = ("C", "E", "F") # The sketches in A, B, D are always plotted. # data analysis obtained from '../ana/Yang_regress_and_choice.py' fnameData = "./data/data_yang2021_experiment_1/yang_predic...
5c82be5ebc7f6a8ba98904d597656ce7af916ee13412137c60a4e8419d4acbaf
Python
5,862
145
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Obtain a TSNE projection of the reduced matrix """ import cellranger.analysis.pca as cr_pca import cellranger.analysis.plsa as cr_plsa import cellranger.analysis.lsa as cr_lsa import cellranger.analysis.bhtsne as cr_tsne import cellranger.analysis.io as a...
5d90af5e0c015a339ad65742e54a0ca53d29718c122fa8c61214b779ddc4fbdf
Python
5,864
145
import os import pytest import tempfile import numpy as np import pandas as pd import skimage.io as io from ark import settings from test_utils import make_cell_table from alpineer import image_utils, test_utils, misc_utils from ark.phenotyping import post_cluster_utils def test_plot_hist_thresholds(): pops = n...
8af1546ba0112e2a1a4ff3bc581ad0f5a954bcd67619b0832ecc559eda5be20a
Python
5,866
143
#!/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 torch from ax.generators.random.base import RandomGenerator from ax.utils.co...
729b9bbfe2dc2e1f622d4f708235503e06287822d6ce466c0943e1529a893dd0
Python
5,868
159
""" Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Zheng, Shuangjia, et al. "Identifying structure–property relationships through SMILES syntax analysis with self-attention mechanism." Journal of chemical information and modeling 59.2 (2019): 914-923. """ import os, re...
9590a164e403b5bb31e5867b2acc175a7cde392b5b00e387ab6facfe1669b543
Python
5,869
180
""" Data providers that iterate over a source that is not in memory or not in a file. """ import gzip import logging import subprocess import tempfile from urllib.parse import ( urlencode, urlparse, ) from urllib.request import urlopen from galaxy.util import DEFAULT_SOCKET_TIMEOUT from . import ( base, ...
0a26140d883465d48b355fa044633f7d8e87933208ec456bd4bffd2762ee3270
Python
5,870
164
import json from pathlib import Path from unittest.mock import patch import nibabel as nib import numpy as np import pandas as pd import pytest from neurolang.frontend import NeurolangPDL from neurolang_apps.utils import engine_registry from neurolang_apps.utils.engines.neurostore import init as neurostore_init NS_I...
7bda4618e949030ff6fb0766196c7e26dd243ce8b518a3f9e148d9c200815740
Python
5,870
153
import MDAnalysis as mda import tqdm import argparse import jax import jax.numpy as jnp import pdb import rlcompleter pdb.Pdb.complete=rlcompleter.Completer(locals()).complete import pandas as pd import numpy as np import matplotlib.pyplot as plt parser = argparse.ArgumentParser() parser.add_argument ('--topology',...
f6f5a8845c1627b763b067ec9020f95274058b4e6aa31eb4b381ef9faa3713c3
Python
5,873
134
# 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...
77c86cbfb96fff957e5f524e0dccc1801b68663194c8dfd38a8ee08e79d3ebbc
Python
5,874
161
# 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.plotly.surface.slice import compute_slice_adhoc, SlicePlot from ax.core.trial import Trial from ax.exception...
34e363a172a9f3b84b3aef6b22ce05b5e2a49f528189b0edd9a7dea2d3573d42
Python
5,877
131
import pandas as pd from sklearn.feature_extraction import FeatureHasher import math def init_directories(postprocess_folder): if postprocess_folder == "all_products": directory_g1 = r'../postprocess_all_products/g1' directory_g2 = r'../postprocess_all_products/g2' directory_g3 = r'../postp...
af5179a95103667ccf9f9c89ef5469f99ee9ab7dc2cc915f6660e15417a447d6
Python
5,879
149
import pytest import networkx as nx def validate_grid_path(r, c, s, t, p): assert isinstance(p, list) assert p[0] == s assert p[-1] == t s = ((s - 1) // c, (s - 1) % c) t = ((t - 1) // c, (t - 1) % c) assert len(p) == abs(t[0] - s[0]) + abs(t[1] - s[1]) + 1 p = [((u - 1) // c, (u - 1) % c...
54fc280e6a2c0abde322af7700a295d4132b789b666c256d29fa28f5b8b7f210
Python
5,880
148
""" Created on Jun 3, 2025. @author: voodoocode """ import threadpoolctl import os import numpy as np import matplotlib.pyplot as plt import finnpy.file_io.data_manager as dm # @UnresolvedImport import finnpy.src_rec.sen_cov # @UnresolvedImport import finnpy.src_rec.coreg # @UnresolvedImport import finnpy.src...
114ee662572a3845a2b645797d5590531d5f435279b839a3efc0b4223880b7de
Python
5,881
155
import inspect import logging import os import sys import threading import time from multiprocessing.util import register_after_fork from typing import ( Any, Union, ) from sqlalchemy import ( create_engine, event, exc, ) from sqlalchemy.engine import Engine from sqlalchemy.pool import NullPool lo...
978f50a53d950a9dc0391ef5d48db8362edde403a536863338599817d3c909e4
Python
5,882
149
# -*- coding: utf-8 -*- """ Template to run the processing pipeline """ import os,numpy, sys #pre-execute to make sure that Clearmap modules can be loaded basedir = os.path.abspath(os.path.join(os.path.dirname(__file__),'../../..')) sys.path.insert(0, basedir) import ClearMap #load the parameters: parameter_filename...
32ce14ef8ec79582a58b3277c8169e907c1a328575a062c6d00695fb2b10a087
Python
5,883
154
#!/usr/bin/env python3 """Kernel launch-parameter tuning harness for tsne-cuda. The FFT-interpolation kernels expose their block sizes through GpuOptions, and those can be overridden at runtime via environment variables (see src/include/options.h): TSNE_FFT_THREADS nbodyfft interpolation/copy kernels (defau...
b5246cf5347bb3fe0cecc0ff6c5ef728060df306f4335df5e0861b0f3a07502c
Python
5,883
189
""" Contains all the mathematical helper functions used throughout the scaffold. Differs from helpers.py only categorically. Helpers.py contains functions, classes and general logic that supports the scaffold, while functions.py contains a collection of mathematical functions. """ import bisect import ...
c46757360f0bd57c464a42ff06ad4bfe2e8f417c96bd5fe45c9e53da7e85636c
Python
5,884
160
#!/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 unittest.mock import MagicMock from ax.exceptions.core impor...
2b3f216fe0433f40a2c7f69d9ad5c9422ef683dae389f4229f6c0b43f9087fa6
Python
5,885
166
""" ######################################################################################################### Author: Álvaro Fernández García Date: 21 - Marzo - 2019 Description: Este script permite utilizar el clasificador GlandsDetector para obtener una ayuda en el etiquetado de los datos. Permite clasificar una ima...
2eeee731d62ed49555e7c7c4de1bfe77f6af4f2e61d323bd2ec23302df360a59
Python
5,885
202
"""Check a project and backend by attempting to build using PEP 517 hooks. """ import argparse import logging import os from os.path import isfile, join as pjoin from pip._vendor.pytoml import TomlError, load as toml_load import shutil from subprocess import CalledProcessError import sys import tarfile from tempfile im...
5a12fd78a1468b5f2fa2af3620a960abc2b317b7f5188f84a218a2bb9d721ef6
Python
5,885
211
"""test markers_combinator""" import json from pathlib import Path import numpy as np import numpy.testing as npt from click.testing import CliRunner from voxcell import VoxelData # type: ignore import atlas_densities.app.combination as tested TEST_PATH = Path(__file__).parent.parent def test_combine_markers(tmp_...
acd832e53dc736334785988eee4c7f532268cc2e29b06cfd352119ab1b66181a
Python
5,885
184
import os.path as osp from itertools import product import numpy as np import scipy.io import torch import time from cogdl.data import Graph, Dataset from cogdl.utils import download_url class MatlabMatrix(Dataset): r"""networks from the http://leitang.net/code/social-dimension/data/ or http://snap.stanford.edu...
558b871494d9b4e02b8b11dffb9c5e1fd2654830016528e345a909ad805c4564
Python
5,890
165
"""Structure-from-motion (SfM). Control experiment with additional motion components (= SI Figure)""" import numpy as np from datetime import datetime from strinf import ObservationGeneratorVelo, WorldVeloFunction,\ FilterStrinfNaturalParameters, FilterStrinfAdiabaticDiagonalSigma,\ ...
81ada82d51502b12276d4032dc4a6e6b56b8bf39b4b0c287fc0c1241af238a5a
Python
5,891
165
# rmf 12.29.2020, last modified 5.13.2021 import sys, re # INPUT: DAVID cluster motif summary file from hypergeometric testing # OUTPUT: file with same information, filtered; additional columns for expression in young and old, and enrichment score # FUNCTION: filters DAVID clusters by enrichment score and TFs by FPKM...
22c8c302d62d51301564708979e2c84e04782c8a0350ae64c9024997d7262260
Python
5,896
216
import numpy as np from numcodecs import (BZ2, AsType, Blosc, Categorize, Delta, FixedScaleOffset, PackBits, Quantize, Zlib) from numpy.testing import assert_array_almost_equal, assert_array_equal from zarr.creation import array compressors = [ None, Zlib(), BZ2(), Blosc(), ] t...
44ee7ad891042b907bab0632d66af79cda2a964b5d49549a20787fb574ecc66e
Python
5,898
135
from cogdl.utils import dropout_adj import os.path as osp import os import argparse import numpy as np import torch """ The Following code is borrowed from SelfGNN """ class Augmentation: def __init__(self, p_f1=0.2, p_f2=0.1, p_e1=0.2, p_e2=0.3): """ two simple graph augmentation functions ...
cbe2950f2296c4f84383c32f03e044b6b4ff56e625f7c70befc1ec2ae635ac62
Python
5,898
152
# 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...
f4d77d09f8829f6f74f0181167e71088c423a4e143bb805fb68775762756c821
Python
5,898
220
import pytest import networkx as nx np = pytest.importorskip("numpy") sp = pytest.importorskip("scipy") def test_laplacian_centrality_null_graph(): G = nx.Graph() with pytest.raises(nx.NetworkXPointlessConcept): d = nx.laplacian_centrality(G, normalized=False) def test_laplacian_centrality_single_...
f14c8e7ff0bf5d910d0f0b32052b0d661f25f6a155c7387eefd4be8a73235862
Python
5,899
163
import os.path as osp import numpy as np import scipy.io as sio import torch from cogdl.data import Graph, Dataset from cogdl.utils import download_url, untar def sample_mask(idx, length): """Create mask.""" mask = np.zeros(length) mask[idx] = 1 return np.array(mask, dtype=np.bool) class HANDataset...
3e96bd1bd3db6c72625d7a2718f76b3fc31420a19ac916b300c5cfc985d2ec8e
Python
5,903
220
from nl_expr.expressions import Symbol, Constant from nl_expr.logic import ( Implication, Conjunction, ExistentialPredicate, UniversalPredicate, ) from ..drs_builder import DRSBuilder, DRS2FOL from ..chart_parser import ChartParser from ..english_grammar import EnglishGrammar, EnglishBaseLexicon import ...
50ba9ee0e773c708964a8e4cb6c0f1cfd42c173df66956b9a576bb7f4c90685f
Python
5,905
166
import pytest import numpy as np from brian2 import ms, mV, defaultclock, prefs, set_device, device, seed, \ Network, NeuronGroup, StateMonitor, SpikeGeneratorGroup, Synapses # Set working directory path such that packages and tempates can be found # NOTE that it only works if you start the script f...
a97cf7c330339453b88ce273e256791dda4662a827582119575e29c318be2e8e
Python
5,907
184
from __future__ import print_function, unicode_literals, absolute_import, division from lzma import PRESET_EXTREME import numpy as np import warnings from skimage.measure import regionprops from skimage.draw import polygon from csbdeep.utils import _raise from ..utils import path_absolute, _is_power_of_2, _normalize_...
aec276440eab3f3f2163aee4d4ec28127aefd4b28c2b10d372cbaf5bac7a3df4
Python
5,908
131
import os import pandas as pd from sklearn.model_selection import train_test_split from sklearn.feature_extraction import FeatureHasher import math import torch def load_data_from_folder(directory_ldff, filename): dataset_train = pd.read_csv(directory_ldff + '/' + filename + '/' + 'train.csv') panier_9999999...
6ea7a822abe921e543ae179247d8093f38ff0471ed7111a15372652fa63e5f69
Python
5,910
122
#!/usr/bin/env python ####################################################################### ####################################################################### ## Created on July 4th 2018 to create IGV session file from file list ####################################################################### ###########...
18f0bffdccba0accb55e05b758cc67a2851cdb69b7e9a9471457982557778958
Python
5,911
174
""" Adjacency matrix and incidence matrix of graphs. """ import networkx as nx __all__ = ["incidence_matrix", "adjacency_matrix"] @nx._dispatchable(edge_attrs="weight") def incidence_matrix( G, nodelist=None, edgelist=None, oriented=False, weight=None, *, dtype=None ): """Returns incidence matrix of G. ...
f5d667faaec5e4ac9029424c89edae2b0babd851b408b5f3fe42d9ce424e8597
Python
5,912
163
from contextlib import contextmanager import os from os.path import dirname, abspath, join as pjoin import shutil from subprocess import check_call import sys from tempfile import mkdtemp from . import compat _in_proc_script = pjoin(dirname(abspath(__file__)), '_in_process.py') @contextmanager def tempdir(): td...
443a6b8275493998c8a6ff8b1abfb2bafc74fb45f6ab8c784553fa7eb0664415
Python
5,914
144
# 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 License, Version 2.0 (the # "License"...
c7be939e1032322d1b6bc22af65bdec8c1661d80d3b2601fcbc5713ba4baf842
Python
5,915
145
#!/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 typing import TYPE_CHECKING from ax.adapter.data_utils impor...
695de9fe531e5f8c3be4365529715dc17694802e5512faa4624fa37221b62787
Python
5,919
77
import tensorflow as tf import numpy as np import keras import keras.backend as K from keras.layers import BatchNormalization, Conv3D, Add, ZeroPadding3D, Lambda, concatenate def ACBlock(input_tensor, name=None, filters=None, ksize=None, strides=(1, 1), momentum=0.99, epsilon=0.001, moving_mean_initializer='zeros'...
1703aac9b9a80b0894fad55abb58de1781a0f7efd1290e23aa80a6bd61528b74
Python
5,920
163
import torch import torch.nn as nn import torch.nn.functional as F from graphmae.utils import create_activation, NormLayer, create_norm from cogdl.layers import GINLayer class GIN(nn.Module): def __init__(self, in_dim, num_hidden, out_dim, num_l...
07ff5dbe8a6a20ad9677193f974375e50d3330d1d2925bbbee1b0b740417a9a0
Python
5,921
176
import pandas as pd import os import sys from loguru import logger from brainrender.atlas_specific.allen_brain_atlas.gene_expression.ge_utils import ( check_gene_cached, load_cached_gene, download_and_cache, ) from brainrender import base_dir from brainrender._io import request, fail_on_no_connection fro...
08e86a481e1cfa05cb685189f4a4d89470f7ee6ae9623f8ba96e3af06fa8f3c5
Python
5,921
170
from typing import ( Optional, ) from pydantic import ( BaseModel, Field, HttpUrl, RootModel, ) __all__ = [ "CompositeFileInfo", "DatatypeDetails", "DatatypesMap", "DatatypesCombinedMap", "DatatypeConverter", "DatatypeConverterList", "DatatypeEDAMDetails", "Datatype...
bcded9a33777922bf21051235aa94d5cd957e9def4f43dfaf0e8fd4e44f2bbeb
Python
5,922
207
import typing import numpy as np from .. import config from .._util import merge_dicts from ..cell_types import CellType from ..connectivity import ConnectionStrategy from ..placement import PlacementStrategy from ..postprocessing import AfterConnectivityHook, AfterPlacementHook from ..rng import RngRootNode from ..s...
b2e8e0f386dee96c6ca00fdc3e77f562a7848e67badf8de944a67682ef0adaf1
Python
5,924
168
import numpy as np import pytest from spikingjelly.datasets import shd, utils @pytest.mark.parametrize( ("timestamps", "frames_num", "left", "right"), [ ([0, 9], 3, [0, 1, 1], [1, 1, 2]), ([4, 4], 3, [0, 0, 0], [0, 0, 2]), ([0, 1, 2], 5, [0, 0, 0, 0, 0], [0, 0, 0, 0, 3]), ([5]...
f99de928407ac5a392f6925fe8865ed2fff73a44aed11d0b6a3628f862acdcfb
Python
5,929
154
import os.path import pyfasta import re from tenkit.regions import Regions from collections import defaultdict import gzip # 10X generated references that should # have genes, regions, and snps files KNOWN_GENOMES = ['10X_hg19_ucsc', '10X_b37', '10X_GRCh38_no_alt_decoy'] def open_reference(reference_path): ''' Op...
5d502680df1ff4694e2440dcf9507d5e7a65de6b99fee346c1ce24b358d91da4
Python
5,931
121
""" Determine if installed tool shed repositories have updates available in their respective tool sheds. """ import logging import threading from typing import NamedTuple from sqlalchemy import false from galaxy import util from galaxy.model.tool_shed_install import ToolShedRepository from galaxy.tool_shed.util.repo...
b71a86e278b039ea77a2943b3ead804bb222ad28e437c379a1c22dd02e30140e
Python
5,932
164
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F def auc_pair_loss(x, y, z): x = F.normalize(x, p=2, dim=-1) y = F.normalize(y, p=2, dim=-1) z = F.normalize(z, p=2, dim=-1) sim = (x * y).sum(dim=-1) dissim = (x * z).sum(dim=-1) loss = (1 - sim ...
7585e3be86b9af1ed47f77dade195dd0b54a6a32ed0dfa2234c4505d52adc428
Python
5,933
186
#!/usr/bin/python3 import matplotlib.pyplot as plt import numpy as np import sys import getopt from plotly.subplots import make_subplots import plotly.graph_objects as go from scipy import signal p300folder = "p300" class SimData: def loadFile(self,filename): return np.loadtxt("../{}/subject{}/{}".format(...
27d3e7ce8e651fe01e0c96494806d49d80930ef3819ce7bb6f7e0b853906c229
Python
5,935
139
import pytest import tensorflow as tf from packaging.version import parse as version from tf_keras_vis import keras from tf_keras_vis.saliency import Saliency from tf_keras_vis.utils.scores import BinaryScore, CategoricalScore from tf_keras_vis.utils.test import (dummy_sample, mock_conv_model, ...
aab10423b1e0be20dd6a458159e46b1ebb2f9c94427e27b3d4a4382eeca8132e
Python
5,935
124
import numpy as np from scipy.signal import savgol_filter from fanc.tools.matrix import delta_window import logging logger = logging.getLogger(__name__) def find_zero_crossing(x, sub_bin_precision=False): diff = np.diff(np.signbit(x)) # make sure diff is not caused by nan diff = np.logical_and(diff, ~np.l...
f4047c04184c5695e0d777e3479497d2d4e7086f1210ded19536fc20e328399d
Python
5,935
213
# -*- coding: utf-8 -*- """ Parameter ========= Provides GUI widget to parameter dictionaries used in *ClearMap* processing routines. The module effectively implements and interface between hierarchical dictionaries and the parameter trees of pyqtgraph. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail....
16d2d6073644ceb08811485251d2b8cae00098ac4700867c140916c4d881cf72
Python
5,937
141
# 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...
a4df41e8023885e000564ece0535a7380f2dcb858be28a0504f0e2018ecd7151
Python
5,937
169
from typing import ( Optional, TYPE_CHECKING, ) from galaxy.navigation.components import ( Component, Target, ) from .axe_results import ( AxeResults, Impact, ) if TYPE_CHECKING: from galaxy.selenium.has_driver_protocol import HasDriverProtocol class SmartComponent: """Wrap a Compone...
fa8ccd265dee028d7cce09ff8d824512b85f791ea7bf249f0dd5f2e78a45e326
Python
5,937
150
"""Compute markers. ================================================== Compute markers used for publication ================================================== Here we compute the markers used for the diagnosis of DOC patients [1] for an EGI recording from a control subject. References ---------- [1] Engemann D.A.`*,...
0ed8ecb7b2772777ec1f230e671c6d3da494e3ae7fd30211f1d7c8c79079d450
Python
5,938
135
# 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...
3fa60c59193a886aa80b53e998baf987c68b870447f9a2991360ddf29745d4f1
Python
5,940
186
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ MEFISTO wrapper functions Created on Mon Jul 19 18:25:31 2021 @author: townesf """ #import json import numpy as np from os import path from time import time,process_time #from mofax import mofa_model from mofapy2.run.entry_point import entry_point from utils import ...
12d2563892c86b233663d0f99490b3fb644d2aeb6beba0182123359f11447e51
Python
5,941
265
from operator import eq import pytest from nl_expr import exceptions from nl_expr import expression_walker as ew from nl_expr import expressions from nl_expr import logic from .. import Fact, Implication from .. import negation as sdn from ..expressions import TranslateToLogic from ..chase import Chase as Chase_ from...
560e241f9f6a2471ef745f3b585b66df464150d628cb88fd38422c64cae7acac
Python
5,942
100
# -*- coding: utf-8 -*- """ @title: Bruker_batch_convert.py @description: script that converts each Bruker '.d' file in a directory into an '.hdf5' file containing data series and measurement metadata @author: chrisarcadia @created: 2018/10/29 """ import Bruker import timeit import os, sys # Provide a sour...
0ff4c4fd22b5e586ad75b8560cc374384dd7e940899f545390034834260ea1b1
Python
5,943
178
from __future__ import absolute_import import email.utils import mimetypes from .packages import six def guess_content_type(filename, default='application/octet-stream'): """ Guess the "Content-Type" of a file. :param filename: The filename to guess the "Content-Type" of using :mod:`mimetypes`. ...
16f1830f5881153c0d0e189537963e98522238f6175740581a30a997c1befcba
Python
5,944
163
""" Manager and Serializer for Roles. """ import logging from sqlalchemy import select from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy import model from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ObjectNotFound, RequestP...
57d2f9f29b64b45fa92e2660d01bd43265f51bd9eea194bb2da2d7dc0d1cebb2
Python
5,945
183
import joblib import numpy as np import pandas as pd from anndata import AnnData from scipy.sparse import issparse from sklearn.decomposition import TruncatedSVD from sklearn.utils.validation import check_is_fitted def tf_idf(data, scale_factor=100000, idf=None): sparse_input = issparse(data) if idf is None:...
90811ca6539513dd576c6066d2e065b9dfd34d2ab44612a528fa8e6a8f356bc3
Python
5,949
179
import sys import argparse import os from packaging import version if "kivy_overrides" not in sys.modules.keys() and \ any([name.startswith("kivy") for name in sys.modules.keys() if name != "kivy_overrides"]): raise ImportError("smile must be imported before kivy") # Prevent kivy from reading command l...
d761c8692036631ce21717e25dddfdd26f6e4cf7115c9706252831669ad9e313
Python
5,949
164
import pdb import conf import numpy as np import torch import torch.nn as nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from transformers.file_utils import ModelOutput from transformers.models.wav2vec2.modeling_wav2vec2 import ( Wav2Vec2PreTrainedModel, Wav2Vec2Model) from d...
0c9ddf0795c5b16b013e55605264b3a4e0a1ca2d0d0d2c03688237a02cb2d735
Python
5,950
171
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 plt.rc('xtick',labelsize=12) plt.rc('ytick',labelsize=12) Dzs_all = [] Dpar_all = [] Dzs_stdv_all = [] Dpar_stdv_all =...
8031bab6c80fdeec7b0e0bb4c7baf49eca3bff292723189c578d86ab422de697
Python
5,952
199
import pytest import networkx as nx from networkx.algorithms import approximation as approx def test_global_node_connectivity(): # Figure 1 chapter on Connectivity G = nx.Graph() G.add_edges_from( [ (1, 2), (1, 3), (1, 4), (1, 5), (2, 3)...
f026cdb8f208c5d3b56d033a2ebc74414ab52638968f9d9e270474d830193015
Python
5,955
155
import sys, os, platform from src.pnc import Environment from src.imaging_derivs import DataVector from src.plotting import roi_to_vtx from src.utils import get_states_from_brain_map import numpy as np # %% plotting import seaborn as sns import matplotlib.pyplot as plt from nilearn import plotting from src.plotting im...
c045a16e52ddcb589e0d49c39d6229697a0eab3129bd77ff68d9f92e406fd3bf
Python
5,956
140
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Cluster the cells using the reduced matrices from dimensionality reduction """ import numpy as np import os import cellranger.analysis.clustering as cr_clustering import cellranger.analysis.kmeans as cr_kmeans import cellranger.analysis.pca as cr_pca imp...
86bf7547e2091a26e51f3ac173e9a9e31e05e3c0447a343db11b04b43d70d2e3
Python
5,957
190
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)' __copyright__ = 'Copyright © 2020 by Christoph Kirst' __webpage__ = 'http://idisco.info' __download__ = 'http://www.github.com/ChristophKirst/ClearMap2' #optiimze image itme for spee...
9e551534130615b8d3d6b5969363b4032c18fc38bc5afdaa97d882e1151df30a
Python
5,957
173
import matplotlib.pyplot as plt from scipy.optimize import curve_fit from pylab import * import numpy as np import random import math import time import os import glob import copy def theory(d,A): return A*d**(-2./3.) def fitexp(d,A,b): return A*d**(-b) ds_main = [1,1.25,1.5,2,2.5,3,3.5,4,4...
534edbe16b2daccea3c3c73f6eda4a283b38047358bf0c2461ba200db71ad92b
Python
5,958
174
############################################################################## Setup """ ND Bayesian Optimization Test: (0) Gaussian process model. (1) Gemerate ND objective using BO_express autobuilding features. (2) Test building arguements (3) Test predictions, variance estimation, and sampling. (4) Run single itera...
5fc94805e9ce492d766450f1a9444d94d1ee38b1bafaffe401688af3139583ab
Python
5,960
149
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Reduce the dimensions of the peak matrix """ import cellranger.analysis.pca as cr_pca import cellranger.analysis.lsa as cr_lsa import cellranger.analysis.plsa as cr_plsa import cellranger.h5_constants as h5_constants import cellranger.analysis.constants a...
d1f6c7c1a907781a26b3f1e6b0827b692e4faea98033a2e41562ab558615d1cf
Python
5,962
141
import numpy as np from ark.utils.metacluster_remap_gui.metaclusterdata import MetaClusterData def test_can_get_mapping(simple_metaclusterdata: MetaClusterData, simple_metaclusterdata_rename: MetaClusterData): np.testing.assert_array_equal( simple_metaclusterdata.mapping['metaclu...
55a1dab6ac0eb9a798b2ebbf50068cc4ad0f83f3331a94ad355250805dd98c06
Python
5,963
215
from copy import deepcopy, copy import re # An expression tree node class Et: # Constructor to create a node def __init__(self, value): self.value = value self.left = None self.right = None # Returns root of constructed tree for given postfix expression def construct_exp_tree(postfix...
d087a7e1edd01dd9a70104cc831afad5b31ec7a7e83e79a8fdee608e2696972b
Python
5,968
170
import pytest import networkx as nx @pytest.mark.parametrize("n", range(1, 6)) def test_chordal_graph_clique_ignores_selfloops(n): """The one and only chordal graph clique of a complete graph K_n is the set of n nodes. Ensure this is the case even when self-loops are present.""" G = nx.complete_graph(n) ...
f0af112b3f038dcadc8f7506d53de62c8270f90b18b6f3fb58cc039937509f3b
Python
5,968
140
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. """ from __future__ import division import os import h5py as h5 import martian import tables from scipy.sparse import vstack import pandas as pd import numpy as np import cellranger.h5_constants as h5_constants import cellranger.io as cr_io import cellra...
2876afe697006d1e860efb0326662ae9de21c8334cce9aa627360e53db6d970b
Python
5,969
195
import os.path as osp from collections import defaultdict import numpy as np import scipy.sparse as sp import torch from cogdl.data import Dataset, Graph from cogdl.utils import download_url, untar def read_cf_amazon(file_name): return np.loadtxt(file_name, dtype=np.int32) # [u_id, i_id] def read_cf_yelp2018...
97cb21c601da61af723f3c52f6a69868a810ea54ed96ba54bd3eebf7689e6e16
Python
5,972
159
import contextlib import unittest from unittest import mock import numpy as np import requests from bsb_test import ( FixedPosConfigFixture, NumpyTestCase, RandomStorageFixture, skipIfOffline, ) from scipy.spatial.transform import Rotation from bsb import FileDependency, NeuroMorphoScheme, Scaffold, U...
ff3dd5afedca1640a001a2bd87aecb7c3969aa7604adf70fad66a5de8e93c17b
Python
5,972
198
import contextlib import importlib.metadata import json import os import shutil import warnings from datetime import datetime from pathlib import Path import shortuuid from ... import config from ...exceptions import BsbProvenanceUpgradeWarning from ...services import MPILock from ..decorators import on_main_until fr...
6a0210ccf556957b570e2560e825af0f3ac4178655c6105ca27695ec893bd313
Python
5,974
157
import io import pickle import sys import time from tqdm import tqdm from src.gsfsf import * from src.pre_data import * from src.train_and_evaluate import * from src.warmupLR import * import warnings warnings.filterwarnings("ignore") USE_CUDA = torch.cuda.is_available() size_split = 0.8 PAD_token =...
be74a96a45cc537945885c725f7b2d5b34f2bb63a75861bc280dab74e95cac16
Python
5,974
164
from __future__ import absolute_import import datetime import json import logging import os.path import sys from pip._vendor import lockfile, pkg_resources from pip._vendor.packaging import version as packaging_version from pip._internal.index import PackageFinder from pip._internal.utils.compat import WINDOWS from ...
f7678f5bdaf845a6086fb4a910dd2e0ed135316e39d65d488922aeedf5c6c7f1
Python
5,975
177
""" Compare numpy vs GPU backend on a real video stimulus. Downloads a short demo video, extracts motion energy features using both numpy and a GPU backend (torch_mps or torch_cuda), and saves the results. Usage:: python benchmarks/compare_numpy_vs_gpu.py python benchmarks/compare_numpy_vs_gpu.py --backend t...
a8b65fa884096850e2c5027a2c5961385205b21b2bb93c67efaf3413bcebb122
Python
5,977
157
#!/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 collections.abc import Callable from typing import Any import numpy as np import numpy.typing as...
c8bd26ab9c03efe4e8306cbcf032f8dc6f54fcd7bde0440836ff50a4b55751d0
Python
5,977
152
"""Asynchronous Fluid Communities algorithm for community detection.""" from collections import Counter import networkx as nx from networkx.algorithms.components import is_connected from networkx.utils import groups, not_implemented_for, py_random_state __all__ = ["asyn_fluidc"] @not_implemented_for("directed") @n...
dcaa8fef4968a23824f0b0bd295cdfd37f0397672c49b1ff53d7bfbe4060a555
Python
5,977
163
import time import networkx as nx import numpy as np import scipy.sparse as sp from sklearn import preprocessing import torch import torch.nn as nn import torch.nn.functional as F from tqdm import tqdm from .. import BaseModel class DNGR_layer(nn.Module): def __init__(self, num_node, hidden_size1, hidden_size2)...
b1a2c66f73c6b955c15ae4ce60925ddad74e31e6091ecb10f7cd01135b12a4ff
Python
5,978
238
import dataclasses import itertools import typing from ._util import MechId from .definitions import ( CableProperties, CableType, Definition, Ion, Mechanism, Synapse, _parse_dict_def, ) class Constraint: def __init__(self): self._upper = None self._lower = None ...
b245ac61f75e55f50f3c6e805505c9b68aa8dd16a9d6dcfed125d4af5892d37b
Python
5,978
168
#!/usr/bin/env fbpython # 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 functools import time from collections.abc import Callable, Sequence from logging import WARN...
722166c6f190d4b2011dff449834b5b0960df054c9c82f550ab7511e357b5c72
Python
5,982
121
from __future__ import annotations import dask.array as da import numpy as np import pytest import xarray as xr from squidpy._params import resolve_params from squidpy.experimental.im._stain._constants import RUIFROK_HE from squidpy.experimental.im._stain._conversion import sda_to_rgb from squidpy.experimental.im._st...
89090115c28ee46316fc234d49d3f37c44dc48d852e6648a9f7ed74de42878ff
Python
5,985
164
import copy import random import numpy as np import torch from .. import ModelWrapper class GCNMixModelWrapper(ModelWrapper): """ GCNMixModelWrapper calls `forward_aux` in model `forward_aux` is similar to `forward` but ignores `spmm` operation. """ @staticmethod def add_args(parser): ...
26f23225b9ac06654419f5644c451526a70b5c77001709d281be76c17e2a13b0
Python
5,987
177
import logging import numpy as np from scipy.spatial import distance as dist from sklearn.base import BaseEstimator from sklearn.manifold import SpectralEmbedding from sklearn.utils.validation import check_is_fitted from divik.core import configurable from divik.core.io import save_csv @configurable class LocallyAd...
57f604ba9ae0d9657b5453673c3dc34fba8ad50b68c90d49a7ed0e7f958328ab
Python
5,987
127
import numpy as np import sys import matplotlib.pyplot as plt def read_dist_xvg(fname): dat = [[], []] with open(fname) as fhandle: for line in fhandle: if not (line.startswith('#') or line.startswith('@')): recs = line.strip().split() dat[0].append(float(rec...
8daaa91930e603255279b015e8f3b6a3a312f1a4ced04094e81e3bdfdd201cb9
Python
5,987
165
""" Serve the REPL in the browser on this machine. The page (``doc/_static/repl``) is static: Python runs in the browser, on Pyodide. This script puts it, with the logo, in SITE, builds its bundle there with ``make_repl_bundle.py`` (NeuroLang's wheels and the engine's data; once, or again with ``--rebuild``, or from n...
92477625f575d23d164fd2db96f2e254b6a527df4a0dc209a862440844049a8e
Python
5,987
122
# -*- coding: utf-8 -*- from figureflow import figure import seaborn as sb from matplotlib import pyplot as plt import importlib import numpy as np importlib.reload(figure) import os Figure = figure.Figure # get the path to the data of the respective figure or movie # the data is in the data folder in a folder with ...
df383ac6f192204a3707709a841603de1ff31e8ed159ab8fdb1a9c00d4c1e938
Python
5,987
177
"""**Depricated**. Will be removed in a future version.""" import os.path import numpy as np import pickle import warnings def save(data, path = "", var_name = "data", max_depth = 2, ending = None): """ **Depricated**. Will be removed in a future version. Saves data using the legacy data manager. Allows for ...
39f7a5158ccf9f11a55376a6133f6e04b8c204eae2c20261e100bf696f521775
Python
5,991
150
from __future__ import absolute_import from .filepost import encode_multipart_formdata from .packages.six.moves.urllib.parse import urlencode __all__ = ['RequestMethods'] class RequestMethods(object): """ Convenience mixin for classes who implement a :meth:`urlopen` method, such as :class:`~urllib3.con...
bf178da3af49335951f68d0c5b75e8bf5a76d1f381288a0b51539708b41a107d
Python
5,992
155
"""Tests alternate OBOReader.""" import sys import timeit import datetime # Test local version of goatools sys.path.insert(0, '..') from goatools.obo_parser import GODag ################################################################# # Sub-routines to tests #########################################################...
e7605b30c45ac4acb5a99341a7cee5019a3d797b063e5d7f4e1d31c66d9f1730
Python
5,992
171
""" Copyright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import os import numpy as np from tqdm import trange import matplotlib.pyplot as plt from pathlib import Path import torch from cellpose import models, metrics, io, transforms, denoise # uses tensorflow # pip i...
bc37665ba634f69bd32d5b4fc74077cdedeefb9f61d66a6959accd2b796b0d1c
Python
5,993
162
from sqlalchemy import ( false, select, ) from galaxy import model from galaxy.exceptions import ( Conflict, ObjectAttributeMissingException, ObjectNotFound, RequestParameterInvalidException, ) from galaxy.managers.context import ProvidesAppContext from galaxy.model import Group from galaxy.mod...
e1beebd2c197f494c8b499289ff865d8c8490787f4dbb186c9435ac897a28c63
Python
5,993
145
from __future__ import print_function import argparse import numpy as np import torch import torch.optim as optim import torch.utils.data as data_utils from torch.autograd import Variable from dataloader import MnistBags from model import Attention, GatedAttention # Training settings parser = argparse.ArgumentParse...
d9e0ca85937c20f8490757b1b94d15a355a5eac9e321d67eb4aecdd12993a0df
Python
5,994
151
"""Command-line interface for the Voluseg pipeline. Installed as the ``voluseg`` console script; ``app/app.py`` keeps the container entry point (``python3 /voluseg/app/app.py``) working. """ import json from typing import Annotated, Optional import typer app = typer.Typer(add_completion=False) def _version_callba...