sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1734143fbfd5c8261fe94317bb1da1a013e6d101352b744592125eb051558617
Python
34,202
806
import logging import os from collections.abc import Callable from datetime import datetime from enum import Enum from typing import ( Any, Optional, ) from sqlalchemy import ( Boolean, Column, DateTime, ForeignKey, Integer, String, TEXT, ) from sqlalchemy.orm import ( Declarati...
9664bb6e3f9b2fb543d59dcfb626e003f064b768c4fd57539600827666a22a96
Python
34,216
985
import pytest import torch from spikingjelly.activation_based import functional, neuron, surrogate def _table(scale=1.0): return neuron.FewSpikeTable( theta=torch.tensor([0.25, 0.5, 0.75]) * scale, h=torch.tensor([0.2, 0.3, 0.4]) * scale, d=torch.tensor([1.0, 2.0, 4.0]) * scale, ) d...
db9396df9687d3da11de6f745c786aea7c4a4815fd3bcbe1f1ac304385ef78b6
Python
34,221
513
import torch import time from torch.nn import ReLU import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.colors import Normalize, ListedColormap from sklearn.decomposition import PCA import pandas as pd import seaborn as sns ReLu = ReLU() ########################################...
71109226c72d3aad037d5c2e5190d407d900f09e2bbaaf2189a0d97ea9a9acb0
Python
34,228
1,034
""" Algorithms for finding optimum branchings and spanning arborescences. This implementation is based on: J. Edmonds, Optimum branchings, J. Res. Natl. Bur. Standards 71B (1967), 233–240. URL: http://archive.org/details/jresv71Bn4p233 """ # TODO: Implement method from Gabow, Galil, Spence and Tarjan: # # @...
eacfb7ee202a5d5a6dabccfb53f2e81ffa5b20fac24149bf67c42e206136f50d
Python
34,275
953
# -*- coding: utf-8 -*- """ requests.models ~~~~~~~~~~~~~~~ This module contains the primary objects that power Requests. """ import datetime import sys # Import encoding now, to avoid implicit import later. # Implicit import within threads may cause LookupError when standard library is in a ZIP, # such as in Embed...
1ff3de983326458ad12b8dd829a853bdd4397cafce7573fc028f2d4b23534c54
Python
34,287
771
""" Plot of the potential using Mayavi mlab ======================================= .. currentmodule:: mlab_potential :platform: Linux :synopsis: module for plotting and simulating the amplitude equation and its potential .. moduleauthor:: Jose M. Esnaola-Acebes <josemesnaola@gmail.com> This module contains an...
3a0192aa0c723d9482c1c21669e005a630e892ba26ed1042b10155d73df4f367
Python
34,313
797
import matplotlib # import sys sys.path.append("/home/cat/code/widefield/") # Adds higher directory to python modules path. import h5py import numpy as np import scipy.io as sio import matplotlib.pyplot as plt from sklearn.cross_decomposition import CCA import torch import time import warnings warnings.filterwarnings...
6ad2685ca6192df2db69fe4d9c1215b43857629204f12cc8f99be5d58ac2d04c
Python
34,330
1,058
import plotly.graph_objects as go from plotly.subplots import make_subplots from .networks import all_depth_first_branches, get_branch_points, reduce_branch import numpy as np, math, functools from .morphologies import Compartment from contextlib import contextmanager import random, types from .reporting import warn ...
8c7d9e4e17d3824b52eca5f84b483e1e1067ce9e9707a4e889f2fac26221fe40
Python
34,368
554
# -*- coding: utf-8 -*- """ Generate the Related Software page's tool table and its plain-text index: * docs/_generated/related_tools_table.html -- one searchable, filterable table of every tool; * docs/_generated/related_tools_index.rst -- the same tools as a plain A-Z list, so the docs search (which indexes RST t...
d7108e69aca377c56d9c177f36e70ef112f4e9a580b9533490c198e89eacff81
Python
34,410
1,017
import copy import gc import pickle import platform import weakref import pytest import networkx as nx from networkx.utils import edges_equal, graphs_equal, nodes_equal def test_degree_node_not_found_exception_message(): """See gh-7740""" G = nx.path_graph(5) with pytest.raises(nx.NetworkXError, match="...
d22fe8667deed2b1381d4918d8a346846be78b88fc8208426a6ec29e79b54143
Python
34,424
816
# 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...
4214b796c391b86f68ed8ef7f695d972009f3506d30a58ac40db463b2a2ffbd7
Python
34,447
631
import argparse from utils import NumpyEncoder import os import json import logging import time from statistics import mean, stdev from typing import List from collections import defaultdict from sklearn import metrics from operator import add import copy from select_diverse_models import select_diverse_models import d...
4a433c8084d90b2e86e476938bd688e2f53c12c379dcde0ff40c42780b75f47b
Python
34,495
964
from abc import abstractmethod import torch import torch.nn as nn import torch.nn.functional as F from . import base, functional, neuron, surrogate def _population_parameters(obs_dim, pop_dim, mean_range, std): mean = torch.linspace(mean_range[0], mean_range[1], pop_dim) mean = mean.expand(1, obs_dim, pop_d...
fc029772533d81a869e656235ec8982cec2e03ce2e444c746779ee1fd0acead1
Python
34,527
658
from ipywidgets import interact, Layout, Label import ipywidgets as widgets import os import pybel import sys from IPython.display import display, clear_output, Javascript from rdkit import Chem from rdkit.Chem.Draw import IPythonConsole import os.path import csv import pandas as pd from collections import Counter sty...
2a842f31dd0e7de3149fe5a2fefd9ef7d8f192e7bfcca9311411e28900d2dd9d
Python
34,696
971
from __future__ import absolute_import import cgi import email.utils import getpass import json import logging import mimetypes import os import platform import re import shutil import sys from pip._vendor import requests, six, urllib3 from pip._vendor.cachecontrol import CacheControlAdapter from pip._vendor.cachecon...
f3cbf467ca45bdbdfdc3997eceb3abfe533fc90091bfa32d16590ba50f236a8d
Python
34,709
1,074
# -*- coding: utf-8 -*- """ Vasculature =========== Expert vasculature image processing pipeline. This module provides the basic routines for processing vasculature data. The routines are used in the :mod:`ClearMap.Scripts.TubeMap` pipeline. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __licen...
33a9e49df1a53474711833ee3d54ff847193899e042e129b602217931d0ef576
Python
34,710
1,054
""" Implementation of the weighted model counting approach through knowledge compilation. """ import logging import operator as op from typing import AbstractSet import numpy as np import pandas as pd from nl_expr.config import config from ..datalog.expression_processing import ( UnifyExistentialVariableE...
51978400a5b10b174944e1b83b1e2e5b9905a6303df6e3f725d091ee2b06ee74
Python
34,738
820
import os import tempfile from copy import deepcopy import feather import numpy as np import pandas as pd import pytest from alpineer import io_utils, misc_utils import ark.phenotyping.cluster_helpers as cluster_helpers import ark.phenotyping.pixel_cluster_utils as pixel_cluster_utils import ark.phenotyping.pixel_met...
4a0b6668717eb57c80a4ee541dfac5f65250f514d247372c09b1b8f232aa611e
Python
34,753
815
import random import torch import os import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torch.utils.data import RandomSampler, BatchSampler, SequentialSampler from .utils import calculate_accuracy, Cutout, calculate_accuracy_by_labels, calculate_FP, calculate_FP_Max from .newtra...
c00b73fac4594a6b182d914c4626e66f39ee4b01a841c0f01180c4f3e2d0dcba
Python
34,799
982
import random from itertools import chain, islice, tee from math import inf import pytest import networkx as nx from networkx.algorithms.traversal.edgedfs import FORWARD, REVERSE def check_independent(basis): if len(basis) == 0: return np = pytest.importorskip("numpy") sp = pytest.importorskip(...
294f11666134655177b4ca5bb82e4b4d98ad92c73a01d6c02ed36caf5204a61c
Python
34,805
1,067
"""Generators for classes of graphs used in studying social networks.""" import itertools import math import networkx as nx from networkx.utils import py_random_state __all__ = [ "caveman_graph", "connected_caveman_graph", "relaxed_caveman_graph", "random_partition_graph", "planted_partition_grap...
86f63e0392a91da8ca97b1fc5a222273b5e675ad347539167271e1deab0d8aac
Python
34,871
932
#!/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 unittest.mock import Mock, patch, PropertyMock import numpy as np import pandas as pd from ax.co...
ef886df5da1de41c730de5d37169496964b6897ed63a5c8ada69983dc0781ed2
Python
35,041
875
"""Stitching of tile-cut cells flagged by :func:`~squidpy.experimental.tl.calculate_tiling_qc`. When segmentation is run tile-by-tile (Cellpose, Stardist, Mesmer, ...) cells that straddle tile boundaries get cut into 2-4 pieces with characteristic straight, axis-aligned cut edges. :func:`~squidpy.experimental.tl.calc...
ae073fdc3d15b03e550f1af82b3cc0f0f95e7b44667ab9b958a6fbd457315aef
Python
35,097
896
from __future__ import absolute_import import errno import logging import sys import warnings from socket import error as SocketError, timeout as SocketTimeout import socket from .exceptions import ( ClosedPoolError, ProtocolError, EmptyPoolError, HeaderParsingError, HostChangedError, Locatio...
2f4829a7c9ed417764ba6586063839af360f976f2c1715e4b647200f613d94fc
Python
35,140
1,057
"""Accessor classes for AnnData interface.""" from __future__ import annotations import abc import sys from collections.abc import Hashable from dataclasses import KW_ONLY, dataclass, field from functools import cached_property from typing import TYPE_CHECKING, ClassVar, Protocol, overload, runtime_checkable if sys....
099eb38da9d2ea53b616413dce900185bc5ee9a8e2bd6ccc52c255d223768954
Python
35,147
940
#!/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 abc import ABC, abstractmethod from collections.abc import Ca...
8576ccb875fe10abce9dd40127df5f3c23a5a5af69f088a6c643624062eacf83
Python
35,191
635
import torch from torch import optim from torch.utils.data.dataloader import DataLoader from torch.utils.data import ConcatDataset import numpy as np import tqdm import copy from utils import get_data_loader,checkattr from data.manipulate import SubDataset, MemorySetDataset from models.cl.continual_learner import Conti...
8e20adb6024b7e185fba6c631f35073827b8038adcc1f850ed062e8534704918
Python
35,203
882
import torch import torch.nn as nn import torch.nn.utils.rnn as tn from torch.autograd import Variable import os import torch.nn.functional as F import numpy as np import scipy import time import copy import random from .utils import init from sklearn.neural_network import MLPClassifier from sklearn.model_selection imp...
f26f45b7d80559741bcfdd54fb252bf4e840838a86efe4633824509e2bd716cf
Python
35,233
794
from numpy import * from numpy.linalg import LinAlgError from numpy.random import randint from six import iteritems from six.moves import range import hashlib from random import shuffle from .logger import log_message from .mask_starts import mask_starts from .linear_algebra import BlockPlusDiagonalMatrix from .defau...
cb38e9d2ddbc0d3d6a76e3dfa009237fe8ae5210e9ecd349a634942d05aba02a
Python
35,234
945
from skimage import morphology, measure, io, util # For performing morphology operations (should maybe import more from skimage...) from mpl_toolkits.mplot3d import Axes3D # Plotting in 3D import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab imp...
86aeca04700bc25e59b87fdfae80d8a370774c897b75c795f75fc756555af839
Python
35,257
755
import os import scipy.io import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import logging from mpl_toolkits.mplot3d import Axes3D, art3d # Import 3D plotting toolkit from scipy import stats import re from sklearn.preprocessing import MinMaxScaler class MUSIC_TUS_DataAnalyze...
a71b0f1308b9558d3cbd5465d2f6d089868215941bf531f749a7c6860871ab90
Python
35,292
985
""" Provide basic convenience data types. Most classes are based on pytables and hdf5 dictionaries, allowing on-disk storage and therefore processing of large files. Other features include indexing and querying. """ from __future__ import division from fanc.config import config import tables as t from tables.nodes im...
b5107658b6cec2998e6326a6227517412269b5f01652d59fb8f83d1ee253c724
Python
35,319
924
# stdlib imports import os, getpass, datetime, pathlib, tempfile, functools, glob # non-stdlib core dependencies import numpy as np import scipy import cellpose.io import cellpose.models import tifffile import imagecodecs # distributed dependencies import dask import distributed import dask_image.ndmeasure import yam...
13fa35ce2cdac35f17f212a7e073384ce1b390a1f1e0c444dc93eef823db56aa
Python
35,328
694
# 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...
06949c082f2cad826027a0744ee29682924e0015d41eaf629c1aade7e1be84da
Python
35,351
997
import numpy as np import math import matplotlib.pyplot as plt import power_law import matplotlib as mpl from cycler import cycler from tqdm import tqdm mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk') def gabor_features_no_phase(theta_stim, theta_pr, sigma, thresh, a = 1.3): th_diff = np.outer(theta_st...
0f6b33a50e2b13dd327c92125ccb3e2fd5450c2a78396aadc4c346cbc2aaed65
Python
35,356
1,051
# 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...
999b1aa240ea7d3b86087ab9ced489e9336e0eaebe1178b46509a784b08106e5
Python
35,378
994
import torch from nidn.utils.global_constants import PI from .constants import * from .utils.fft_funs import Epsilon_fft, get_ifft from .utils.kbloch import Lattice_Reciprocate, Lattice_getG, Lattice_SetKs from .utils.torch_functions import torch_transpose, torch_dot, torch_eye, torch_zeros class TRCWA: def __...
1bbfef1430bcc8a4353e2ba68de07a9a3942886b81538e26c26d6a9978146fbb
Python
35,433
912
import unittest from time import sleep import numpy as np from bsb_test import ( NetworkFixture, NumpyTestCase, RandomStorageFixture, get_test_config, skip_parallel, ) from bsb import ( MPI, BootError, CellType, Chunk, Configuration, IndicatorError, PackingWarning, ...
77332db3b63598c52ecf8cc4cf869d12a6143685e2f4131ffa8cb343404c1b7b
Python
35,502
983
import pytest import networkx as nx from networkx.utils import pairwise def validate_path(G, s, t, soln_len, path, weight="weight"): assert path[0] == s assert path[-1] == t if callable(weight): weight_f = weight else: if G.is_multigraph(): def weight_f(u, v, d): ...
3b6e29e2190871434e428a685a41961cdd5082c5497a457860943d7c6ac67cf0
Python
35,593
1,040
# 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. import argparse import io import json import os import re import shutil import subprocess import uuid from pathlib import Path import mdfor...
4b3e2ba2481b946fa61399ca10866488c06c997c758b22dfb108368a3ed82d25
Python
35,618
949
import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab import * import numpy as np import data_treatment as datr import random import math import time import os import glob import copy def rmsd(x,y): Nx = len(x) Ny = len(y) if Nx!=Ny: ...
60785ef786c8115acec0ba01e9df1d9ad9ac46e31408802b9dac065916feadf9
Python
35,635
944
# -*- coding: utf-8 -*- # # Copyright (c) 2013 Egor Zindy <egor.zindy@manchester.ac.uk> # # * ArrayElementVar and ArrayVar based on Bryan Oakley's code from # http://stackoverflow.com/questions/3876229/how-to-run-a-code-whenever-a-tkinter-widget-value-changes # * clean() lambda from # https://stackoverfl...
8b5ca2aa2e89316d50ef61148a23d1dd73943d2c560e14f0c139fa4d03d81458
Python
35,652
955
"""Analyze one single-host Nsight Systems SQLite export without a GPU.""" from __future__ import annotations import argparse import csv import json import re import sqlite3 import statistics from collections import Counter, defaultdict from pathlib import Path if __package__: from .plot_nsys_snn import render el...
27ab9da4e57b11a96bda8c1d2d1b50f0bdb33fd42e5eb3973158c8c83aba21e4
Python
35,689
1,014
import atexit import tempfile import unittest from numbers import Integral import numpy as np import pytest from numcodecs import Adler32, Zlib from numpy.testing import assert_array_equal import zarr from zarr.convenience import ( consolidate_metadata, copy, copy_store, load, open, open_conso...
c4963e5e320f40da811b0f3ba5618d7c0c9187715e13fdaef9153e5c28dffa84
Python
35,732
821
""" Script to build the action space for decorating crystal structures in the RL search. Action space: Action space: 1. Choose the elements desired for the battery material i.e., conducting ion, framework cation(s), and anion(s) 2. For a given combination of elements, randomly select a composition from one...
09e084c0df9dd33314164dd12b460162b7e8210df506ff035f1c4f0015372877
Python
35,743
964
from skimage import morphology, measure, io, util # For performing morphology operations (should maybe import more from skimage...) from mpl_toolkits.mplot3d import Axes3D # Plotting in 3D import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab imp...
d7e2dfa07d66d8458c1700aa02a078de523163c7a8374011cb05e5ae8fa56d12
Python
35,761
878
# 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 abc import abstractmethod from typing import TYPE_CHECKING from ax.core import Mult...
135b82c99abf1506b3b2cf710ae505f16f6cc84d09a656f987d89cb3d1025fb5
Python
35,878
1,133
import logging import numbers import operator import typing import warnings from typing import AbstractSet import pandas from nl_core.datalog.expression_processing import UnifyVariableEqualitiesMixin from nl_expr.exceptions import UnsupportedProgramError from nl_expr.expression_pattern_matching import add_match from ...
ac525c36988a6f500f14b0fa68f6b3dc0c9e27f4bc25561600f0a96b55254055
Python
35,884
657
""" Constants that are used by all code are placed here for easy access. These include: 1. ACCEPTED_RES 2. RES_3_TO_1 3. TARGET_ATOMS 4. RANDOM_COIL_TBL 5. RANDOM_COIL_AVG 6. RANDOM_COIL_STD 7. ONEHOT (code: 10) 8. BLOSUM (code: 45, 50, 62, 80, 90) """ from numpy import rad2deg as np_r...
f15fa5fa88a9616c59a4a6982fa72dbaae06766eabf27e8041536fbe001a6ca2
Python
35,918
967
import matplotlib # import numpy as np import matplotlib.pyplot as plt import os ######################################### ########### HELPER FUNCTIONS ############ ######################################### def load_data_PCA(fname_whole_stack, fname_lever_times, fname_blue_light): ...
3f5eaac2f853dc4765a155816796500933dd6bcf24e29a2e284f326f960ec488
Python
35,944
1,031
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # ============================================================================= # Final code for NNMF brain tumor anatomy project # ============================================================================= # @author: J. M. Kernbach (NAILA, Neurosurgical Artificia...
470485cb352d3be0792f91982f686d5be91e5b7e84f920759483f4c8f787649a
Python
36,023
852
# 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 unittest import mock from unittest.mock import Mock, patch import numpy as np import pandas as pd import to...
6ce5dbaa931556e45789ba41d2dacd0025f823ccbddf9398a9c1b3d063677957
Python
36,141
769
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np import sys import warnings import math from tqdm import tqdm from collections import namedtuple from pathlib import Path from csbdeep.models.base_model import BaseModel from csbdeep.utils.tf import export_SavedModel,...
e1e4df14770ceeff8c0cec774b7b15b53b09f689faf13314f11ca1cc4411d498
Python
36,215
593
""" Class encapsulating the management of repository dependencies installed or being installed into Galaxy from the Tool Shed. """ import json import logging import os from typing import TYPE_CHECKING from urllib.error import HTTPError from urllib.parse import ( urlencode, urlparse, ) from urllib.request impor...
3633139d683f2501a0016787b5383fba367a99b156c90a7589110feaa9381d7b
Python
36,269
925
#!/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 logging from collections.abc import Mapping from datetime import datetime from math import ceil...
3c5290780d776529d71cfd17adf8a7a6cbd87627a468ee029a8cdb0131c14496
Python
36,277
1,064
import random import pytest import networkx as nx from networkx.utils import edges_equal, nodes_equal def test_degree_histogram_empty(): G = nx.Graph() assert nx.degree_histogram(G) == [] class TestFunction: def setup_method(self): self.G = nx.Graph({0: [1, 2, 3], 1: [1, 2, 0], 4: []}, name="T...
9240fe9148d47badca8b54554ebac70a6cc115dc1d9a2bc30c362cd01afbe19c
Python
36,300
989
"""Functions for building graphs from spatial coordinates.""" from __future__ import annotations import warnings from typing import Any, Literal, NamedTuple import geopandas as gpd import numpy as np import pandas as pd from anndata import AnnData from anndata.utils import make_index_unique from numba import njit fr...
58a65f5b6f311b3ece90abe8a73956610bcbb2a69636aa6c68450aedbf1d9ee8
Python
36,311
1,039
from __future__ import annotations import itertools from collections.abc import Mapping, Sequence from copy import copy from functools import partial from numbers import Number from types import MappingProxyType from typing import Any, Literal, NamedTuple import dask.array as da import numpy as np import pandas as pd...
a348bd083100a66c473f337f00095b12a386dd6e7548c67f45a850d41b48a912
Python
36,314
812
""" Heterogenous lists/contents are difficult to query properly since unions are not easily made. """ import json import logging from typing import ( Any, Optional, ) from sqlalchemy import ( asc, cast, desc, false, func, Integer, literal, null, nullsfirst, nullslast, ...
dee390f7176ec778bfcc51b184397e7511b39d910e4abd0ee4c395c5147dfc9e
Python
36,399
713
import matplotlib.pyplot as plt import matplotlib import itertools import statistics import pickle import numpy as np import pandas as pd import scipy.stats from stats.Stats import * import seaborn as sns from pprint import pprint from utils.Utils import * from utils.ColorUtils import * import os import fnmatch from sy...
874965f319ead76988f4fb90f5077f221b6dd3c4a9f0bd09aa11bd298f15ca39
Python
36,411
977
"""Fallback pure Python implementation of msgpack""" import sys import struct import warnings if sys.version_info[0] == 3: PY3 = True int_types = int Unicode = str xrange = range def dict_iteritems(d): return d.items() else: PY3 = False int_types = (int, long) Unicode = unicode...
3174e5e8dbc2f64f9a1d0aebc20a456668eb7ab7c220b8d3b1bcbb6b61a6faa1
Python
36,521
1,070
"""Functions for generating trees. The functions sampling trees at random in this module come in two variants: labeled and unlabeled. The labeled variants sample from every possible tree with the given number of nodes uniformly at random. The unlabeled variants sample from every possible *isomorphism class* of trees w...
04fd61d1d144e01ce9c0edd220ab81c35b1727f3159990725fdfc3a39533dc9d
Python
36,524
1,022
# 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...
9fba55cc58225cd8e1df28bf6c6410ace2630d0b019ff2f9db47884776dfb532
Python
36,532
930
#!/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 itertools import math from bisect import bisect_right from ...
3cca471aa30fb03e8a71edb3966f47f0b1299fa9b1592d2cfaffca42958531be
Python
36,556
888
from genomic_regions import GenomicRegion, Bedpe from collections import defaultdict import numpy as np from ..tools.general import RareUpdateProgressBar from ..general import FileGroup from skimage.transform import resize import warnings import tables import logging logger = logging.getLogger(__name__) class Aggre...
f3a3d94f3b0d67c2556dff6579911b1aab0ea3acad59dd6ac8a624030fdbf267
Python
36,630
1,152
"""Model the behavioral data.""" # %% # Imports import itertools import json import sys import warnings from functools import partial import matplotlib.pyplot as plt import numpy as np import pandas as pd import pingouin import scipy.stats import seaborn as sns import statsmodels.stats.multitest from scipy.optimize im...
fa5bb7c6f58ec470e4a1ab3e2154db620846675b6e74455d178445988d59f783
Python
36,769
906
""" Source files for genome annotation. Each variable is a dictionary in which keys are supported genome versions GTF_SOURCE: GENCODE basic CHR gtf file DHS_SOURCE: Master Peak List ENCODE3 human and mouse DNase-seq October 2015 BLACKLIST_SOURCE: ENCODE black list for ChIP-seq, DNase-sea and ATAC-seq ...
1dd53e45703c53a8e4bcc7d5492b26983c2dc43781c9edddf07dccf52288ac8d
Python
36,778
1,018
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Feb 16 10:58:44 2024 @author: colin """ import asyncio import asyncssh import contextvars import functools import paramiko import threading import os from os.path import join as pjoin from os.path import exists as pexists import sys import subprocess # ...
229c189d1d45756387a79bf2c4cb7b4609a306baf644e8b58140bef822f12679
Python
36,796
995
import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab import * import data_treatment as datr import numpy as np import random import math import time import os import glob import copy def rmsd(x,y): Nx = len(x) Ny = len(y) if Nx!=Ny: ...
c6f6e26aee86a84d68c2c0585cfd16546e67fd78f4e2bc98a03ba41de780475f
Python
36,841
937
from unittest.mock import patch from organizations.tests.factories import OrganizationFactory from projects.models import Project from projects.tests.factories import ProjectFactory from rest_framework.test import APITestCase from tasks.models import Annotation, AnnotationDraft, Task from tasks.tests.factories import ...
0547c89a5261759cc6762a78ed17379c348261f0aec119ea7221143e174c35e7
Python
36,884
915
"""Tests for backend system and cross-backend numerical equivalence. These tests verify that: 1. The backend switching mechanism works correctly 2. NumPy and PyTorch backends produce numerically equivalent results 3. All core computational functions work with all backends 4. torch_cuda and torch_mps backends (when ava...
121f6eb5b7b44c916ad85f423b7b1c905226c93bd4d79b00115d96fbbeffc6a7
Python
36,885
866
"""Functions to estimate average cell densities of various cell types in brain regions based on measurements from the scientific literature. Known density values are used to perform a linear fitting for each cell type of interest in the following three groups: - isocortex - cerebellum - the rest The cerebellum was s...
22391ca9a4b1931a356e11430e88e3d1a5ff1e14f5a2bc4667d1d58384f4dde0
Python
36,893
839
import sys import copy import math from PyQt5 import QtGui from PyQt5 import QtCore from PyQt5 import QtWidgets import inspect from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import \ NavigationToolbar2QT as NavigationToolbar from matplotlib....
0c0d75a10868c75a3fa8673dfbfa320509988080333f624ed212a30fe3ae52f4
Python
36,894
870
import os import numpy as np import importlib from jinja2 import FileSystemLoader, Environment from lava.magma.core.run_configs import Loihi2SimCfg from lava.magma.core.run_conditions import RunSteps # Import Brian2 modules # from brian2.units.allunits import second # from brian2.core.functions import Function # from...
951f2acbc5990b42d2417a380ee12c861111af4cf1f7352e1ce3b1aaac8a4654
Python
36,961
976
"""Base class for MultiDiGraph.""" from copy import deepcopy from functools import cached_property import networkx as nx from networkx import convert from networkx.classes.coreviews import MultiAdjacencyView from networkx.classes.digraph import DiGraph from networkx.classes.multigraph import MultiGraph from networkx....
37db89f100df95c3a1f563a21b4f48d505f5ae8df64770b92c84b22580b92a91
Python
36,967
977
import numbers from typing import Optional, Union import torch from .. import base, functional, surrogate from .base_node import BaseNode, NonSpikingBaseNode, SimpleBaseNode __all__ = [ "SimpleIFNode", "IFNode", "HalfThresholdIFNode", "ActivationAwareIFNode", "NonSpikingIFNode", ] class SimpleI...
a7eb30da1a6db197024cb13b6dc7dd398cb9baa49631059877ee923413b446a0
Python
36,990
911
# -*- coding: utf-8 -*- # Imports import pandas as pd import numpy as np import dill from gpytorch.priors import GammaPrior from .models import GP_Model from .base_models import fast_computation from .init_scheme import Init from .objective import objective from .acq_func import acquisition from .plot_utils import...
db1b1d37252b0aa8d7305625365eedf2dca321a5ef94e93a38b93926bb8b599d
Python
37,058
922
#!/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 Adapter from ax.adapter.data_utils import ( ...
27b80505c0e7720517217f1296e2f97b88fe34c1e6d6f5c6defffc7c30447232
Python
37,090
917
import logging from collections.abc import Callable from datetime import datetime from enum import Enum from typing import ( cast, NamedTuple, Optional, Union, ) from urllib.parse import urlparse from pydantic import ( BaseModel, ValidationError, ) from sqlalchemy import ( and_, delete,...
cc1826cc8613e9a01cb6e30846615a2e7cc2de2cf81b1ee3e4d8f899d62a47e0
Python
37,111
1,291
# -*- coding: utf-8 -*- """ FileList ======== Module to handle sources distributed over a list of files. File lists ar specified using a :mod:`~ClearMap.Utils.TagExpression`. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)' _...
6a3bfe3e3d277fea94fc791201e9b10e1db20d84053afc319d421733191edd56
Python
37,132
1,044
from __future__ import annotations from collections.abc import Mapping from functools import reduce from itertools import chain, pairwise from typing import TYPE_CHECKING, cast import numpy as np import pandas as pd from h5py import Dataset from testing.anndata._doctest import doctest_filterwarnings from ..._core.a...
e99a03b18c6b3de75b7a634b16ffb1d56d4be0175c4d4478b30320573f5cefd1
Python
37,242
998
from __future__ import print_function import matplotlib as mpl mpl.use('TkAgg') from mpl_toolkits.mplot3d import Axes3D import BBStaticDialog as BBDialog import Tkinter as tk import tkFileDialog import ttk from Tkinter import TclError from tkColorChooser import askcolor import matplotlib.pyplot as plt...
1f9c06cbbc289b527b56e0d8e04671e8c3f6ab06ef837d3eaaf91c3e91e927cf
Python
37,250
942
import os import pathlib import random import shutil import tempfile from shutil import rmtree from typing import Generator, Iterator, List, Tuple import anndata.tests.helpers import feather import numpy as np import pandas as pd import pytest import skimage.io as io import xarray as xr import numba as nb import test_...
39638f278546638de7b1aeaeeb31e05ca8ce1a60e62f8d8afac641c2515a0835
Python
37,315
992
""" Base classes for Galaxy AI agents. """ import asyncio import fnmatch import logging import os import random from abc import ( ABC, abstractmethod, ) from collections.abc import ( Callable, Sequence, ) from dataclasses import ( dataclass, field, ) from typing import ( Any, Literal, ...
e409399d0c3d2f0fe781ea5ec3a54b35f30a3351f311bb25a85959b4d31245f7
Python
37,333
1,019
""" Provide basic convenience data types. Most classes are based on PyTables and HDF5 dictionaries, allowing on-disk storage and therefore processing of large files. Other features include indexing and querying. """ from __future__ import division import logging import os import shutil import tempfile import warning...
49429e7d3f09e5c5d1a7b2b3ad1d2085d85a092fb79b928a81a188b37f14e452
Python
37,334
1,236
from typing import Optional import torch from spikingjelly.activation_based import surrogate from spikingjelly.logger import logger from ..layout import _empty_like from ..surrogate_dispatch import resolve_sg_triton_id_and_alpha, sg_triton from ..triton_layout import ( _block_minor, _check_mp_cuda_inputs, ...
ddc9f1bbab5f0606c877f5a48c0899b294036be1fab3642433d900a5a45fff09
Python
37,349
1,018
import datetime import json from collections.abc import Callable from concurrent.futures import TimeoutError from functools import lru_cache from pathlib import Path from typing import ( Any, Optional, ) from urllib.parse import urlparse from celery import current_task from sqlalchemy import ( and_, cr...
81d5a0dddedf0989958798aad506da9dd2f5f6d106a8c3eb20e19c8c40095cb4
Python
37,370
1,150
""" Proteomics Datatypes """ import logging import re from typing import ( IO, Optional, ) from galaxy.datatypes import data from galaxy.datatypes.binary import Binary from galaxy.datatypes.data import Text from galaxy.datatypes.protocols import ( DatasetHasHidProtocol, DatasetProtocol, HasExtraFi...
b7275ae4fd63205f5864cdefdef6a54d63265bd141e217e5deefec93299662c4
Python
37,380
866
#!/usr/bin/env python # # Copyright (c) 2015 10X Genomics, Inc. All rights reserved. # from collections import defaultdict, OrderedDict, namedtuple import cPickle import h5py import tables import itertools import json import math import random import numpy as np from cellranger.feature_ref import FeatureReference, Feat...
704134bb91d8cbf6a88d12b73779467ebe19915464da308a449e11a5fb10eb68
Python
37,384
914
import copy from collections import Counter, defaultdict from itertools import combinations import os import pickle import numpy as np import pandas as pd from scipy.stats import spearmanr, pearsonr from scipy.special import softmax from scipy.optimize import minimize from sklearn.impute import KNNImputer from sklearn....
c74fd3f8d9fc29b5b1ffb6a8696c4dc0ba4234d4bd4aaf0e3b940348bc547ea5
Python
37,384
814
import os import re import torch import numpy as np from .dual_position_bert_model import DualPositionBertForPreTrainingPreLN from .utils import colored, OAG_TOKEN_TYPE_NAMES, stringLenCJK, stringRjustCJK from transformers import BertTokenizer import sentencepiece as spm class OAGMetaInfoBertModel(DualPositionBertFor...
e190bc5caa1a738d8b127d673af78c61a3753e4b38e4775bc1c60967a617d6e5
Python
37,396
962
from . import __version__ from .reporting import warn from .helpers import ConfigurableClass, get_qualified_class_name from .morphologies import Morphology, Compartment, Branch from .helpers import suppress_stdout from contextlib import contextmanager from abc import abstractmethod, ABC import h5py, os, time, pickle, r...
14ed6143550621134e6a3c7b362a60472aee52bd63f8fef072953030a294e06a
Python
37,431
1,359
import pytest from unittest.mock import patch import operator from nl_expr.exceptions import NeuroLangException from nl_expr.expressions import ( Symbol, Constant, FunctionApplication, ExpressionBlock, ) from nl_expr.logic.unification import most_general_unifier from nl_expr.logic import ( Implicat...
6c46e73025c6afa3c94392d6d24a50b99be0d330ef4098b1347c2dc4d0a49c70
Python
37,453
1,188
from typing import Optional import torch from spikingjelly.activation_based import surrogate from spikingjelly.logger import logger from ..layout import _empty_like from ..surrogate_dispatch import resolve_sg_triton_id_and_alpha, sg_triton from ..triton_layout import ( _block_minor, _check_mp_cuda_inputs, ...
4ac543533387c807f3257f4ec6482e2b92c5fbe7556b1a72534d04bf24576a1e
Python
37,460
1,002
from skimage import morphology, measure, io, util # For performing morphology operations (should maybe import more from skimage...) from mpl_toolkits.mplot3d import Axes3D # Plotting in 3D import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab imp...
bbf68839ba89f5d7110ec56c20b10c3635911dd61e45f9fa4b9792bf92c6bb6d
Python
37,549
756
import random as rd import unittest as ut import networkx as nx from pysbm.sbm.inference import PeixotoInference from pysbm.sbm.nxpartitiongraphbased import NxPartitionGraphBased from pysbm.sbm.objective_function_iclex import * from pysbm.sbm.objective_functions import TraditionalUnnormalizedLogLikelyhood def gener...
f5d782bd300e5c7ad91aa1a695cf0907c9cca67e801dbeb4b03c656a508b333f
Python
37,598
931
""" Modified from pygenometracks. LICENSE: https://github.com/deeptools/pyGenomeTracks/blob/master/LICENSE """ import logging import os import pathlib import time import warnings from collections import OrderedDict from configparser import ConfigParser import matplotlib import matplotlib.cm import matplotlib.colors ...
f5d89b6ea02cae8023f05ba2937c93f665567b01f2e2c9e63a6812e07e8e507e
Python
37,614
952
""" Created on Jun 12, 2018. This module implements generalized linear mixed model via encapsulating R. @author: voodoocode """ import numpy as np import warnings import gc import rpy2.robjects as ro import rpy2.robjects.numpy2ri import rpy2.rinterface_lib.embedded import rpy2.robjects.conversion as conv def che...
2bd30388f6c272980c1955c9c81ce7e673f1ece9dfbb85387ca7479e088da4f8
Python
37,643
1,060
# -*- coding: utf-8 -*- """ Resampling ========== This module provides methods to resample and reorient data. Resampling the data is usually necessary as the first step to match the resolution and orientation of the reference object. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ ...
2b7031fc1e87364396d714beda85a24465786358672afe0726e56b8765073bed
Python
37,725
1,225
from copy import deepcopy from dataclasses import dataclass from typing import ClassVar, Optional import torch import torch.distributed as dist import torch.nn as nn from torch.distributed import ProcessGroup from .. import functional, layer, memopt, neuron from ..distributed.tensor_parallel import ( ChannelShard...