sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3e7c87ef483857b58b6c8bcbc4d7b3dee5cec367f95d2f2e25b5d0a1bc3507d9 | Python | 7,613 | 201 | #!/usr/bin/env python
"""Create a segmentation by thresholding a predicted probability map using Dask.
This script replicates the original behavior:
- It reads a predicted probability map from a Zarr container,
- Optionally reads a mask from another Zarr container,
- For each block (defined by a user\u2011... |
d9932bf1f9fd9b493bd30ffd8e0a1acc5f8d2882cd59bd77780f1483a78b480f | Python | 7,613 | 194 | from math import isnan as isnan
from numpy import abs as abs
from numpy import append as append
from numpy import array as array
from numpy import clip as clip
from numpy import cumsum as cumsum
from numpy import ones as ones
from numpy import sqrt as sqrt
from numpy import sum as sum
from numpy import transpose as tra... |
30310dd2cfd6dc6f683572a2cc8083a316c41213682093f63b08f67354351838 | Python | 7,616 | 245 | import tensorflow as tf
from tensorflow import keras
from keras import optimizers
from tensorflow.keras import layers
import numpy as np
np.set_printoptions(precision=5)
import matplotlib.pyplot as plt
import pandas as pd
pd.options.display.float_format = '{:,.5f}'.format
import scipy as sp
from scipy import stats
imp... |
c9d30f71dc36d0148eeace9bc7f4486dbdf5173ed87683a35f6ea42f0d8fc053 | Python | 7,617 | 184 | #!/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
from ax.core.search_space import SearchSpaceDigest
from ax.exceptions.core import ... |
73709435f0b271253e2adbc0e5cc044b5c40caaacff08bc62c416d519bca4165 | Python | 7,618 | 160 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import torchvision.datasets as dataset
import numpy as np
import os
import time
import utils_fun
from ResNet import Net
import config
import loss_fun
from sklearn.cluster import KMeans
from torchsampler.imbalanced imp... |
fa88fa59500e20ac0b09f5da4796a1d8e4bc23156e5b8ed77a1b506dd88bcab2 | Python | 7,619 | 224 | """
GreyReconstruction
==================
This morphological reconstruction routine was adapted from
`CellProfiler <http://www.cellprofiler.org>`_.
Authors
-------
Original author: Lee Kamentsky, Massachusetts Institute of Technology
Modifed by Christoph Kirst for ClearMap integration.
"""
__author__ = 'Christoph... |
44f73cf3660ce84ace2bdfc39a1b4b5660a56bc0048d52ea160cb9f61f053dac | Python | 7,621 | 246 | import tensorflow as tf
from tensorflow import keras
from keras import optimizers
from tensorflow.keras import layers
import numpy as np
np.set_printoptions(precision=5)
import matplotlib.pyplot as plt
import pandas as pd
pd.options.display.float_format = '{:,.5f}'.format
import scipy as sp
from scipy import stats
imp... |
ce44ae8a9af6aa9cd8da68393ee084b150f37d74fa51375d3219dd75f992a07c | Python | 7,632 | 166 | """
Module for the configuration node of the IO to molecular layer interneurons (MLI) ConnectionStrategy
"""
import numpy as np
from bsb import ConfigurationError, ConnectionStrategy, config, refs
from bsb.mixins import NotParallel
@config.node
class ConnectomeIO_MLI(NotParallel, ConnectionStrategy):
"""
BSB... |
dfe64c911afe63292c3e9247a84576861ff05340bb324e38d71243adf767d857 | Python | 7,633 | 212 | from __future__ import annotations
from typing import (
Annotated,
Literal,
Optional,
Union,
)
from urllib.parse import quote
import requests
from pydantic import (
AliasChoices,
Field,
)
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
RequestParameterInv... |
231b42877840cc0bdf8e4d0fd38cead0a1afc1adccd4da548fc08b05f20e1870 | Python | 7,634 | 174 | """
----------------------------------------------------------------------------------------
Copyright (c) 2022 - Michael Fonder, University of Liège (ULiège), Belgium.
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 F... |
26763d9ca354937fa66cafdcbd2a5fbed7bb37baf12068d5a1da338318b6c298 | Python | 7,634 | 222 | from typing import (
Optional,
Union,
)
from pydantic import TypeAdapter
from galaxy.datatypes._schema import (
DatatypeConverterList,
DatatypeDetails,
DatatypesCombinedMap,
DatatypesEDAMDetailsDict,
DatatypesMap,
DatatypeVisualizationMapping,
DatatypeVisualizationMappingsList,
)
f... |
d731d37ace269585fd9136d8e4869d0e70543161d13c10313d43f372162ef261 | Python | 7,635 | 238 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF import *
from FEF_visuomotor_alternatec import *
from FEF_contr... |
820cdeb7821cb996bf6d47ee00f20759492c9a83315297247dba1af2f21f74ee | Python | 7,639 | 168 | import os, sys, argparse, time
from multiprocessing import Pool
from tqdm import tqdm
from lib.common.util import is_file, is_dir, makedir_if_not_exists, check_contents, read_option_file, check_dirs
from lib.monomer_alignment_generation.alignment import *
# from lib.monomer_alignment_generation.rosettafold_msa_runner i... |
0e2745f3b93dcc96f20a32196182e49d4828b23eb5faf24ee2323313f6066c32 | Python | 7,643 | 252 | import logging
import os
import json
from fibsem_tools.io import read
import dask
import dask.array as da
from dask.distributed import Client
import zarr
from numcodecs import Zlib
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def n5_to_zarr_raw(n5_path: str,
zarr_path: str... |
cfbf6984891e97a0aa3bc2f1ff3579c5ae42ba926ae916310b9b93470103763f | Python | 7,645 | 191 | import os
from alpineer import io_utils, misc_utils
from ark.phenotyping import cell_cluster_utils, cluster_helpers
def train_cell_som(fovs, base_dir, cell_table_path, cell_som_cluster_cols,
cell_som_input_data, som_weights_name='cell_som_weights.feather',
xdim=10, ydim=10, lr_... |
fb927fa675379abd42da4cd4e92597786b89b23200292694414ebcd2c0064b1f | Python | 7,646 | 251 | import tensorflow as tf
from tensorflow import keras
from keras import optimizers
from tensorflow.keras import layers
import numpy as np
np.set_printoptions(precision=5)
import matplotlib.pyplot as plt
import pandas as pd
pd.options.display.float_format = '{:,.5f}'.format
import scipy as sp
from scipy import stats
imp... |
8ee2505c9791db95008c39a670288805d9457cbc22438270bb78333bf5bbd763 | Python | 7,652 | 191 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from ax.benchmark.benchmark_problem import (
BenchmarkProblem,
get_continuous_search_space,
get_moo_opt_config,
... |
c21566e891901c46fecf63330f06c869bdbf1bc4badd190531745b893a4bf8f4 | Python | 7,654 | 272 | """Figure 4 plot - CPP/P3."""
# %%
# Imports
import json
import warnings
import matplotlib.pyplot as plt
import mne
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.lines import Line2D
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from config import ANALYSIS_DIR_LOCAL, NUMBE... |
dc1138489d495d88ae2e0e9f80636d2e9559d552c7e395ece013e7ef0dc55514 | Python | 7,656 | 213 | # 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... |
a82aeb2366a9f40b1e152a6ffb39b74c94c201a3f6b11e004c60cdb3bf920d37 | Python | 7,658 | 216 | from __future__ import annotations
from functools import cached_property
from typing import TYPE_CHECKING
import h5py
import numpy as np
import pandas as pd
import zarr
from anndata._core.index import _subset_dispatch
from anndata._core.views import as_view
from anndata._io.specs.lazy_methods import get_chunksize
f... |
2b6b2557992830f2f133d1c5b4ba7f810d97706ca35bc9706c8fcc4f45f541cb | Python | 7,660 | 190 | # 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 json
from collections.abc import Callable
from typing import Any, final, TYPE_CHEC... |
e8f4c56ff23e391e8141a2408077d8c258957c9c32fea6ad41ac91e678fcbc83 | Python | 7,660 | 204 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # #
# # # Render a 2d video of the input locations; velocities
# # # and of the filter's estimated velocities; and of the
# # # inferred motion strengths.
# # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import numpy as np
... |
e02165fbb93026f9717c2de473acb076ab821240af179691c4f26e9530d77c89 | Python | 7,663 | 237 | #!/usr/bin/env python
# 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
# "L... |
bf75bded6e4d066a2d996ddedd1e39f828d326ce69c5f33b0ee9a26cba2d0327 | Python | 7,666 | 182 | import os
import numpy as np
import pandas as pd
import nibabel as nb
from glob import glob
from nilearn.image import smooth_img, new_img_like
from nilearn.plotting import plot_stat_map
from nistats.design_matrix import make_first_level_design_matrix
from nistats.reporting import plot_contrast_matrix, plot_design_matri... |
05a75b0a0f8c5a0bc469c96387deb4d271362eeeeac6717c8b74f91a32458688 | Python | 7,670 | 219 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 13 09:34:22 2021
@author: Estefany Suarez
"""
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import os
import numpy as np
import pandas as pd
import statsmodels.stats.multitest as multi
import matplotlib.pyplot as plt
imp... |
b2137916b5947160c2ea1c0585545067e74626b3586de75aaf695c1a88a154f1 | Python | 7,671 | 182 | import itertools
import zlib
import numpy as np
from bsb_native import poisson_disk
from .. import config
from ..storage._chunks import Chunk
from ..voxels import VoxelSet
from .strategy import PlacementStrategy
_NEIGHBORS = [d for d in itertools.product((-1, 0, 1), repeat=3) if d != (0, 0, 0)]
def _color(chunk):
... |
be1c2a7b4e3ec31d7deb2ec0de0af48bc4460aa5b172219dfd83e5ea718e8e9e | Python | 7,673 | 180 | from ..helpers import ConfigurableClass, SortableByAfter
from ..functions import compute_intersection_slice
from ..models import ConnectivitySet
import abc
class _SimulationPlaceholder:
pass
class ConnectionStrategy(ConfigurableClass, SortableByAfter):
def __init__(self):
super().__init__()
... |
2c0f413bf34ef93ccc3191cd090018a5e9a1953af4cf23cfdae0f02d38ba26f5 | Python | 7,676 | 231 | """
Utility classes and functions for network flow algorithms.
"""
from collections import deque
import networkx as nx
__all__ = [
"CurrentEdge",
"Level",
"GlobalRelabelThreshold",
"build_residual_network",
"detect_unboundedness",
"build_flow_dict",
]
class CurrentEdge:
"""Mechanism for... |
682f80b1c24e4dd9baadf9d675b5db1b84fd78d1dbc571c0f8f938ef54d6e018 | Python | 7,677 | 159 | import tensorflow as tf
import numpy as np
# p: n x s probability distributions over alphabet
def dirichlet_log_pdf(p, alpha, q):
""" Computes the logarithmic Dirichlet density at p for a mixture given by alpha and q.
Args:
p: Probability distributions. Shape: (b, s)
alpha: Dirichlet component... |
2afd3e81244c9b5a75081969de2069bd71780589310adf077d65c6d892f8e6dd | Python | 7,678 | 198 | ''' Define the Transformer model '''
import torch
import torch.nn as nn
import numpy as np
from transformer.Layers import EncoderLayer, DecoderLayer
__author__ = "Yu-Hsiang Huang"
def get_pad_mask(seq, pad_idx):
return (seq != pad_idx).unsqueeze(-2)
def get_subsequent_mask(seq):
''' For masking out the su... |
d167442992a6c2806988797abca59d657a2861d02f0187416d37b986e5435b69 | Python | 7,678 | 212 | #!/usr/bin/env python
"""Apply contrast limited adaptive histogram equalization using dask.
This script replicates the original behavior (using funlib and daisy) by dividing
the raw Zarr volume into blocks, “growing” each block by a context determined by the
CLAHE kernel size, and then applying CLAHE with the sam... |
fa1ff338730f4a27a98fe7c96f93862fa1965d406eb0f2347515571ddd083ffc | Python | 7,679 | 161 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import torchvision.datasets as dataset
import numpy as np
import os
import time
import utils_fun
from ResNet import Net
import config
import loss_fun
from sklearn.cluster import KMeans
from torchsampler.imbalanced imp... |
4d9c2c28c341e869d0bff8a2f91b9235895c2842d938382a41bd9e6a4f155403 | Python | 7,682 | 220 |
import abc
import torch
from typing import Any, Callable, List, MutableMapping, Optional, Text, Tuple
import math
from functools import partial
from multiprocessing import Pool
import numpy as np
from rdkit import Chem
from rdkit import rdBase
from rdkit.Chem import AllChem
from rdkit import DataStructs
import os
... |
59f9e7ce3ad7362e7e8b5021cba51958bb362f148a018e52b30ae2df3fa97faf | Python | 7,684 | 224 | """Cache Management
"""
import errno
import hashlib
import logging
import os
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.download import path_to_url
from pip._internal.models.link import Link
from pip._internal.utils.compat import expanduser
from pip._internal.utils.temp_dir import T... |
6f872758c2579a6802ca3308f00fdda0765e292fd141b1aa9b62f4d4ea53fc98 | Python | 7,691 | 259 | """Functions for computing large cliques and maximum independent sets."""
import networkx as nx
from networkx.algorithms.approximation import ramsey
from networkx.utils import not_implemented_for
__all__ = [
"clique_removal",
"max_clique",
"large_clique_size",
"maximum_independent_set",
]
@not_imple... |
78e032208df3e8fbdd08d9ace88c52736dbf55cb6ed327244bea149468705cab | Python | 7,693 | 246 | """
Initially adapted from
https://github.com/funkey/gunpowder/blob/master/gunpowder/nodes/generic_train.py
Changes before porting into this package are recorded at
https://github.com/kirchhausenlab/gunpowder/blob/patch-1.1.4-logging/gunpowder/nodes/generic_train.py
"""
import glob
import logging
import multiprocessi... |
6b609fcbf9e32e1c947e64aeb3038b9f1a2adac9f5ec964d15accf5a179798c7 | Python | 7,694 | 276 | # 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... |
8be04faaeff78afad74ee0a234e29a8501bb41311fe294540ec60197ea48ff98 | Python | 7,704 | 265 | import copy
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from matplotlib.cm import ScalarMappable, get_cmap
from matplotlib.colors import Normalize
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from .color import plot_colorbar
from .contour import density_contour
from .text_... |
f9e653e8f316e11d3f6ff7c66d766bcb64dc68084417ead4f84cfe188f39c711 | Python | 7,706 | 178 | # encoding: utf-8
# copyright: GeoDS Lab, University of Wisconsin-Madison
# authors: Yuhao Kang, Song Gao, Jinmeng Rao
import pandas as pd
import numpy as np
import os
import geopandas as gpd
import psycopg2
import argparse
import datetime
parser = argparse.ArgumentParser(description='Month, start day, end day')
parse... |
7c836774bb3e859ebf9d311166afa9e195ef0ba8f7c15820d5398e50cff72582 | Python | 7,709 | 224 | #!/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 Iterable
from datetime import datetime, timedelta
from random import randi... |
bf92e77225d0177a682a0bcbbd479f4649399abe37aee8a423a4dbb8af474825 | Python | 7,709 | 207 | from fanc.hic import LegacyHic, Hic
from fanc.matrix import Edge
from genomic_regions import GenomicRegion
def sample_hic(file_name=None, tmpdir=None):
hic = Hic(file_name=file_name, tmpdir=tmpdir, mode='w')
# add some nodes (12 to be exact)
nodes = []
for i in range(1, 5000, 1000):
nodes.app... |
ae9a84c63766b603adae7fa703d9e462ad86d97ff5b14472ff1b793e80b8d920 | Python | 7,712 | 216 | from dotmap import DotMap
from loguru import logger
import torch
from ..fdtd import (
AbsorbingObject,
set_backend,
Grid,
PML,
PeriodicBoundary,
LineSource,
LineDetector,
PointSource,
)
from ..utils.global_constants import EPS_0, PI, SPEED_OF_LIGHT, UNIT_MAGNITUDE
def init_fdtd(cfg: D... |
1f4ada1717af2a4dfa3c787a9b87896692d717853ffa69ed4efd1a30cd34db69 | Python | 7,713 | 242 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
random.seed(42)
NAME = "jobs"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictRead... |
7dbd3b03f06fb32a4c7b9b62d1beb92c8e2b2077f34a6b3c910c3c19378fd96e | Python | 7,714 | 264 | from maxatac.utilities.system_tools import replace_extension, remove_tags, Mute
import matplotlib.pyplot as plt
import numpy as np
import pyBigWig
with Mute():
from tensorflow.keras.utils import plot_model
def export_model_structure(model, file_location, suffix="_model_structure", ext=".png", skip_tags="_{epoch}... |
b635e462fce8355249d04101cf6f28001c14ea1f9d1fe370252be4abf6c9b1dd | Python | 7,714 | 209 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def cal_mrr(embedding, rel_embedding, edge_index, edge_type, scoring, protocol="raw", batch_size=1000, hits=[]):
with torch.no_grad():
if protocol == "raw":
heads = edge_index[0]
tails = edge_ind... |
cef4a03585d13d979f80379048482281f131324f29fc32d6951037aa4ce9129f | Python | 7,714 | 226 | from vedo import Plotter
from collections import namedtuple
import datetime
from loguru import logger
from qtpy.QtWidgets import QFrame
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
import brainrender
from brainrender import Scene
from brainrender.camera import set_camera
from brainrender.g... |
e387bed3d906636dec4a1eca7fb4e1130304ffd972f982a4b7862285ec75dc1b | Python | 7,718 | 235 | """Extract and save the ResNet-50 feature maps of the training and test images,
and of the ILSVRC-2012 validation and test images.
Parameters
----------
pretrained : bool
If True use a pretrained network, if False a randomly initialized one.
project_dir : str
Directory of the project folder.
"""
import argparse
im... |
f8186250e64019d7cc7db3c7615b86d0269aeaba60e9499298c6a25abfafd102 | Python | 7,719 | 94 | import argparse
import os
parser = argparse.ArgumentParser()
# Program behavior
parser.add_argument('--eval', action='store_true', help='eval mode')
# Model parameters
parser.add_argument('--model', type=str, default='scNTImpute', help="model name")
parser.add_argument('--device', type=str, default='cpu', help="devi... |
98baab2649c29a1480205ce16522d98e1854216288746b2ae23be232c94bb5fa | Python | 7,728 | 200 | # 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... |
635c939875f3443902cddceb6c358f25a8b9f6cd284de51b4913813fcb86b89c | Python | 7,730 | 266 | """
This module has utilities for time series data input checking
"""
# Author: David Burns
# License: BSD
from pandas import DataFrame
import numpy as np
import warnings
from seglearn.base import TS_Data
__all__ = ['get_ts_data_parts', 'check_ts_data', 'check_ts_data_with_ts_target', 'ts_stats']
def get_ts_data_p... |
ab018fe1492d54739ea1dc91aff8beaf347fc323306a9505f885a1f3794b6b0f | Python | 7,734 | 164 | import os
from typing import List
import itertools
import numpy as np
from pymatgen.core import Element
from rlmolecule.crystal.crystal_state import CrystalState
conducting_ions = {'Li', 'Na', 'K'}
anions = {'F', 'Cl', 'Br', 'I', 'O', 'S', 'N', 'P'}
framework_cations = {'Sc', 'Y', 'La', 'Ti', 'Zr', 'Hf',
... |
987896cd31b2df0db0ed50bbe2cdbf209156b00999f8917ac250a2d4540fa40d | Python | 7,737 | 106 | """Arguments that became keyword-only still accept an old positional call, with a warning (#1288)."""
from __future__ import annotations
import inspect
import warnings
from contextlib import contextmanager
from importlib import import_module
import numpy as np
import pytest
from anndata import AnnData
import squidp... |
14962bc5c7cc09990d871ae34ef937acca6a1c3d240da0fdab7889d13a259085 | Python | 7,738 | 219 | import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import cv2
from tifffile.tifffile import TiffWriter
import copy
def plot_frame_gen(gen):
for image, coords in gen():
plt.imshow(image)
#for coord in coords:
plt.scatter(coords[:,1], coords[:,0])
plt.show()
... |
e0e803b55fdb94c653cc6ac09565df476b2b53ad1c585463a9caa5d7faec07cb | Python | 7,741 | 241 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF_alte import *
from FEF_visuomotor_alte import *
from FEF_contra... |
71315d040e452bf7940b9c80de2d0aa854905cda7a1593d8dd0b53f3a93f5d83 | Python | 7,742 | 206 | # 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... |
04e655d916807958092fb5141dca9500eaf0a3a43f772a05a3334d506078b5cd | Python | 7,744 | 241 | import sys
from collections import Counter
import numpy as np
from scipy.signal import find_peaks, peak_widths
from sklearn.cluster import dbscan
from scipy.spatial.distance import euclidean
def find_anchors(pos, min_count=3, min_dis=20000, wlen=50000, res=10000):
min_dis = max(min_dis//res, 1)
wlen = min(wle... |
3eeb3a8e2f6c2d62c914b0ec0ed0795538f80ece0d536a3a2097ff531aea0cf9 | Python | 7,748 | 197 | # -- Path setup --------------------------------------------------------------
from __future__ import annotations
from datetime import datetime
from functools import cache
from importlib.metadata import metadata
from scverse_doc.config import DEFAULTS
from scverse_doc.registry import intersphinx
from sphinx.applicati... |
d40399e69fbaa5f17b8ff623cc38fd836fc0145d34de208312ae3117a0ebe035 | Python | 7,748 | 185 | from numpy import *
import time
from .precomputations import (reduce_masks, compute_correction_terms_and_replace_data,
compute_float_num_unmasked, reduce_masks_from_arrays,
compute_float_num_unmasked_from_arrays)
from .logger import log_message
from six.moves... |
c2124120ebd816ea2e27d568e0599028564d0fe86e56705a06ac1d805557456d | Python | 7,749 | 178 | # -*- coding: utf-8 -*-
from figureflow import figure
import seaborn as sb
import numpy as np
import os
import importlib
importlib.reload(figure)
Figure = figure.Figure
# get the path to the data of the respective figure or movie
# the data is in the data folder in a folder with the same
# name as the folder that ... |
61b7f3a35ef72b67798d0122a3349caf8a2c165fc81e7c33647574d45f8ab624 | Python | 7,750 | 237 | from __future__ import annotations
import copy
import numpy as np
import pytest
import spatialdata_plot as sdp
import squidpy as sq
from tests.conftest import PlotTester, PlotTesterMeta
_ = sdp
# Large tile size to keep tests fast (fewer tiles = less computation).
_FAST_TILE = (1000, 1000)
@pytest.fixture(scope=... |
74c25241831235294f1eba062086dcd008c54182a4e471fc98390590e7e76de9 | Python | 7,752 | 206 | import torch
from torch import nn
from torch.nn import functional as F
from torch_geometric.nn import MessagePassing, global_sort_pool
from torch_geometric.utils import add_self_loops, degree
class DGCNN(nn.Module):
"""
Uses fixed architecture
"""
def __init__(self, dim_features, dim_target, model_co... |
4b0f18c0e11899df6f6ca06b8a750f2e7f5cd337dbfc940231e526bf22d16a39 | Python | 7,756 | 217 | #!/usr/bin/env python
# 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
# "L... |
3a603f0464c66eacf6dd4ba7126451f2f65d672ef70f3cab15b52d5fd214ae8b | Python | 7,758 | 197 | """Visualize the ERPs of the biological and synthetic test EEG data.
Parameters
----------
used_subs : list
List of subjects data to plot.
project_dir : str
Directory of the project folder.
"""
import argparse
import os
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
# =================... |
69ee7e73562a67b6043378e7c395bfb1caf32f4487d60c88f8e7754e39bbea57 | Python | 7,758 | 152 | import numpy as np
import torch
from torch import nn
from models.utils import modules
from models.fc import excitability_modules as em
class fc_layer(nn.Module):
'''Fully connected layer, with possibility of returning "pre-activations".
Input: [batch_size] x ... x [in_size] tensor
Output: [batch_size] x... |
d80e3b73a6730e9c8faa57599f7975637e4c39be4f6d3a424f65101b405cd847 | Python | 7,758 | 209 | # -*- 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... |
ae00896d61970e546c12e062d1b07310fa7874016459670ac3beb9185339b391 | Python | 7,764 | 206 | #!/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.abc import Sequence
from ax.core.parameter impor... |
de6c18096373f59e433e00e2a3feef5176d87007b9808bd5b0163394564d7f1d | Python | 7,767 | 181 | # -*- coding: utf-8 -*-
"""
Cell shape and size detection routines
The cell shape detection is based on a seeded and masked watershed.
"""
#: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.ndimag... |
7d918c24db676985e3447202e1c82b82d3d87c23eceec32ef3b62d7a82a2129f | Python | 7,774 | 243 | # -*- coding: utf-8 -*-
'''
Created on 2020.05.19
@author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie
'''
import random
import time
import os
import json
import yaml
import pickle
import logging
import numpy as np
import pandas as pd
from tqdm import tqdm
from pathlib import Path
import torch
import torch.nn as... |
910a2961f200ed72dd4814518220a3a58217e556052d5e0adaa5bb48168249b4 | Python | 7,775 | 207 | #!/usr/bin/env python3 -O
import sys
# Check the current python version before running.
if sys.version_info < (3, 7, 0):
sys.exit("Error: NapShift program requires Python 3.7 or greater.")
# _end_if_
import os
# Disable some tensor-flow warning messages.
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ["TF_X... |
db43d8147fd9eab736c2995774d4f3b5a8b11443b0901d49db128d632bf416eb | Python | 7,779 | 236 | import pathlib
from scipy import ndimage
from ark.segmentation.ez_seg import ez_object_segmentation
import pytest
from pytest_cases import param_fixture
import numpy as np
from skimage import draw
import xarray as xr
from skimage.io import imread
from alpineer import image_utils
from skimage.util import img_as_int
from... |
376bff3a1dee5c9694d2b882e880a08cac2757cabfd1c2b69950da5e5c326211 | Python | 7,780 | 223 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 23 11:00:55 2022
@author: marcomau
"""
import os
import time
import copy
import datetime
import json
import torch
import collections
def var_data(features, mean_val):
if len(features.size()) == 2:
dim = 0
else:
dim = 1 ... |
573ce099d4ffca6bd0ec4281e016dd9ed90161a3b9c3a3a05f3bebee96e042c6 | Python | 7,784 | 225 | import pickle
import pytest
import networkx as nx
sp = pytest.importorskip("scipy")
pytest.importorskip("numpy")
@nx._dispatchable(implemented_by_nx=False)
def _stub_func(G):
raise NotImplementedError("_stub_func is a stub")
def test_dispatch_kwds_vs_args():
G = nx.path_graph(4)
nx.pagerank(G)
nx... |
712ecaedc4c5a1ef9f646218ef33f02730cbc1308519e1326c1fb47489ccf3a3 | Python | 7,793 | 204 | #!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
import socket
import martian
import os
import tenkit.preflight as tk_preflight
import tenkit.bcl as tk_bcl
import tenkit.samplesheet as tk_sheet
__MRO__ = """
stage MAKE_FASTQS_PREFLIGHT_LOCAL(
in path run_path,
in bool ... |
3fa97e2b918a057594f4039db420f02c84ec8667c89165b02ba66f4d3efcb2f0 | Python | 7,795 | 214 | """The lift, relative risk and uniformity ratio the coordinate-based engines
define: checked against a direct computation on a tiny engine. The term is a
constant of the query, as in the tutorial: probabilistic queries without
a constant do not go through the magic-sets rewriting."""
import itertools
import re
import... |
dc040745e49b53d0aefd9b22c81d312b1b80f41a9dbafc76c5b6430fb1223528 | Python | 7,796 | 232 | # -*- coding: utf-8 -*-
"""
Routines to run iDISCO alignment and cell detection
Created on Fri Jun 19 12:20:18 2015
@author: ckirst
"""
#import os
from iDISCO.Parameter import *
from iDISCO.IO import IO as io
import iDISCO.ImageProcessing.SpotDetection
try:
import iDISCO.ImageProcessing.IlastikClassification
... |
3b951c48d1c2ef49b21dde1a31878d01f7829b2f15ef099e6c9fbf7e05968050 | Python | 7,797 | 248 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
def avg_and_rms(x):
N = len(x)
avgx = np.mean(x)
print('avgx:',avgx)
rmsx = 0
for i in... |
12034250b9be863d8338a02f2f271e2023ecd708c5ebf25cee13b8f94f12032f | Python | 7,799 | 228 | #!/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 re
from collections.abc import Callable, Iterable
from functools impor... |
e8ebae9eddba8175f19a7c99cf1e0b7c196538fdf1e24f77222c3797a01995d1 | Python | 7,799 | 225 | # 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, Generator
from contextlib import contextmanager, ExitStack
from functools import wraps
... |
a891579b1c798758aa2633e399918c5d0b36eaec8884b632a64252d9e1702989 | Python | 7,803 | 282 | # -*- coding: utf-8 -*-
"""
Block
=====
The Block module provides a :mod:`~ClearMap.IO.Source` class used in parallel
processing of very large arrays in
:mod:`ClearMap.ParallelProcessing.BlockProcessing`.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic ... |
df3f70db85c6258e6e2a0ac698ae7a61d44ae8d14f48e64d4cb58866e5c277a9 | Python | 7,805 | 211 | #!/usr/bin/env python3
"""
Batch randomness testing per NIST SP 800-22 Section 4.
Reads multiple binary sequences (one per line) from a file, runs all 15
statistical tests on each sequence, then reports:
- Proportion of sequences passing each test (with NIST confidence interval)
- P-value uniformity across sequenc... |
1bcb354571f949d355cff8359afef0fa247f2fb1ce87e638d2641128daaf75b6 | Python | 7,806 | 225 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 23 11:00:55 2022
@author: marcomau
"""
import os
import time
import copy
import datetime
import json
import torch
import collections
from sklearn.model_selection import train_test_split
def var_data(features, mean_val):
# if len(features.size()) == ... |
f010401d4c821aa3dc19aaad64209b4ff18845daad76a4d9f8a215393744b9bf | Python | 7,813 | 195 | """
Super-resolution of CelebA using Generative Adversarial Networks.
The dataset can be downloaded from: https://www.dropbox.com/sh/8oqt9vytwxb3s4r/AADIKlz8PR9zr6Y20qbkunrba/Img/img_align_celeba.zip?dl=0
(if not available there see if options are listed at http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html)
Instrustion ... |
c058bf915dbe32ec96a33815b20801db655832d20bc81bfebd731b0feac050a7 | Python | 7,814 | 190 | import numpy as np
import os
import pathlib
import skimage.io as io
import tempfile
import xarray as xr
import pytest
from alpineer import image_utils
from ark.segmentation.ez_seg import merge_masks
from skimage.measure import regionprops_table, label
import pandas as pd
from skimage.draw import disk
from typing import... |
c39b9a00cac5c1fddb1aa6c0553ad2fc7c471f0e8f2b6ddb4d6194b67983e888 | Python | 7,815 | 219 | import argparse
import os
import numpy as np
import math
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch... |
3b35d72414335e91d14fb2d0a31134e45b1d23d5dd9738995b59d624a8fd1032 | Python | 7,816 | 187 | #!/usr/bin/env python3
import random
import os
import sys
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Input, Dropout, Activation, Reshape, Dense
from tensorflow.keras.models import Model
import tensorflow_addons as tfa
import json
from custom_layers import CombineConcat, Edge2Node, ... |
7fe1bf86f4d46894a7681bea3b508623d036c87f18fff7f8af888011bcc23122 | Python | 7,816 | 183 |
import os
import random
import sklearn
import collections
from rdkit import Chem
from rdkit.Chem import rdDepictor
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit import DataStructs
from MolRep.Models.losses import get_loss_func
from MolRep.Explainer.explainerXNetWrapper import ExplainerXNetWrapper
from MolRep.M... |
8973281bae06f179b3837cac3e0f46cbebc8f487704a48fff38753d7ae1819a0 | Python | 7,816 | 199 | import pytest
import torch
import torch.nn.functional as F
from spikingjelly.activation_based.functional.loss import (
kernel_dot_product,
spike_similar_loss,
)
@pytest.mark.parametrize("dtype", [torch.float32, torch.float64])
@pytest.mark.parametrize("label_dtype", [torch.bool, torch.int64, torch.float32])
... |
426d997a289b9c20f3ca48ef097914d4b86d2d64904056869cbf0b59eafedcf6 | Python | 7,820 | 210 | import io
import pytest
from data_export.serializers import CompletedBySerializer
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import timezone
from io_storages.serializers import StorageCompletedBySerializer
from organizations.models import OrganizationMember
from organizations.tests... |
6c78ec0b5351b4e8bbcb6bdd1d4093b4c7f7ccd08ecea1f0868b560c8ff92aa6 | Python | 7,820 | 196 | """
Multiple-kernel ridge
=====================
This example demonstrates how to solve multiple kernel ridge regression.
It uses random search and cross validation to select optimal hyperparameters.
"""
import numpy as np
import matplotlib.pyplot as plt
from himalaya.backend import set_backend
from himalaya.kernel_ri... |
ea1f0ca2282e51f73eea2381e25fceab43738792b131aec8f3e1e7d30e274962 | Python | 7,821 | 236 | import numpy as np
import pandas as pd
from sklearn.decomposition import IncrementalPCA as _IncrementalPCA
from sklearn.preprocessing import StandardScaler
from ..count_matrix.zarr import dataset_to_array
def _normalize_per_cell(matrix, cell_sum):
"""Normalize matrix row sum to to cell_sum."""
print("normali... |
66182c4c4a3215b9eb9890b2d4bfe70cb46d44cabd3479b8c632bda734a74eaf | Python | 7,823 | 203 | u'''
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Annotate peaks with near by genes, TSS/distal position and motif positions.
'''
from __future__ import division
import martian
import utils
from pybedtools import BedTool, create_interval_from_list
from tools import ReferenceManager
from tools.io impo... |
397ff003deeccc5dd819e842bf3a10ce48917c4344806591177470092e5fa0ca | Python | 7,824 | 181 | """Choosing a stochastic-reconfiguration solver.
`recommend_optimizer` estimates -- and, when cheap enough, directly benchmarks
-- the peak memory and solve time of the three mathematically equivalent
stochastic-reconfiguration solvers: StochasticReconfigurationWfbyWf (SR),
MinSRWfbyWf (minSR), and CGSRWfbyWf (CG-SR).... |
b8134827ee31e3da1e2f888b2eecfcbe628bb1de568a98794ef54a10cc00c319 | Python | 7,825 | 181 | """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
from collections import defaultdict
from core.permissions import AllPermissions
from core.redis import start_job_async_or_sync
from... |
a6dcfa5e45bf4120e3bf8728d6ee0a8ac3312361df0e264c0f0fa6cdca860b7f | Python | 7,827 | 220 | import logging
import sys
import time
from typing import Tuple, Optional
import numpy as np
from sqlalchemy import create_engine
from gridworld_env import GridWorldEnv as GridEnv
from gridworld_env import make_empty_grid
from rlmolecule.alphazero.tensorflow.tfalphazero_problem import TFAlphaZeroProblem
from rlmolecul... |
b3654f4bba29e0a5e965cd144a52ca2f5d1b2320a10968282b68d9841cdcdad7 | Python | 7,827 | 201 | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# 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... |
223e53e7bf5a32c9c6bf3bdbb2973d5eea7c4346c9cfbfdacba57201df94ad73 | Python | 7,829 | 229 | """Tests that AnnData enforces a 2-D ``X`` and ``layers`` at the IO boundary."""
from __future__ import annotations
import warnings
from typing import TYPE_CHECKING, Literal, cast
import h5py
import numpy as np
import pandas as pd
import pytest
import zarr
from zarr.storage import MemoryStore
import anndata as ad
f... |
a09a9ec97e301326682373c9b6c38d2cb7af1295202b50c820685f46365df508 | Python | 7,829 | 207 |
import itertools
import functools
import logging
import warnings
from typing import Callable, List
import numpy as np
import scipy
import sklearn
import sklearn.metrics
# from graph_attribution import graphs as graph_utils
def silent_nan_np(f):
"""Decorator that silences np errors and returns nan if undefined.
... |
5af9042dfd5fdc96c803426207593776e91973ab8a1a7384b4f459219b4c3c08 | Python | 7,831 | 145 | # 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... |
62c7740c10e622c4bf3caf3a98cf459bd160915c7359e1fddda2a50f723490d0 | Python | 7,833 | 270 | #!/usr/bin/env python
# coding=utf-8
#
# dlup documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... |
66c279449bf78c045b4b55d9d9b519741e8d77a2ddea31ec47bc36ae12a41234 | Python | 7,834 | 260 | from itertools import count
import networkx as nx
__all__ = ["node_link_data", "node_link_graph"]
def _to_tuple(x):
"""Converts lists to tuples, including nested lists.
All other non-list inputs are passed through unmodified. This function is
intended to be used to convert potentially nested lists from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.