sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cd9fb7e7b014d41b5646b5d95d655c9f31d658640b2a95856fa65ff5c45f054e
Python
18,499
446
#!/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 Sequence from typing import Any from ax.core.optimization_config import M...
828ea238d2939464287fe006db8a568f3245fb992aead4b2893127100502e96f
Python
18,501
520
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
aa53fd3ae998c6026061b99a867424e8023298d39d5d0da1d29e8b5eb09a9a6f
Python
18,510
473
""" Created on 15/07/2014 @author: Andrew Robinson Modification on 24/10/2022 Addition of LDAP3 auth provider using the ldap3 module. The original LDAP auth provider uses the python-ldap library which has external dependencies like openldap client libs. ldap3 is a pure Python LDAP v3 client library. @author: Mahend...
23fc1ea7fcb531af73ae4c28d8fc7f70f11a289df36ed840b1c37dc6a1b85a8a
Python
18,519
437
"""This module is responsible for converting between Galaxy's tool input description and the CWL description for a job json.""" import json import logging import os from enum import Enum from typing import ( Any, NamedTuple, Optional, ) from galaxy.exceptions import RequestParameterInvalidException from g...
066f7d03438fecc427835105af97f089ba998b1ca81bf838182bf221d835aa76
Python
18,526
489
import torch.nn as nn import torch import torch.nn.functional as F from torch.autograd import Variable import torch.optim as optim import dgl from dgl.nn import GATConv from blitz.modules import BayesianLinear import math, random import numpy as np class ConvLSTMCell(nn.Module): def __init__(self, input_dim, hidd...
185e057094a1704b0be9195d8e285eb60355a1649ed69f349e68ead1d350d89e
Python
18,527
429
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Shang et al "Edge Attention-based Multi-Relational Graph Convolutional Networks" -> https://github.com/Luckick/EAGCN Coley et al "Convolutional Embedding of Attributed Molecular Graphs for Physical...
a3446f8cf0dfb09139f94b38a1c9d6bcbd1e475b1dc7a747a5afff9e4e136bd0
Python
18,533
352
# -*- coding: utf-8 -*- """ Created on Mon Jul 29 14:07:09 2019 @author: schelskim """ from .generaltools import generalTools import sys import os import numpy as np import pandas as pd from skimage import io from skimage import morphology as morph from scipy import ndimage from skimage import measur...
ba5c3db9fd234bd81043a68ecb02c9fc27d1e59bd569e05b0db0da01a3ee6637
Python
18,547
473
# 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...
c9711f18aa2aae1a0fb8039fa2239e634cbacee783d050fdf93c5edf56c2f1eb
Python
18,566
568
import abc, numpy as np, pickle, h5py, math, itertools from .helpers import ConfigurableClass from .voxels import VoxelCloud, detect_box_compartments, Box from sklearn.neighbors import KDTree from .exceptions import * from .reporting import report class Compartment: """ Compartments are line segments with a r...
fd8afb30e93bf6bea04beea9a8dfede35ebe017659f523c899c1391859d72769
Python
18,573
496
"""Utilities to help job and tool code setup jobs.""" import json import os import shutil import threading from typing import ( Any, cast, NamedTuple, Optional, Union, ) from galaxy.files import ( ConfiguredFileSources, DictFileSourcesUserContext, FileSourcesUserContext, ) from galaxy....
4098a65f3aad40d1f7e1e192fa47d884ad9049442f6aea3ea1f8aaa032aa548c
Python
18,593
289
import multiprocessing import os from typing import Optional, Tuple, Union try: from typing import Literal except ImportError: from typing_extensions import Literal import numpy as np import pandas as pd from simba.mixins.geometry_mixin import GeometryMixin from simba.plotting.geometry_plotter import Geometr...
4e67793c6c99e32cba1ff0f24f148a78d3423a6d82185555fcb951fe4c8f5896
Python
18,632
564
import jax import jax.numpy as jnp import logging from functools import partial from typing import Generator import itertools import numpy as np log = logging.getLogger() def angular_momentum_xyz(ell: int) -> Generator[tuple[int, int, int], None, None]: for lx in reversed(range(ell + 1)): for ly in rever...
6e431574f931881fd5e209f014b75a1453c19c7efdace5218b19c1ff27c8f064
Python
18,645
564
"""Provide utility functions for the main experiment. Only functions that do not need a direct psychopy import. main file: sp.py other utilities: psychopy_utils.py """ import os.path as op from collections import OrderedDict from time import perf_counter import numpy as np import pandas as pd tr = None # noqa: E4...
ef7fa958fa55ffd9bd6b48789e6fbba72d808073e1e996ff12a3553e23906538
Python
18,645
506
import itertools import pytest import networkx as nx from networkx.algorithms import flow from networkx.algorithms.connectivity import ( local_edge_connectivity, local_node_connectivity, ) flow_funcs = [ flow.boykov_kolmogorov, flow.dinitz, flow.edmonds_karp, flow.preflow_push, flow.short...
7bdb2f2121d25e80ea9915909f56a36002496d80b2cedc5151155a2d7a3b677b
Python
18,646
491
"""A more modern version of the S3 object store based on boto3 instead of boto.""" import logging import os import re from typing import ( Any, Callable, ClassVar, Dict, Set, TYPE_CHECKING, ) from typing_extensions import ( Literal, NotRequired, TypedDict, ) if TYPE_CHECKING: ...
3c954bed6493ff9c5d2989670b02eede1c1abadbc9c436ae01415d779a46e2ba
Python
18,657
534
""" Classes for wrapping Objects and Sanitizing string output. """ import copyreg import inspect import logging import string from collections import UserDict from collections.abc import Callable from numbers import Number from types import ( BuiltinFunctionType, BuiltinMethodType, CodeType, FrameType,...
910e45e5c855069e687dd18d720c42e6169647ca759416bcacd0619936615097
Python
18,665
526
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
98c1b076198f03f0c1ef2225057f0e5df2feb7381a51bde552427f244c83c30a
Python
18,676
561
# ---------------------------------------------------------------------------- # train_multilayer_perceptron.py # Author: Antoine Beauchamp # Created: December 15th, 2020 """ Train a multi-layer perceptron Description ----------- This script trains a multi-layer perceptron neural network to classify mouse voxels int...
6fac5ceba337e717e26d3d099376a711696d0d8d8815c3b6eabf9484b627ea14
Python
18,709
417
#!/usr/bin/env python3 import os import numpy as np import time import torch from torch import optim # -custom-written libraries import utils from utils import checkattr from data.load import get_context_set from data.labelstream import SharpBoundaryStream, RandomStream, FuzzyBoundaryStream from data.datastream import ...
ff10a3af4bc9649898486d6c810e97a0afa58c1d051bd6550565eefc9fbb445c
Python
18,713
484
import pathlib import subprocess from collections import defaultdict from concurrent.futures import ProcessPoolExecutor, as_completed from math import ceil import numpy as np import pandas as pd import scipy.sparse as ss import xarray as xr from .._allc_to_region_count import batch_allc_to_region_count from .._doc im...
a79bd5ef49bccc9b57de71fda2c746f5e12fcbe8eca9f44b79f133d9375a225e
Python
18,719
369
import function as func import numpy as np import pandas as pd import matplotlib.pyplot as plt import pdb import os import math import pysam import sys import random import lockfile from time import sleep ## Variables global_var_dict = func.global_variables() SAMPLE = global_var_dict['SAMPLE'] CNV_CHR ...
da0d4bc17639c97114ea0f05618bbc98a5a61405e3fb484a434b16e3609476ca
Python
18,753
422
import abc import logging import os import shutil from typing import ( NamedTuple, Optional, Union, ) from sqlalchemy.orm import Session from sqlalchemy.orm.exc import DetachedInstanceError from galaxy.datatypes.sniff import ( convert_function, FilePrefix, should_convert_text, stream_url_t...
f793f2e9193586be51cf505f300c57ded63a3a673ea8c7daafc2cd8ae8dfa147
Python
18,760
478
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 14 23:47:22 2022 @author: wirrbel """ import nrrd import os import json import matplotlib.pyplot as plt import numpy as np from scipy.ndimage import gaussian_filter import tifffile import sys sys.path.append('../cortical_flatmaps/ccf_streamline...
35ffaeb1d4d91c590eaa71f04e38108c99509268ae4c82e5541a8c0b2f863205
Python
18,762
565
#!/usr/bin/env python # how to use this function... # PYTHONPATH=lib python lib/galaxy/model/dataset_collections/types/semantics.py import argparse import ast import os import re import sys from io import StringIO from typing import ( Annotated, Any, Literal, NamedTuple, Optional, Union, ) imp...
d2f1503b744225a069cd7be74337566bfa982c7368fc8f432026213d924d50c9
Python
18,777
528
from collections import UserDict import pytest import networkx as nx from networkx.utils import edges_equal from .test_graph import BaseAttrGraphTester from .test_graph import TestGraph as _TestGraph class BaseMultiGraphTester(BaseAttrGraphTester): def test_has_edge(self): G = self.K3 assert G....
aa7b2ea0b8348b4bc84417b6eb4f5d8461e91039b6a4ef130c93737e09d3474e
Python
18,797
413
""" Plot Figure 7 (Network) """ import numpy as np import pylab as pl import strinf as si from strinf.plotting import truncate_colormap # # # PARAMETERS # # # ZOOM = 1.5 SAVE = True SHOW = True PANEL = ("D", "G", "H", "I", "J", "M") # The sketches in A, B, C, E, F, H, K, L are always plotted. MT_tuning = { ...
dfb3a5a5f95772e3b54bf4569111596e24b8bba0290ddb9969dc8ce38d0998b6
Python
18,808
541
import copy import os from typing import ( Any, Callable, cast, Dict, Iterable, Iterator, List, Optional, Tuple, Union, ) from typing_extensions import ( get_args, Literal, ) from galaxy.tool_util_models.tool_source import JavascriptRequirement from galaxy.util import (...
c3c2e4ff5aef85a9924cebb59aa09f584fa81d8403091e20d1e5f789cf53982e
Python
18,822
533
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
a6c84487ca66347767c2b430fff9d02b3e7e7dc41a3322fb425d407a15ba2721
Python
18,832
379
# 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...
c119d1b71396ed5fb84c6984909d167b2a27326c916160dba5f96840fe88592b
Python
18,833
525
import logging import os from collections import defaultdict from collections.abc import Callable from datetime import datetime from typing import ( Any, NamedTuple, Optional, Protocol, ) from galaxy import exceptions from galaxy.files.sources import ( BaseFilesSource, PluginKind, ) from galaxy...
849f92d7910e356468e43e4839b328b8dd1c781be07a4870297d5a05818b0048
Python
18,835
541
# -*- coding:utf-8 -*- __author__ = 'yangjian' """ """ import copy import pandas as pd import pickle from deeptables.models.config import ModelConfig from deeptables.models.deeptable import DeepTable from deeptables.models.preprocessor import DefaultPreprocessor from deeptables.utils import dt_logging, fs, consts as...
49f5e435223de6a49ae85fc7dbcd1ec2506b44745b73bc95ae9c30551dabb46f
Python
18,839
415
import math import numpy as np import random import torch from torch.optim.optimizer import Optimizer from torch.nn.utils import parameters_to_vector, vector_to_parameters import torch.nn as nn import torch.nn.functional as F from models.fc import excitability_modules as em ## This code has been based upon: https://g...
8cc5642f57bbe873310f924e4f7486f11a41d43e20b74e47ea41a8af2583ac65
Python
18,839
508
#! /usr/bin/env python3 ### Get the FES estimate from reweighting. 1D or 2D only ### # uses a weighted kernel density estimation, so it requires the bandwidth sigma # usage is similar to plumed sum_hills # NB: in case of multiple walkers one should combine them in a single file # when using --stride or --skiprows one...
2c5d7d57b3792fae12fc400e9718a70a84e3bfeec9a0d3ffb2c725117fb78590
Python
18,845
625
import base64 import copy import json import numpy as np import pytest from zarr.codecs import Blosc, Delta, Pickle, Zlib from zarr.errors import MetadataError from zarr.meta import (ZARR_FORMAT, decode_array_metadata, decode_dtype, decode_group_metadata, encode_array_metadata, ...
63f21ba363342a4b5dc11ef57951ce2f6d50c40cc822a44142d53f4e665045f6
Python
18,846
464
# 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...
a99c46f2e4c1a8da9d6cd7c51a225b1b63123751468579c83e478a7a65956748
Python
18,850
423
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 14 02:13:31 2022 @author: wirrbel """ # We begin by adding the current path to sys.path to make sure that the imports work correctly import sys sys.path.append('/home/wirrbel/brainrender_update_2022-01/') import os import pandas as pd import numpy ...
904a0fed7a47bd39b8bdce88648fc90a0b35947ef2616831f90c449c83fbe2dc
Python
18,857
464
"""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.""" from enum import Enum from typing import Any, List, Optional, Union from django.conf import settings from pydantic import BaseModel, Field, Strict...
d2ff19c136628c98587b689b4cd14fd6603bd367ca8b6511da9d00e5dc03c709
Python
18,865
524
"""Cell-aware tiling for large images. Splits a label image into overlapping tiles such that every cell is fully contained in exactly one tile. Cells are assigned to tiles by centroid: the tile whose non-overlapping base region contains the centroid owns the cell. Non-owned cells are zeroed out in each tile's mask s...
43f9b23a0d74ba6331bfcf851798e32b7eb5914f14edfe2c4c991475c4564ad0
Python
18,873
476
import random import time import numpy as np import scipy.sparse as sp import torch import torch.nn as nn import torch.nn.functional as F from tqdm.auto import tqdm from ..base import InjectionAttack, EarlyStop from cogdl.utils.grb_utils import eval_acc, feat_preprocess, adj_preprocess, getGraph, getGRBGraph class T...
38e01b8697a0bc4c7adcf73bc184ee6cac8a51aa94493b4be7f6537ff776242d
Python
18,875
459
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict from __future__ import annotations import warnings from typing import cast, TYPE_CHECKING import num...
6235f16fd00cf5043f60e3a0073841d85062f1e5fced50e3460b9259e8111b2a
Python
18,904
383
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
43b8a0dcd3ed5b11bc52a22ebb3c6e6b732fea5a8d0e95225dd1d9a1e96242b7
Python
18,907
575
from __future__ import annotations from contextlib import contextmanager from copy import deepcopy from functools import reduce, singledispatch from importlib.util import find_spec from typing import TYPE_CHECKING, Literal import numpy as np import pandas as pd from pandas.api.types import is_bool_dtype from scipy im...
8343ee6eb7c6cd68cb12d74da5ca7dda0e61841872eb4c39e71f7c96f6d80e5e
Python
18,910
577
import collections import operator from typing import AbstractSet, Iterable import numpy from nl_core.relational_algebra import str2columnstr_constant from ..datalog import WrappedRelationalAlgebraSet from ..datalog.expression_processing import ( EQ, UnifyVariableEqualities, conjunct_formulas, extrac...
520a6b48527a7146cf5ec7aedb8fae39cd7ae290a4bbe4111b4f8022e835849b
Python
18,917
417
import statsmodels.api as sm import statsmodels.stats.outliers_influence as sm_diagnostics import statsmodels.stats as sm_stats import matplotlib.pyplot as plt import scipy as scipy import pandas as pd import seaborn as sns import os # https://www.statsmodels.org/dev/examples/notebooks/generated/regression_pl...
938abd44c09701baa2693fbca5ddfdc19a6a8070d14137b004fd3edb5ed1309f
Python
18,947
438
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Shang et al "Edge Attention-based Multi-Relational Graph Convolutional Networks" -> https://github.com/Luckick/EAGCN Coley et al "Convolutional Embedding of Attributed Molecular Graphs for Physical...
17a5874b05dd420a3dc9299f782b4deeec611c2d676910902821fd94529f5e31
Python
18,951
533
""" This file is modified from methylpy https://github.com/yupenghe/methylpy. Author: Yupeng He Notes added on 07/03/2022 - Difference between bismark and hisat-3n Read mpileup doc first: http://www.htslib.org/doc/samtools-mpileup.html For Bismark SE mapping: Bismark converted the reads orientation based on their co...
950c3036b508e85a67fbd476fe1af4bdf895922b89314ea800d64b48810e3416
Python
18,972
525
import sys sys.path.append('../') import pyedflib import utils from data.data_utils import * from constants import INCLUDED_CHANNELS, FREQUENCY from utils import StandardScaler from torch.utils.data import Dataset, DataLoader import torch import math import h5py import numpy as np import os import pickle import scipy i...
9c66b8493e720fc19af3b7f3e7a1e61c1b9c498e51afb5dd975482da7fa3ed69
Python
18,979
466
import unittest, os, sys, numpy as np, h5py, importlib sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from bsb.core import Scaffold from bsb.config import JSONConfig from bsb.simulators.nest import NestCell from bsb.models import Layer, CellType from bsb.exceptions import * def relative_to_tests_f...
481a3586b00b38d06a82e20a6d9dd2e0e4fd127356705c9f1d199aa75897dacc
Python
19,008
489
import numpy as np import warnings import math from tqdm import tqdm from skimage.measure import regionprops from skimage.draw import polygon from csbdeep.utils import _raise, axes_check_and_normalize, axes_dict from itertools import product from .geometry import polygons_to_label OBJECT_KEYS = set(('prob', 'points...
64161ca714e8c89ed0631b3a6dac92e2e62df20ca290804b0b7b8595d90960a7
Python
19,042
553
import numpy as np from scipy import stats from scipy import sparse from scipy.spatial import distance from sklearn.utils.estimator_checks import check_estimator from hdbscan import ( HDBSCAN, BranchDetector, detect_branches_in_clusters, approximate_predict_branch, ) from hdbscan.tests.test_hdbscan impo...
3d9fefd368207ca0ad1a9eda29d7b9d6f3c7d4681bed573cb1c96c13772a2735
Python
19,047
499
#!/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 """ Module containing a registry of standard models (and generators, samplers etc.) such as Sobol gene...
69cc4d5f8d5d9f992ec2e27298d17ec7aed17d36c0a8f9fea77bad04d1d7cbf4
Python
19,048
412
# Protobuffer files handler # # Author : Michael Fonder # # This file contains the scripts necessary to encode some data samples into # protobuffer files (ProtoBufSerializer class) and to extract minibatches out # of a protobuffer database (ProtoBufDeserializer class). # # ==============================================...
68159e64f95560df8da93296a0e86421d27fb1d283a99279c14195f80fccb57f
Python
19,065
508
""" Some of the functions are modified from methylpy https://github.com/yupenghe/methylpy. Original Author: Yupeng He """ import gc import logging import os import resource import shlex import subprocess from concurrent.futures import ProcessPoolExecutor, as_completed import numpy as np import psutil from pysam impo...
df1378c3106cfbbab91bf55a1558e40b3004e67b3b01eee0f0f2c8f59ceda165
Python
19,073
535
""" Mask R-CNN Train on the nuclei segmentation dataset from the Kaggle 2018 Data Science Bowl Licensed under the MIT License (see LICENSE for details) Written by Waleed Abdulla Heavily modified by Carsen Stringer for general datasets (12/2019) ------------------------------------------------------------ Usage: impor...
fe45bf02a09e0317a3253649656820a6f53b6871df9aa552562d30d604c02342
Python
19,076
600
"""Basic algorithms for breadth-first searching the nodes of a graph.""" from collections import deque import networkx as nx __all__ = [ "bfs_edges", "bfs_tree", "bfs_predecessors", "bfs_successors", "descendants_at_distance", "bfs_layers", "bfs_labeled_edges", "generic_bfs_edges", ] ...
d2727031b24a46bf4a1c93897a55952e8c5377f12aa78991681ec137e6694b70
Python
19,089
411
import tensorflow as tf from tifffile import TiffFile as TIF import numpy as np import os import matplotlib.pyplot as plt import scipy.ndimage from src.factory import Factory,Kernel import copy from astropy.convolution import Gaussian2DKernel from src.utility import get_root_path from astropy.convolution import Gaussia...
29f4d5db56cc6f9dfc05e2c67e44649086df56947f46d54c62526856a38dfea9
Python
19,093
405
import pandas as pd import numpy as np import pickle from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import Descriptors from rdkit.Chem import rdMolDescriptors from rdkit.Chem.Draw import IPythonConsole from rdkit.Chem import Draw from rdkit.Chem.Draw import rdMolDraw2D import kerastuner...
cd135ba4a41438f6704f257e427373c05f225783924b7914eec6fb81268de7a8
Python
19,105
528
import argparse import os import sys import glob import pandas import numpy import nipy.modalities.fmri.hrf import matplotlib.pyplot as plt from nipy import load_image from subprocess import call from nipy.core.image.image import Image from nipy import save_image import scipy.stats from scipy.ndimage import convolve1d ...
1514f544ae4945ce993c1854225c74d13263e6300b6821995d783e454482ea1b
Python
19,117
458
from copy import deepcopy import numpy as np import xarray as xr from skimage.draw import disk def generate_test_dist_matrix(num_A=100, num_B=100, num_C=100, distr_AB=(10, 1), distr_random=(200, 1), seed=None): """ This function will return a random...
a5a0285f3884456fc7e841e211393298cccec2b82a336fde7999fae4ddafa9ea
Python
19,147
475
from __future__ import annotations import warnings from collections.abc import Hashable, Mapping, Sized from dataclasses import dataclass from functools import wraps from typing import TYPE_CHECKING, overload import numpy as np import pandas as pd from anndata._warnings import warn from ..compat import XDataArray, ...
8f84bb0b3dac337a3df56e9529fcd45dc34883d7a4570c5aeb76e26f8fff8aad
Python
19,156
556
# -*- coding: utf-8 -*- """ Functions for calculating DDLS """ import math import time import warnings import cv2 import matplotlib.pyplot as plt import numpy as np import pandas as pd import tools.image.post_processing as pp warnings.filterwarnings("error") def point_on_circle(center, radius, angle): ''' ...
052dcd8d51855b1c0932f0cb05b26e817e5fb88bbe7e3790adab08df75951e9e
Python
19,168
578
import re import sys import os import math from numpy import * output= open(r'E:\OneDrive\学术\博士论文\fig\Part 2\co-expression\SPTBN2 matrix.txt','w+') p2 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] p3 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] p4 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],...
227ca77746e233ef8a138a74676bbcd69a3f5b35de06cb97fec7babea8735c57
Python
19,172
618
# -*- coding: utf-8 -*- # Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib from scipy.stats import spearmanr from scipy.cluster import hierarchy from .math_utils import model_performance from .pd_utils import to_torch # Scatter plot for pred-obs def plot2d(x,y,expor...
6627aa2efae116564d5901a8b59354def0baec91fe582fbbc92d09ed57fb6bfb
Python
19,175
467
"""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 logging import os import uuid from collections import Counter import ijson import pandas as pd try: import ujson as json except: # no...
89c73dcbe3777034344a936fb1417407d69dfad44d652048d7a2b1b20734a3be
Python
19,184
392
""" Contains library functions """ import json import logging import os.path from markupsafe import escape from galaxy import ( exceptions, util, ) from galaxy.managers.collections_util import ( api_payload_to_create_params, dictify_dataset_collection_instance, ) from galaxy.model import ( Histor...
263226ba7dc8e1b352bb0a5efa1ddee8fb96c6f9a430ae438869528e162a950e
Python
19,185
589
""" Provides utilities for working with GFF files. """ import copy from bx.intervals.io import ( GenomicInterval, GenomicIntervalReader, MissingFieldError, NiceReaderWrapper, ParseError, ) from bx.tabular.io import ( Comment, Header, ) from galaxy.util import unicodify FASTA_DIRECTIVE = ...
68a7d63941e44f4a91573ce10e08d4f10a80f01ec6869b1456eff319ce6fb387
Python
19,199
466
import logging import os import shutil import tempfile from contextlib import contextmanager from datetime import datetime from typing import ( Any, Iterator, Optional, ) from galaxy.exceptions import ( ObjectInvalid, ObjectNotFound, ) from galaxy.objectstore import ConcreteObjectStore from galaxy....
677b12e5efa465a9665c6f628a891445913b1b4bc6a2769f2012a3ca097f6c1e
Python
19,217
488
# 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...
a136ea7f1f5fd2c5fd7f2854b9ce9e07276be1b3abf639cb26cb8e87f47fe5e4
Python
19,241
658
import pytest import sys import shutil import json from pathlib import Path from bids import BIDSLayout, BIDSLayoutIndexer from clpipe.bids import get_bids import nibabel as nib import nipype.pipeline.engine as pe from nilearn import plotting from nilearn.image import load_img, index_img sys.path.append("../clpipe")...
8bf745c2d4d2e20be03be68403031b966ab802dddf34dad044a35031e4688b9d
Python
19,245
467
import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import spatial_lda.visualization as sv from alpineer import misc_utils from ark.utils.spatial_lda_utils import make_plot_fn def draw_boxplot(cell_data, col_name, col_split=None, split_vals=None, dpi=None, sa...
251e8475e75c33c943d0bd1384e74c66a15d667b46e23153403544e5774bf5b9
Python
19,261
540
import itertools import itertools as it import time import typing import arbor import numpy as np from arbor import units as U from bsb import ( AdapterError, Chunk, SimulationData, SimulatorAdapter, UnknownGIDError, report, warn, ) if typing.TYPE_CHECKING: # pragma: nocover from .sim...
7afcfb2dcbaa84c33bbff5a8aa6912d2f942ba476d967c941f5932d3e1e74573
Python
19,263
381
''' The script to test trained models ''' import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "0" import numpy as np import torch from torch.autograd import Variable from matplotlib import pyplot as plt import pickle as pkl from torch.optim import Adam from tqdm import tqdm impo...
6f4397b4abd4606cc3c41ae721b3e1f00defa378e6458385cd6d36315496620a
Python
19,320
678
import pytest import networkx as nx def test_square_clustering_adjacent_squares(): G = nx.Graph([(1, 2), (1, 3), (2, 4), (3, 4), (3, 5), (4, 6), (5, 6)]) # Corner nodes: C_4 == 0.5, central face nodes: C_4 = 1 / 3 expected = {1: 0.5, 2: 0.5, 3: 1 / 3, 4: 1 / 3, 5: 0.5, 6: 0.5} assert nx.square_cluste...
42b5c247652486fdcf3563ae211883380f0f24b0279be814e174d6a0015985d6
Python
19,333
476
#!/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 import os import random import string from unittest.mock import patch import sqlalchemy...
c075a7e0556e5a2f7a46bd6f052b7959ff2b61e19eaae3f62ef2884d758b4dd7
Python
19,361
601
from typing import Any, Callable, Dict, Optional import torch import torch.nn as nn from .. import functional, layer, neuron, surrogate from .._neuron import _make_multi_step_neuron __all__ = [ "MSResNet", "MaxResNet", "ms_resnet18", "ms_resnet34", "max_resnet18", ] def _conv3x3(in_channels: in...
3b030dd3a7f6bf86d5f765d8218283edf65cdc39c0c9eb93b93176a3ffa2350d
Python
19,366
618
from collections import Counter import pytest import networkx as nx from networkx.algorithms.planarity import ( check_planarity_recursive, get_counterexample, get_counterexample_recursive, ) class TestLRPlanarity: """Nose Unit tests for the :mod:`networkx.algorithms.planarity` module. Tests thr...
cc70de8fabec736937dd1fa1471118968888f6a4acb5dbae291982add216e3cf
Python
19,369
559
# -*- coding: utf-8 -*- """models Defines network models using PyTorch .Module inheritance """ # Contributions and Changelog accessed via a private git repository: # https://github.com/philipwijesinghe/deep-learning-lsm.git # philip.wijesinghe@gmail.com # Copyright (c) 2020 Philip Wijesinghe@University of St Andrews...
89be34f62f8aac0d0751e33ff0527f71c30e3e85338caee920432757ef62a89f
Python
19,373
547
import base64 import itertools from collections.abc import Mapping import numcodecs import numpy as np from numcodecs.abc import Codec from zarr.errors import MetadataError from zarr.util import json_dumps, json_loads from typing import cast, Union, Any, List, Mapping as MappingType, Optional ZARR_FORMAT = 2 ZARR_F...
69b9be293b60e3b757f53f2816db98e2aa80373744a2cb5c0380f7872e6a2229
Python
19,382
396
# -*- coding: utf-8 -*- """ Created on Wed Feb 22 21:41:28 2022 @author: Zhiye """ from six.moves import range import keras.backend as K from keras.engine.topology import Layer from keras.layers import Input, Dense, Reshape, Activation, Flatten, Dropout, Lambda, add, concatenate, Concatenate, Add, average, ...
6eb3585f2b71968015845af437b0c25a734a92c6cead65faa8a113c2d5ba7178
Python
19,386
610
from ast import Index import numpy as np from scipy import stats import torch from torch.optim.lr_scheduler import LambdaLR import math import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data.sampler import SubsetRandomSampler import torchvision import torchvision.transfo...
dfb26d6c7f96ebbff61a54b1ac51fb5963b0c255b442b262aea7f52c056207de
Python
19,392
427
import numpy as np import matplotlib.pyplot as plt from PIL import Image from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True import ptitprince as pt from meld_classifier.paths import EXPERIMENT_PATH from meld_classifier.meld_cohort import MeldCohort import os import glob import pandas as pd from statsmo...
5e5cf3046c01edc0526cab37ac2cfd2ad37b37f88de2ca4b727e9e6a5f68d69d
Python
19,400
569
# ---------------------------------------------------------------------------- # mlp_validation_resampling.py # Author: Antoine Beauchamp # Created: February 3rd, 2021 """ Description ----------- """ # Packages ------------------------------------------------------------------- import sys import argparse import o...
d339e7a4ec556e17efd223ec2aebfd26f28a0a6fefa23fd8fba7f4a09dc06bf8
Python
19,410
434
"""Public, ``sdata``-aware entry points for stain normalization. The single integration boundary for the stain module: the only file that reads ``sdata.images[...]``, writes back via :class:`Image2DModel`, and is re-exported publicly. Everything it calls is a pure DataArray-layer primitive (:mod:`._reinhard`, :mod:`._...
4e5a01c9f7b7be1ec5c9872defb8ec9fbf88703731c080edbe6c8252a85de844
Python
19,428
517
import logging import os import h5py import numpy as np import pandas import cooler from genomic_regions import GenomicRegion from ..tools.sambam import natural_cmp from functools import cmp_to_key import tempfile import warnings from ..tools.files import tmp_file_name from ..tools.general import str_to_int import shu...
0404e119afcfb09ec58f28c70ca06f4970ce7562f811c8d8081d3843e3e10ea5
Python
19,438
534
import glob import json import logging import pathlib import subprocess import warnings from typing import Union import numpy as np import pandas as pd import xarray as xr import yaml log = logging.getLogger() def calculate_posterior_mc_frac(mc_da, cov_da, var_dim=None, normalize_per_cell=True, clip_norm_value=10):...
2dfd2e03ab2e5145a4b61bbf354f4b827fe6547def552bf1b61af51cbae865dc
Python
19,443
559
"""Optimisers eliminating, simplifying and pushing projections.""" from itertools import permutations from nl_expr import expression_walker as ew from nl_expr.expressions import Constant, FunctionApplication, Symbol from nl_expr.utils.orderedset import OrderedSet from ..relational_algebra import ( COUNT, Colu...
8ff06d9bace96e0083af0b7a4cf94f086be1e838679ff0e5f4aa181e4ed06359
Python
19,460
520
import pytest from django.contrib.auth import get_user_model from label_studio_sdk import LabelStudio from projects.tests.factories import ProjectFactory from tasks.tests.factories import TaskFactory User = get_user_model() class TestSDKPredictionValidation: """Comprehensive tests for prediction validation using...
f9dae833f8cc8c5c22364445492a8a62674b3a68bea65d79dc768676f64950a2
Python
19,473
425
import os import pandas as pd import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_validate from sklearn.svm import SVC from sklearn import metrics from sklearn.metrics import make_scorer, get_scorer from tqdm import tqdm import pprint import random import jso...
2ecf61387409ce16464861eb62cfaefa75f355c77d48f3360489b6996f38c8cf
Python
19,491
525
# 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...
7b786a7f4e8df949e9d09cc597672d44d213776c488266e9fb96087e50651353
Python
19,521
471
#!/usr/bin/env python # -*- coding:utf-8 -*- import argparse import numpy as np import voxelmorph as vxm import tensorflow as tf import neurite as ne import tensorflow.keras.backend as K #import tensorflow_scientific as tfs from voxelmorph.tf import tensorflow_scientific as tfs import os from skimage.metrics import st...
86d4abb316a9f6a3e666a11a1a26e861dedd4d4f2db13bec86ef0f3495d34251
Python
19,526
464
import torch import torch.nn as nn from torch.nn import functional as F from torch.nn.parameter import Parameter from torch.nn import Module from torch.nn.modules.transformer import _get_clones from torch.nn.modules.linear import Linear from torch.nn.modules.dropout import Dropout from torch.nn.modules.normalization i...
6c89b45345d3926d7061709a25a2a7d92191712ca72ab390521ecab2727b5577
Python
19,529
430
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np import warnings import math from tqdm import tqdm from csbdeep.models import BaseConfig from csbdeep.internals.blocks import unet_block from csbdeep.utils import _raise, backend_channels_last, axes_check_and_normaliz...
993e0050046f8de78e9cdd3d8d267022aed393c8db2c8184c9b6bba0333d75c9
Python
19,530
535
""" FSM utility functions. This module provides: 1. UUID7 utilities for time-series optimization (uses uuid-utils library) 2. FSM-specific helper functions for organization resolution and state management UUID7 provides natural time ordering and global uniqueness, making it ideal for INSERT-only architectures with mi...
ab97fe9a681e529175a963a17de03aac99e553645dd894485c347d61b5476d7f
Python
19,534
470
import json import logging import time from typing import ( Any, Optional, ) from urllib.parse import quote from galaxy import exceptions from galaxy.files import ( ConfiguredFileSources, FileSourcesUserContext, ) from galaxy.files.models import ( FilesSourceOptions, PartialFilesSourcePropertie...
74af8881a519682752b73228e73c57e8f4764a59ace3f72214d3ab87c2977d18
Python
19,536
479
import pytest import networkx as nx np = pytest.importorskip("numpy") pytest.importorskip("scipy") class TestLaplacian: @classmethod def setup_class(cls): deg = [3, 2, 2, 1, 0] cls.G = nx.havel_hakimi_graph(deg) cls.WG = nx.Graph( (u, v, {"weight": 0.5, "other": 0.3}) for...
7b67a11ecedc06e196cbd846c820625dbc6e0dedb80dc02b8cedffa26dfac571
Python
19,542
564
#!/usr/bin/env python # % brew vinstall samtools 1.0 # % brew vinstall samtools 0.1.19 # % brew vinstall samtools 1.1 # % brew env samtools 1.1 # PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/bin:/home/john/.linuxbrew/Cellar/samtools/1.1/bin:$PATH # export PATH # LD_LIBRARY_PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/...
cf4781a96591eaea8951b99eae086ab0de6519eb9f2c5f132121894a238a16be
Python
19,553
375
import argparse import logging import os import copy from collections import defaultdict from typing import List import numpy as np import torch from sklearn import metrics from torch.nn.utils.rnn import pad_sequence from torch.utils.data.dataloader import DataLoader from training.models import RNNClassifier from opera...
b3895e6822b05f82df76b37f371d98260f1e04ff10dabc2c34bae43289de5413
Python
19,572
625
# util.py # Authors: Jacob Schreiber <jmschreiber91@gmail.com>, Ivy Raine <ivy.ember.raine@gmail.com> # adapted from code written by Avanti Shrikumar from enum import Enum from operator import attrgetter import textwrap from typing import List import numpy as np from numba import njit from . import precompile clas...
27bb569b040136c88a595c69068c5583cb50f1077e93e3eb6efad1648b59c93a
Python
19,581
465
#!/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 pathlib from collections.abc import Callable from typing import Any import torch from ax.adapt...
cf6737e91bb5a145c4129a11cb79e381707f3ae257d27925bcb26c4cde992de9
Python
19,581
439
from typing import ( Optional, Union, ) from galaxy import model from galaxy.exceptions import RequestParameterInvalidException from galaxy.jobs.manager import JobManager from galaxy.managers.context import ProvidesUserContext from galaxy.managers.export_tracker import StoreExportTracker from galaxy.managers.h...