sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a77903bc894765b3d5dd975b08c3745d5ea71cd55e8fe76d3f2d85adaa27a0f5
Python
12,789
389
from __future__ import annotations from collections.abc import Mapping from typing import TYPE_CHECKING import awkward as ak import h5py import numpy as np import pandas as pd import pytest from scipy import sparse from zarr.storage import MemoryStore import anndata as ad from anndata import AnnData, concat from ann...
950b5eebafa1b39e3dfd72708ec12d92f9c443734b61803f4736c6ffab178197
Python
12,810
362
#!/usr/bin/env python3 import os import numpy as np # -custom-written code import main from utils import checkattr from params.param_stamp import get_param_stamp_from_args from params.param_values import check_for_errors,set_default_values from params import options from visual import visual_plt ## Function for speci...
b2f85026366699c6a13b0567bba27cd3a76ca3449fdc7457bba29c80e607acca
Python
12,810
397
import functools import os import types from datetime import date from sphinx_gallery.sorting import ExplicitOrder, FileNameSortKey from intersphinx_registry import get_intersphinx_mapping from warnings import filterwarnings filterwarnings( "ignore", message="Matplotlib is currently using agg", category=UserWarnin...
6684d49586eadf32f87d894cd0bb20c5dc0fa98345d4fe8b302e2dda07cd8196
Python
12,815
354
#!/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 scipy from ax.core.data impo...
72366abdef8c4287c1a635f966a38c33c0ba58c7be03bf187cf3a931677f8292
Python
12,828
337
import sys import os import os.path import platform import shutil from optparse import OptionParser # ------------------------------------------------------------------------------- # the main function # # This python script applies uncrustify (Code Beautifier) to the elastix code. # # Uncrustify web site: http://uncr...
94456c9bb00ad0daaf9e209474761873d396478f04178616cc02fa9e1913bd1d
Python
12,829
319
# 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, Sequence from unittest.mock import patch import pandas as pd from ax.adapter.registry ...
5c63df4cb5ba624bc4c7ad714a294ffd0b3d9f79cacbe5f16fc2685950ea3c57
Python
12,836
405
""" Perform Balanced PCA as well as Reproducible PCA. A class allow user provide fitted model and just transform MCDS to adata with PCs. """ import anndata import joblib import numpy as np import pandas as pd import scanpy as sc from scipy.stats import ks_2samp from sklearn.preprocessing import RobustScaler, Standard...
a7f6b4bca940c85519db15ef6fb93b475a3191e457e8e8635dad30764932462b
Python
12,839
351
import abc import typing import uuid from dataclasses import dataclass import numpy as np from scipy.spatial.transform import Rotation from bsb import pool_cache from .. import config from ..exceptions import EmptySelectionError from ..morphologies import MorphologySet, RotationSet from ..rng import RngConsumer from...
67534fd119cedbf89138e10fb8a9720b59ae122d174b5c06b95048fda8d3e9a6
Python
12,841
395
""" Queries on probabilistic programs whose query atom carries constants. The constants of a query such as ``ans(i, p) :- r(i, "pain", p)`` must reach the rules defining ``r`` through magic sets, so that only the ``"pain"`` part of ``r`` is computed, and the result must be exactly the one of the unrestricted query, or...
2e5c8ede8e0419f20a30e01777c6da50eca2f91892e392bf15fecf950171c970
Python
12,848
362
"""Interfaces/mixins for transaction-like objects. These objects describe the context around a unit of work. This unit of work is very broad and can be anything from the response to a web request, the scheduling of a workflow, the reloading the toolbox, etc.. Traditionally, Galaxy has simply passed around a GalaxyWebT...
31b88e2e7b88cbace854cbb47dcc629aff2f2c0dce2d28aff71a4448bf71d9ed
Python
12,848
368
import os import tempfile import pytest import numpy as np import pandas as pd from neuroquery import tokenization TEST_DATA = os.path.join(os.path.dirname(__file__), "data") VOCABULARY_FILE = os.path.join(TEST_DATA, "vocabulary_list.csv") def test_nltk_stop_words(): stop_words = tokenization.nltk_stop_words(...
e913d8a8f28216d9abc30e183230ee1f30643051dd5dacf4cceff304aa5d07b3
Python
12,857
356
""" Minimum cost flow algorithms on directed connected graphs. """ __all__ = ["min_cost_flow_cost", "min_cost_flow", "cost_of_flow", "max_flow_min_cost"] import networkx as nx @nx._dispatchable( node_attrs="demand", edge_attrs={"capacity": float("inf"), "weight": 0} ) def min_cost_flow_cost(G, demand="demand", ...
9712c02dcf52248d291b07b27ba89920a55d7d607d15e598ddce3b1ec8cf0ac6
Python
12,858
246
import os import sys import argparse # os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" import torch import torch.nn as nn import numpy as np import pandas as pd from utils import * from Model.DRPreter import DRPreter from Model.Similarity import Similarity from torch_scatter import scatter_add def arg_pa...
f1617eb8892cf5c762cf299db72a0daa50cd1eceb1a8a575c4df731059efe3f7
Python
12,865
455
"""Fixtures for populating model stores.""" from typing import ( Any, Literal, ) from uuid import uuid4 from galaxy.util import now TEST_SOURCE_URI = "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/2.bed" TEST_SOURCE_URI_SIMPLE_LINE = "https://raw.githubusercontent.com/galaxyproject/gal...
46a5a893de09bdeb60b2074a27ae1e45d12978e2b110c4acf0eb0a26bb89be0d
Python
12,879
254
# Original code Copyright 2021 Leo Hiselius # Modified code Copyright 2021 Andrew Lehr # The MIT License from brian2_loihi import * import numpy as np from scipy import interpolate import warnings from .perlin import generate_perlin from .torus_distance import torus_distance from .params import * class LoihiSpreizerN...
6b39a9cbdd8b30145449fd7185d1303a6b5e74c6b47803341035bc2834d9d514
Python
12,881
299
import utils from utils import checkattr ##-------------------------------------------------------------------------------------------------------------------## def define_classifier(args, config, device, depth=0, stream=False): if checkattr(args, 'separate_networks'): model = define_separate_classifiers(...
81ff7e4e2ae103d8de234e4aed062bdf7489713a27e5fbea47f4ba42f16cf7ed
Python
12,899
299
import utils from utils import checkattr ##-------------------------------------------------------------------------------------------------------------------## def define_classifier(args, config, device, depth=0, stream=False): if checkattr(args, 'separate_networks'): model = define_separate_classifiers(...
c638a5f3928fbaf400bb5a1ae89a9d19e7260ccb901b2a02059fe3de3c839571
Python
12,917
309
"""This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin.""" import copy import logging import os from typing import ( Container, Optional, TYPE_CHECKING, ) from galaxy.util.commands import shell from . import ContainerResolver from .mulled import ( CacheDirectory, ...
47cdd86300a67c2b9526505fdd174396c4fad80a70531bf8b81eabfc90baa99c
Python
12,925
321
# Contains parameters that are used in Display Applications import mimetypes from collections.abc import Callable from dataclasses import dataclass from typing import ( Optional, TYPE_CHECKING, Union, ) from urllib.parse import quote_plus from galaxy.datatypes.data import Data from galaxy.model import Data...
8368507d660ce13dc960f249a48d6ef132c842a64743b269409ece793bcbc18c
Python
12,926
339
import functools import sys import numpy as np import psutil from bsb import ( AdapterError, ConnectionModel, ConnectionParameter, compose_nodes, config, expand_to, options, types, ) from tqdm import tqdm from ._kernel_proxy import NestModelTypeHandler, query_kernel from ._parameters i...
7a4a30fa1f329a527d2665dde1d5ddeb5e5f0992ea0433fb50db420a53c33f60
Python
12,927
316
# 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...
ddeded04f19461f34cc8abfd8634103ff17308a381b4c86b8743857e74cff9d6
Python
12,935
333
""" Tools for managing metrics with metadata attached. Copyright (c) 2019 10x Genomics, Inc. All rights reserved. """ from __future__ import division import pandas as pd import numpy as np import os import martian # Constants for computing CTCF footprinting score UPSTR_CTCF_PEAK_POS = '-23' DOWNSTR_CTCF_PEAK_POS = '...
86ecb8963777ca3e67f9dce434a6dadaca741a3940b6108098f02dedd3f247a2
Python
12,942
371
""" Created on Feb 2, 2023. @author: voodoocode """ import os import shutil import numpy as np import scipy.ndimage import pyvista import ctypes def _convert_vti_vdb(path, f_name, vti_vdb_conv_path, tmp_dir = None): """ Convert a vti object (not blender readable) into a vdb object (blender readable). ...
9604d52c09ae3332de223e7ef732900c67ab83600dbd885247dd77992ba63c2f
Python
12,943
309
from cellpose import io, metrics, utils, models import pytest from subprocess import check_output, STDOUT from pathlib import Path import os import numpy as np import torch try: import matplotlib.pyplot as plt MATPLOTLIB = True except: MATPLOTLIB = False r_tol, a_tol = 1e-2, 1e-2 def clear_output(data_...
126e143fb510fd04aa11e303f66639d596fd9a2b6e280f2852a5598951135b35
Python
12,944
376
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 11:35:36 2019 @author: aaussel """ from cells.RE_mdPul import * from cells.TC_mdPul import * #from cells.HTC_mdPul import * from cells.HTC_buffer_mdPul_Destxhe_tests import * from scipy import signal prefs.codegen.target = 'numpy' defaultclock.dt = 0.01*ms runtime...
beb5251b84d768889b40bdbc65dc8a7f2f058487a05aba1d7c89b23558ecf002
Python
12,946
354
# 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...
dda738d35d7e24cb75317c019d77bd9ed21f9f0900111b29f7f9b994e77772f0
Python
12,947
429
""" Algorithms for chordal graphs. A graph is chordal if every cycle of length at least 4 has a chord (an edge joining two nodes not adjacent in the cycle). https://en.wikipedia.org/wiki/Chordal_graph """ import sys import networkx as nx from networkx.algorithms.components import connected_components from networkx.u...
a7051ad40dce81f65f9f7c4f9350ea59fcc2c1c167670a56e2b90a8a82dfdb46
Python
12,953
353
# 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 itemge...
b6793297e86d6d6300ba2f66ec835ba9925f8056df36af071a957578b0390d16
Python
12,955
438
"""Functions for computing clustering of pairs""" from collections import defaultdict import networkx as nx from networkx.utils.decorators import not_implemented_for __all__ = [ "clustering", "average_clustering", "latapy_clustering", "robins_alexander_clustering", "butterflies", ] def cc_dot(n...
504f0622ba34862ed0289cad7fa69878ee5f79b69f49dc9dceb4edfb27370631
Python
12,962
305
import importlib import logging from collections.abc import Callable from inspect import getfullargspec from types import ModuleType from typing import ( TYPE_CHECKING, Union, ) import galaxy.jobs.rules from galaxy.jobs import stock_rules from galaxy.jobs.dynamic_tool_destination import map_tool_to_destination...
a64da3ed6faaf121aed538cd2914714f6c45c84ce5f794e5ee914a13c3597b83
Python
12,964
348
import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import torchvision from spikingjelly.activation_based import neuron, functional, surrogate, layer from torch.utils.tensorboard import SummaryWriter import os import time import argparse from torch.cuda import amp import s...
e0a56222fe2e43309ca68a0e79e40314f103921b3ef2f8c96ce247ec4a0614cb
Python
12,967
441
# -*- coding: utf-8 -*- """ Label and annotation info from Allen Brain Atlas (v2) Notes: - The annotation file is assumed to be in './Data/Annotation/annotation_25_right.tif' but can be set in the constant :const:`DefaultLabeledImageFile` - The mapping between labels and brain area information is ...
d0f4b26e192191767d7721d3be94ca2952f1b91b9c32d371e9e87f230e9a3f04
Python
12,970
367
from fanc.general import FileGroup from abc import abstractmethod import tables as t from collections import defaultdict from future.utils import string_types import inspect def _get_pytables_data_type(value): """ Convert a value or class to a PyTables data type. :param value: Primitive value :return:...
d1b2aef9e1a671a6619d88639d81c17c88beaf3355d68833674ae0858bdbc902
Python
12,971
344
""" TULIP: TUmor CLassIfication Predictor This tool predicts the primary tumor type (17 or 32 types) based on RNA-seq data. Authors: Satish RG, Sara Jones """ from __future__ import print_function import os, warnings warnings.simplefilter(action="ignore", category=FutureWarning) os.environ["TF_CPP_MIN_LOG_LEVEL"] =...
701761e23b4dd5d03f59c06fc6e8995630d43fe9517a7cfdbc1da2822b6d1290
Python
12,983
313
#!/usr/bin/env python # # Copyright M4Depth authors 2021. All rights reserved. # ============================================================================== import tensorflow as tf from utils import dense_image_warp def wrap_feature_block(feature_block, opt_flow): with tf.compat.v1.name_scope("wrap_feature_blo...
45700f3de735fc0f089337d50a6fdcd597ec28354b964570bd4f8354d2d64b00
Python
12,984
275
import math import unittest as ut # noinspection SpellCheckingInspection from pysbm import test_ground as sbmt from sklearn.metrics.cluster import adjusted_mutual_info_score class TestSimplePartition(ut.TestCase): """Test SimplePartition""" def setUp(self): """Prepare some simple partitions""" ...
e14a51e4f9f41d1671cc580ef4e6eb7bc96ad0743d37b7cfa0554ef1917eaab2
Python
12,984
278
# 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...
ba9c614f62eb1046ee29c534cf81d41fdd07ede0c59545ae1b240e6595bb1d5a
Python
12,992
346
from .helpers import dimensions, origin import numpy as np from scipy import ndimage from time import sleep from sklearn.neighbors import KDTree from .functions import get_distances class VoxelCloud: def __init__(self, bounds, voxels, grid_size, map, occupancies=None): from rtree import index sel...
af1faed5a42e4cb98b90bc88dc959c54e4fdde7312a919a14425079f7b0563c4
Python
12,997
436
import pytest import numpy as np import warnings from .. import iterative_wiener_deconv # ============================================================================ # BACKWARD COMPATIBILITY TESTS # ============================================================================ def test_rsHRF_iterative_wiener_deconv()...
1959ec14f78f4699610d2f19fb01d950cece56cb012fcde5a465581e7a24f554
Python
13,014
349
# 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 Iterable from datetime import datetime, timedelta from typing import Any import pandas as pd fro...
aa6aec8bc3ec3d6604e0ba56dbcb3299ec12c51d495a114bb54bd33c5e44a7c6
Python
13,018
304
""" ISA datatype See https://github.com/ISA-tools """ import json import logging import os import os.path import re import shutil import tempfile from typing import ( Optional, TYPE_CHECKING, ) logger = logging.getLogger(__name__) # Imports isatab after turning off warnings inside logger settings to avoid p...
5211c8c4c5a9c84385bd3b567a6094b661dbb68214466329e5c0811480c2fc0e
Python
13,031
341
import pathlib import subprocess from concurrent.futures import ProcessPoolExecutor, as_completed import cooler import numpy as np import pandas as pd import pyBigWig def _activity_score_atac_mcg(all_values): activity_score = all_values["ATAC"] * (1 - all_values["mCG"]) return activity_score def _scan_sing...
b52264a787793f38d14b2931786c081ce8d97c6dccecf1f4cd1d2e14d5075612
Python
13,032
379
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ GraphVisualization ================== Module providing tools to create meshes and visualize graphs. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)' __copyright__ = 'Copyright © ...
dcc997d1f73d9174862231ef0d3451e77eb325b517a94492b9baa300dbe2605b
Python
13,032
290
import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import scipy import seaborn as sns from similarity_measures import dissimilarity_euclidean, dissimilarity_pearson os.makedirs('results/python_plot/RDMs_per_child', exist_ok = True) # sorted by category classes = ['class-F', 'class-F', ...
c13d52b4e9015ccf97293ab74c543a90f620e714d27e7357b25e1e762feec09b
Python
13,038
329
"""Run with python -m benchmark.benchmark_tempotron, in three fresh processes.""" import argparse import hashlib import importlib.util import json import os import platform import resource import statistics import subprocess import time from pathlib import Path import torch from spikingjelly._ops import tempotron as...
e42204f9d842487117a3367906dcacddaa5914d27e31c111cb38942f7cf404bb
Python
13,043
327
#!/usr/bin/env python3 import os import numpy as np from matplotlib.pyplot import get_cmap from param_stamp import get_param_stamp_from_args from visual import visual_plt as my_plt import main from param_values import check_for_errors,set_default_values import options import utils ## Parameter-values to compare lamda...
8cfe507bd5494372ff2be15fad90cc86edea8626333870c83943d3c31a694702
Python
13,055
340
import pathlib import numpy as np from scipy import sparse import pandas as pd from sklearn.preprocessing import normalize from sklearn.utils.extmath import safe_sparse_dot from nilearn import image from neuroquery.img_utils import get_masker from neuroquery import tokenization, smoothed_regression, ridge _MAX_SIMIL...
662b17b77b539a807e1602b4731e12070819c7bd407c96b43169533785e125d9
Python
13,056
331
import os import tempfile import feather import numpy as np import pandas as pd import pytest from alpineer import misc_utils import ark.phenotyping.cell_cluster_utils as cell_cluster_utils import ark.phenotyping.cell_som_clustering as cell_som_clustering import ark.phenotyping.cluster_helpers as cluster_helpers par...
7d228bfba77639a53fabe957325d646c662d8b7919a9ecbd0a87a3a4303fc5cf
Python
13,061
436
# -*- coding: utf-8 -*- """ Statistics ========== Create some statistics to test significant changes in voxelized and labeled data. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)' __copyright__ = 'Copyright © 2020 by Christo...
b5bb14f23f41fd9aaac1c7af826942d35a093abd92bd4247fcd2dddcd2ad9b1d
Python
13,063
371
# 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...
960a88ee9bf1c738184ec75f7a8b944ec93c1312f6af3493c098cebb7dc3ef8e
Python
13,064
326
#!/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 collections import defaultdict from logging import Logger fro...
93378111f29c924ea8d6b9b7a5106f5a61f37abbb1d7d230a312472f754d3391
Python
13,066
371
import abc import logging import re from typing import Optional import yaml from pydantic import ( BaseModel, field_validator, ) from galaxy.config import GalaxyAppConfiguration from galaxy.exceptions import ConfigDoesNotAllowException log = logging.getLogger(__name__) class UrlHeadersConfigurationExceptio...
a3d727ffc1b3027d0d1ce042cfcebb06ad56cc936d18b3ef7ba645df61ca623d
Python
13,082
350
""" Copyright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import sys, os, argparse from tifffile import imread, imsave import numpy as np from matplotlib import pyplot as plt from glob import glob from cellpose import models from cellpose.io import logger_setup from c...
63baa280bc50c0526a0a52620ab2961a470e1c3e3aed6d1be82e6005bd2b1548
Python
13,085
354
import pytest import networkx as nx class TestSubsetBetweennessCentrality: def test_K5(self): """Betweenness Centrality Subset: K5""" G = nx.complete_graph(5) b = nx.betweenness_centrality_subset( G, sources=[0], targets=[1, 3], weight=None ) b_answer = {0: 0.0...
9aa4db5d2f7636f640098c8ea4069e19fb7cff6e1a7e8285e1447b87673072b8
Python
13,088
370
import time import copy import itertools import os import inspect from collections import defaultdict, namedtuple import warnings import torch import torch.nn as nn import torch.multiprocessing as mp import optuna from tabulate import tabulate from cogdl.utils import set_random_seed, tabulate_results, build_model_pat...
3a60ebcdbcc164c9ab12764955480a2dbaf641e0fea3aff8d0a94d91a6dc4b76
Python
13,092
276
"""Build the split and scaled training, validation and testing data. Functions --------- get_members(settings) get_observations(directory, settings) get_cmip_data(directory, rng, settings) get_labels(da, settings, plot=False) preprocess_data(da, MEMBERS, settings) make_data_split(da, data, f_labels, f_years, labels, y...
f65b448098bb49d4a0779de8fd7116c11cd7d60302a773b1e2ad7cc5a141da98
Python
13,094
281
#!/usr/bin/env python # # Copyright (c) 2014 10X Genomics, Inc. All rights reserved. # # Functions for preflight checks # import os import re import resource import socket import subprocess import tenkit.constants as tk_constants import tenkit.seq as tk_seq import tenkit.reference import martian def is_int(s): tr...
b691b2d67a9a40dd478dd540c03d8286a77d8c3885d1267f8f95a8a0c575ab90
Python
13,095
328
#!/usr/bin/env python3 import os import numpy as np from matplotlib.pyplot import get_cmap # -custom-written code import main import utils from params.param_stamp import get_param_stamp_from_args from params.param_values import check_for_errors,set_default_values from params import options from visual import visual_plt...
2c1f646f296f13036e9698392cde8ba7e1743e01821606f0f27973e19cdeaa8f
Python
13,113
338
import os import json import numpy as np import copy import torch import random from tqdm import tqdm import scipy.sparse as sp from utils import UnionFindSet, get_bfs_sub_graph, get_dfs_sub_graph from torch_geometric.data import Data, Dataset, InMemoryDataset, DataLoader class GNN_DATA: def __init__(self, ppi_p...
219f406c94db9020ef99e0ba5d2ca15f6ba3055ff55c443f7b23385323b4a14a
Python
13,120
412
"""Fast approximation for node connectivity""" import itertools from operator import itemgetter import networkx as nx __all__ = [ "local_node_connectivity", "node_connectivity", "all_pairs_node_connectivity", ] @nx._dispatchable(name="approximate_local_node_connectivity") def local_node_connectivity(G,...
acc6da42295a39623917c5989aeeb81353d7e86eb06bfb5187cdbf437a933439
Python
13,120
365
# -*- coding: utf-8 -*- """ Collection of routines to detect maxima Used for finding cells or intensity peaks. """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import sys import numpy #from scipy.ndimage import maximum_filter ...
1cfd910a464684bf13f2c3270895169e1c9887afa183a2449fc4bdbb9f0d05d1
Python
13,124
442
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Graph analysis module --------------------- Module provides basic Graph classes. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)' __copyright__ = 'Copyright © 2020 by Christoph K...
21976e75f11867cf083eaad4041563af430f7938c466b003ad0f1787a4f1fe0e
Python
13,124
399
"""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 glob import importlib import io import ipaddress import itertools import os import shutil import socket import sys from contextlib import co...
e619c4b3cbb5bc26db6a99e8f5d852d5aa24cc068a039d284ecd5f6069f13079
Python
13,125
284
""" Created on Oct 21, 2022. @author: voodoocode """ import nibabel.freesurfer import numpy as np import scipy.spatial import finnpy.src_rec.utils # @UnresolvedImport class Cort_mdl(): """ Container populated with the following cortical surface (MRI) based items. Parameters ---------- lh_...
7fe6a140dbd62809269c59ce030c5d0a7bd24383b2aa411b6d9af6497cf964d0
Python
13,127
413
import pytest from ...datalog.expressions import Fact from nl_expr.exceptions import ( ForbiddenRecursivityError, UnsupportedProgramError, ) from nl_expr.expressions import Constant, Symbol from nl_expr.logic import TRUE, Conjunction, Implication, Union from ..cplogic.program import CPLogicProgram from ..expre...
28226a6623522af74769384a29f43706b6319ef2815f4f40f2c85a8590072b05
Python
13,131
405
from pathlib import Path import h5py import numpy as np import pytest import torch from torch.utils.data import DataLoader from spikingjelly.datasets import base from spikingjelly.datasets.es_imagenet import ( ESImageNetFrameFixedNumberBuilder, ) from spikingjelly.datasets.shd import ( SHDFrameCustomIntegrate...
8c69dedfc00fc3f0ad2e5da0b50becd3fe73296d7bdc62081bc34f309b07b527
Python
13,140
371
import torch import torchvision as tv import torchvision.transforms as transforms import torch.nn as nn import numpy as np import pandas as pd from torch.utils.data import DataLoader import os.path as op from os.path import join as opj import sys import os import matplotlib.pyplot as plt from torch.utils.tensorboard i...
b7454a88cbe07755587137497b81ffebf55878207a3cc0f09ea66b13af45607d
Python
13,142
381
"""Generate and work with PEP 425 Compatibility Tags.""" from __future__ import absolute_import import distutils.util import logging import platform import re import sys import sysconfig import warnings from collections import OrderedDict import pip._internal.utils.glibc from pip._internal.utils.compat import get_ext...
f3210add5a71e1429b0acf404fb874356fb589d66210a61f1dbbbb2dea24615f
Python
13,145
410
# ---------------------------------------------------------------------------- # build_voxel_matrix.py # Author: Antoine Beauchamp # Created: June 19th, 2020 """ Build a gene-by-voxel expression matrix Description ----------- This script imports in-situ hybridization (ISH) MINC images from the Allen Mouse Brain Atla...
87389208b0c8548a1358f579e9f103e60235a44ace7722ce43767f13f373f40b
Python
13,150
468
""" Operations on graphs including union, intersection, difference. """ import networkx as nx __all__ = [ "union", "compose", "disjoint_union", "intersection", "difference", "symmetric_difference", "full_join", ] _G_H = {"G": 0, "H": 1} @nx._dispatchable(graphs=_G_H, preserve_all_attrs=T...
e00d87854e13d8de206c8475b6672e7cf9c27c9b59b785516f000de12e0f1891
Python
13,157
378
from typing import Optional import torch from .. import functional, surrogate from .base_node import BaseNode __all__ = ["AdaptBaseNode", "IzhikevichNode"] class AdaptBaseNode(BaseNode): def __init__( self, v_threshold: float = 1.0, v_reset: Optional[float] = 0.0, v_rest: float...
ad89863b0bde737eff30b83b613897c24951b3e86f17c66a7de6a67e14d1e109
Python
13,159
330
from tensorflow.keras.models import load_model import getopt import sys from scipy.stats import pearsonr, spearmanr from utils import get_input_size, make_prediction, set_data_size, one_hot_enc import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.linear_model import LinearRegression impor...
a00798e9d193d55ef1a2c82a4f5050885ebbe266cd50018d730d5bbb218e706b
Python
13,169
375
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 11:35:36 2019 @author: aaussel """ from cells.RE_mdPul import * from cells.TC_mdPul import * #from cells.HTC_mdPul import * from cells.HTC_buffer_mdPul_Destxhe_tests import * from scipy import signal prefs.codegen.target = 'numpy' defaultclock.dt = 0.01*ms runtime...
e2aa810ccf366ee7e1aaa11dd1bfbdf6c39bcfde579845445c3562e6203209e1
Python
13,172
381
from __future__ import absolute_import import errno import warnings import hmac import socket from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning from ..packages import six SSLContext = None HAS_SNI = False IS_PY...
58d1b4ed16a05c50cb70f406d4eb4b9bef5b9369618f6658b519af1fecb3649d
Python
13,179
333
# 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...
23babe2f69ae61cb8ee96ac7620f8b3deae88be97b7c6986ab832135aa3345cb
Python
13,181
251
# -*- coding: utf-8 -*- """ Generate docs/_generated/usecase_table.html — a searchable, filterable table of every published SimBA use-case, built from the same public Google Sheet as the use-case map. The rows are embedded as JSON and rendered client-side (plain JS, no libraries), so the page works offline once built....
1ba007740dccb73758ef06ad1465f305a191c550418cca660d191f9fe63322c1
Python
13,188
393
import unittest import _shared import patch.objects from patch import is_density_mechanism, is_point_process, p from patch.exceptions import HocRecordError class TestPatchRegistration(_shared.NeuronTestCase): """ Check that the registration of PythonHocObjects works. (Will almost never be relevan...
95a8776c4743153aaef21c53da675e0d9eb1f8b576ed4bb7019368225d335f2a
Python
13,202
313
""" Created on Oct 17, 2022. @author: voodoocode """ import numpy as np import pickle import warnings import sklearn.covariance import sklearn.decomposition import finnpy.src_rec.utils # @UnresolvedImport def _empirically_estimate_cov(cov_data, epoch_splits, signal_type, valid_ch_indices, ch_types = None): """...
05e85153a4909d6ccab00168b21acddafa7170f0722c0562a1f19eab7f2fdb71
Python
13,203
407
import numbers import pytest import networkx as nx from ..generators import ( alternating_havel_hakimi_graph, complete_bipartite_graph, configuration_model, gnmk_random_graph, havel_hakimi_graph, preferential_attachment_graph, random_graph, reverse_havel_hakimi_graph, ) """ Generator...
d57bdfe937f71d152e49c1f444424c05b8fbcdf4a5d123e37d1097b07c5e2aae
Python
13,209
276
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @title: PlateSheet class @description: class for loading "_platesheet.csv" files @author: chrisarcadia @created: 2018/05/31 """ import os, csv, copy, datetime # class for handling Plate Sheet (_platesheet.csv) files class PlateSheet(object): def __init__(s...
898782b65490d5bd9990b8fcbfec229c1e01541884795eee0936e9186bd1af48
Python
13,214
239
import logging import os import shutil from sqlalchemy import and_ from galaxy import util log = logging.getLogger(__name__) def get_tool_dependency(app, id): """Get a tool_dependency from the database via id""" return app.install_model.context.query(app.install_model.ToolDependency).get(app.security.decod...
d3cfc312522bbbb85f61eb231c34d4dc19e087c964cd32329d6b5e682b51d218
Python
13,215
316
# 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...
16e7a726cc2f2bd07facd2f8821397d8f7e54caabc196019fad9eebe4e87d868
Python
13,217
313
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Twokenize -- a tokenizer designed for Twitter text in English and some other European languages. This tokenizer code has gone through a long history: (1) Brendan O'Connor wrote original version in Python, http://github.com/brendano/tweetmotif TweetMotif: Explor...
dbddabad4b2c8876123f1b05f1154f8343d0964f93b72fed92ee395feca51480
Python
13,222
376
import logging import os from collections.abc import Iterable from typing import ( cast, NamedTuple, NewType, NoReturn, Optional, ) import alembic from alembic import command from sqlalchemy import ( create_engine, MetaData, ) from sqlalchemy.engine import Engine from sqlalchemy.exc import ...
1e3e3a0c43f0221e5106c2ea8807e65e679617853824dcf4805919dcf4d84914
Python
13,224
365
""" Manager and Serializer for HDCAs. HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a history. """ import logging from typing import Optional from galaxy import model from galaxy.exceptions import RequestParameterInvalidException from galaxy.managers import ( annotatable, ...
52c41bb3da233619d44779415bec97621889638acb7ad76665144f89992e8b80
Python
13,229
326
# NICE # Copyright (C) 2017 - Authors of NICE # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program ...
12f697649972363be3758e66ba9a434ee617c5291bb672047f3f0d735cffcb01
Python
13,235
340
import base64 import fnmatch import json import logging import re from datetime import timedelta from enum import Enum from functools import lru_cache from json import JSONDecodeError from typing import Optional, Union from urllib.parse import urlparse import google.auth import google.cloud.storage as gcs from core.ut...
5f005aa171edb96951dbaaef828e97caba258a6a71f13007b0aa3d98ba7efe6f
Python
13,239
367
import torch import torch.nn as nn from spikingjelly.activation_based import neuron, op_counter class ToyCLIFNode(neuron.BaseNode): def __init__(self): super().__init__(v_threshold=1.0, v_reset=None, step_mode="s") self.register_memory("m", 0.0) def neuronal_charge(self, x: torch.Tensor): ...
4fb8d8e46eadc3ee86fefbe6b3f4d2b156a86e310c0e898868c80d387085769f
Python
13,243
365
# -*- coding: utf-8 -*- """ Collection of routines to detect maxima Used for finding cells or intensity peaks. """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import sys import numpy #from scipy.ndimage import maximum_filter ...
ff720647c46a5aef1544f47fd18507dde033a30bf9218a80bddc50a35795a8cf
Python
13,243
368
"""Fast approximation for k-component structure""" import itertools from collections import defaultdict from collections.abc import Mapping from functools import cached_property import networkx as nx from networkx.algorithms.approximation import local_node_connectivity from networkx.utils import not_implemented_for ...
73e0a0919dbac1f3356583857d64c82f795df7dca309c13d01a29f6129dd0ba6
Python
13,248
330
import os import numpy as np import pandas as pd from alpineer import io_utils, misc_utils from ark.phenotyping import cell_cluster_utils, cluster_helpers def cell_consensus_cluster(base_dir, cell_som_cluster_cols, cell_som_input_data, cell_som_expr_col_avg_name, max_k=20, cap=3, seed=42,...
69f7091ad5035256330a37b87f151f24311119de7263da900d95bb1a6357085d
Python
13,251
279
""" Managers, serializers for Galaxy config file data. ConfigSerializer for all users and a more expanded set of data for admin in AdminConfigSerializer. Used by both the API and bootstrapped data. """ import logging import sys from typing import ( Any, ) from galaxy.managers import base from galaxy.managers.con...
e43822f0f8cc649cff52e9f64972f96ba9b1b407dd6e6de43c875b8334935e03
Python
13,251
435
"""Views of core data structures such as nested Mappings (e.g. dict-of-dicts). These ``Views`` often restrict element access, with either the entire view or layers of nested mappings being read-only. """ from collections.abc import Mapping __all__ = [ "AtlasView", "AdjacencyView", "MultiAdjacencyView", ...
fdf5669fdec509111033e6597fe03ce44eb5c5f5e6d0fda444dcf35dc3c34152
Python
13,251
331
### Generate decorations and compute the reward for each one import argparse import logging import os import sys from tqdm.auto import tqdm import random import json import gzip import pathlib import numpy as np import pandas as pd import tensorflow as tf import tensorflow_addons as tfa from nfp import custom_objects...
f1dd5e60afd1a24f66c1a9dce9cf49bb5eed9867f7572fd91017fd815a3ae866
Python
13,263
345
import copy import importlib.util import pytest import torch import torch.nn as nn from spikingjelly.activation_based import base, layer from spikingjelly.activation_based import neuron from spikingjelly.activation_based.functional.net_config import detach_net, reset_net from spikingjelly.activation_based.learning.on...
a2204e249db06ac63cf25ecb67833e0a46df33068bd422742ca9ea21685a42cc
Python
13,274
319
import math import random from copy import deepcopy import torch from torch import nn USE_CUDA = torch.cuda.is_available() MAX_OUTPUT_LENGTH = 46 class Beam: # the class save the beam node def __init__(self, score, input_var, hidden, feed_hidden, all_output): self.score = score se...
e0fd0d2eaec677d44f3d7848febc7447085393f2445b2a41b6c63c5ea919c717
Python
13,278
335
import math, numpy as np, random from .morphologies import Compartment def depth_first_branches(adjacency_list, node=0, return_visited=False): branches = [] visited = set([]) def dfs_branch(branch, node): # Grow the branch with current node. branch.append(node) # Mark this node as...
bff92ab33dbcd73e2fdd6b4fc9e4898283c215544eca5ee76f6f1c87fcad7df3
Python
13,279
285
# -*- coding: utf-8 -*- """ Example script to set up the parameters for the image processing pipeline """ ######################### Import modules import os, numpy, math import ClearMap.Settings as settings import ClearMap.IO as io from ClearMap.Alignment.Resampling import resampleData; from ClearMap.Alignment.Elas...
54f5bfdf3c016b5c648f9e4a46f3434fda7b8ab46a727a22d10052d0ae1c33bb
Python
13,287
332
import argparse import shutil import os from collections import defaultdict import os.path as op import tempfile import subprocess import numpy as np import nibabel as nb import pandas as pd from tqdm import tqdm import h5py def find_mrconvert(): program = 'mrconvert' def is_exe(fpath): return op.exis...
21b622bd838a4b1a34c402bd2c72fff4a81bf7213d8016404454d0a678619d08
Python
13,291
297
""" OBJECTIVES: Analyze microtubule (MT) spread from kymographs with maximum intensity projections. There are two different measures: 1) Length in the neurite in um over which 90/95% of the MT intensity is spread out. 2) The percentage of MT spread retrograde and anterograde. Steps: 1) Get background v...