sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d278d54552f55dc2ae7a17ed62298be2aab1528508b60ac9136462b9ecfc6001
Python
7,170
194
import logging import os import subprocess import time from dataclasses import dataclass from string import Template from typing import ( Any, Optional, ) from typing_extensions import Protocol from galaxy.util import ( RWXR_XR_X, unicodify, ) from galaxy.util.resources import resource_string from ..f...
6008f28240337708042b6cf03264ef12b4e65dd2a3de48b2c277c0e17749e8aa
Python
7,175
143
# For more documentation see vert_int_method_variability.ipynb import os import xarray as xr import numpy as np ## Set by the user ## GRID_RES = 'R02B05' # Can be 'R02B05', 'R02B04'. Relevant for both the input and the output grid. SOURCE = 'NARVAL' # Can be 'NARVAL', 'QUBICC', 'HDCP2'. To set paths, inpu...
8eb844d36b73ebf8e32184ce4a7988c65c951032bfce843bb86f0393d545ba18
Python
7,175
167
import seaborn as sns import pandas as pd import numpy as np import scipy from matplotlib.font_manager import FontProperties import functools class RegressionPlot(): CONTINUOUS_X = True def __init__(self, x, y, hue, data, plot_colors,size_factor, ax, show_formula=True, positi...
b6215600acbca2458d4aae66bdc0cf652f9ea53629d811e88965c7ba5de28d34
Python
7,175
181
import pathlib from typing import List, Union import numpy as np import xarray as xr from alpineer import misc_utils, image_utils, load_utils from ark.segmentation.ez_seg.ez_seg_utils import log_creator def composite_builder( image_data_dir: Union[str, pathlib.Path], img_sub_folder: str, fov_list: list[st...
96cf567d0041df06e8ec3893279c88985f53d787b6ab8c4d78ea7b8584122be3
Python
7,181
213
""" Line editing of the interactive REPL. It provides the completion of predicates, their columns and the Datalog and SQUALL grammars (:class:`~.completion.NeuroLangReplCompleter`), syntax highlighting (:class:`NeuroLangLexer`), the bottom toolbar, suggestions from the history and the vi and emacs editing modes (``.mo...
6692349d4a26e30ced432f80b1205c8c3665fd335a9702284fdebc8fd44072b9
Python
7,182
155
# -*- coding: utf-8 -*- import pandas as pd import os import re import copy import numpy as np import time def goDeeper(props,this_path,a,max_a,conditions,folders): a += 1 for newFolder in os.listdir(this_path): print(newFolder) if conditions[a-1] != "": if newFolder...
88784f33d0a22b708a30dc5ada906f0cd0d89cd35c5a28108aac3ac067cdeab0
Python
7,183
196
import pickle import os import pandas as pd from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt import json from csv import reader from utils.Utils import * from .models import * base_url = 'scheduler/src/' def one_hot(value, lst): vec = torch.zeros(len(lst)) vec[lst.index(value)] = 1 return v...
e2f4547dcd4309a441e94336dc4b1b485981dcba4af82716d8af85b30ce96edf
Python
7,186
142
import unittest as ut import networkx as nx from pysbm.sbm.hierarchical_inference import HierarchicalInference from pysbm.sbm.hierarchical_inference import PeixotoHierarchicalInference from pysbm.sbm.nxpartitiongraphbased import NxHierarchicalPartition from pysbm.sbm.peixotos_hierarchical_sbm import LogLikelihoodOfHi...
a3c4f609fbfc118374d2c3b833404b9b243911c35fdb0db0b65112873e5ffa4d
Python
7,187
173
#!/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 time import time from typing import TYPE_CHECKING import pan...
c7e1f3782ae9e1fcf5643276d5581fd3bf138973eb680557a889077f04b37b16
Python
7,188
188
import torch import torch.nn.functional as F from torch_geometric.nn import SAGEConv, GCNConv, GraphConv, TransformerConv class BaseGNN(torch.nn.Module): def __init__(self, dropout, num_layers): super(BaseGNN, self).__init__() self.convs = torch.nn.ModuleList() self.dropout = dropout ...
8d30ae00806f8f2d20336f59a9de7349353953d37807a3130bfa38ca23d3ad40
Python
7,189
269
import pynwb from contextlib import contextmanager from datetime import datetime from dateutil.tz import tzlocal from uuid import uuid4 import numpy as np @contextmanager def open_nwbfile_local(file_path: str): """ Context manager to open and close a local NWB file. Parameters ---------- file_pat...
e4129e3a24e2f9cf62e275bc7f66cb771ea6ab3de262abea8fc4c4b22bc06f49
Python
7,190
206
import numpy as np import scipy.sparse as sp import torch import torch.nn as nn from .. import BaseModel from .dgi import GCN from cogdl.utils.ppr_utils import build_topk_ppr_matrix_from_data from cogdl.data import Graph def sparse_mx_to_torch_sparse_tensor(sparse_mx): """Convert a scipy sparse matrix to a torch...
938a58e8e2332fbe2e04cc6b995b0213e90a4cacf9bf1413b303ff11f8fcb233
Python
7,193
177
# 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...
db741db3f884bda9c1d6cbf625c79dbdaea9430fd92b3c20ba9352fb2845b09b
Python
7,195
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...
6e418bceb41344695c07e416e589dd7cc8aaca854454535f50e331252ba5f532
Python
7,196
194
# This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text for this file: # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either...
9bcbaf42eec92c9636de205b1ee93e317e3ad95f018d0a7c88b21f8ab8da2f4a
Python
7,198
231
import pyinspect as pi from io import StringIO from rich.console import Console import numpy as np from myterial import orange, salmon, amber from vedo import Text3D, Sphere from brainrender._utils import listify # transform matrix to fix labels orientation label_mtx = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0,...
fd70993f95c779a20ec65a0aa6cdd238694b9bcb53ce570f7d98e7b58f37b423
Python
7,198
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...
a17c180cba38f3840d80b3d9320ef81f50043b15fc5c48ced5a73d01f82c0e92
Python
7,200
158
import time import networkx as nx import numpy as np from sklearn import preprocessing from tqdm import tqdm from cogdl.utils import alias_draw, alias_setup from .. import BaseModel class LINE(BaseModel): r"""The LINE model from the `"Line: Large-scale information network embedding" <http://arxiv.org/abs/15...
a8f0184057969fe73201e895ced1a80a2608701e51fa858bb6d13ad1164fa8a3
Python
7,201
161
from math import fabs as fabs from math import floor as floor from math import sqrt as sqrt from scipy.special import erfc as erfc from scipy.special import gammaincc as gammaincc from numpy import zeros class RunTest: @staticmethod def run_test(binary_data:str, verbose=False): """ The focus o...
ed618d116c5000097486b481a2d2766d2df72324b0a51c0d6cb27a71888f83bf
Python
7,203
211
#!/usr/bin/env python3 import os import subprocess import sys import yaml from bids import BIDSLayout import bids from glob import glob from snakemake import snakemake import argparse import json bids.config.set_option('extension_initial_dot', True) # create a keyvalue class for accepting key=value pairs in argparse ...
fd253b24437325948b7ebed786d9afba454663606a141a973420ef67deca3f0d
Python
7,205
222
from __future__ import annotations import re from functools import partial from typing import TYPE_CHECKING import h5py import pandas as pd import pytest import scipy.sparse as sp import zarr from zarr.storage import MemoryStore import anndata as ad from anndata.compat import CSArray, CSMatrix from anndata.experimen...
1e1da8ec160468ae4f4f7b72977a1e01652478a13762afa963b2e3de210b0fd4
Python
7,211
191
"""Provide constants for several settings in the experiment.""" import os from collections import OrderedDict import numpy as np # MASTER SETTINGS # Set number of participants to record for your study. Must be divisible by 4 n_participants = 40 # Now define a function to create the experimental design for us def pr...
f375dd5f005d25bec0ab0c8a52395b709efe3546a410765c90ea52385b6b3ade
Python
7,214
199
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import time import dgl import numpy as np import torch import torch.nn.functional as F from dgl.data import register_data_args from pytorch_lightning.metrics.classification import Accuracy from pytorch_lightning.metrics.functional import auro...
ee05d59169c053e75aeb9f1a35af8228dbeaafec6931d1161ebd80e30e52c721
Python
7,218
194
#!/usr/bin/env python3 import os import numpy as np # -custom-written code import main_task_free import utils from params.param_stamp import get_param_stamp_from_args from params.param_values import check_for_errors,set_default_values from params import options from visual import visual_plt as my_plt ## Parameter-val...
bf9a4cb6ab269d9e5ed9c9fd6fad88be196475be7bc0a4f4a47d67dced59480b
Python
7,221
194
"""Graph utilities.""" from __future__ import annotations from collections.abc import Sequence from contextlib import contextmanager from typing import Any import numpy as np from anndata import AnnData from anndata.utils import make_index_unique from pandas import CategoricalDtype, Series from pandas.api.types impo...
d889a51fdacfc1c44bf4b7c508024b1b78d74312cb14a1b065bdcfa8b2931e20
Python
7,221
195
#!/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 ax.core.arm import Arm from ax.core.experiment_status import ExperimentStatus from ax.core.genera...
093cf3297c1b95ac8a712e968f0ec81ddc243f05d39f9079cb984adea37e3afb
Python
7,225
225
# 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...
a85216cb988a3f5490d8b67b7da6ad08d45df370138c53eab17805fc8c161a79
Python
7,225
172
# 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...
4469bf5700a83bcaff0abb04fe08f27353253bf7be2f1219f88ff1b2b0fd934e
Python
7,226
193
import torch import torch.nn as nn from .. import base, functional __all__ = ["STBIFNode"] def _as_scalar_tensor(value) -> torch.Tensor: tensor = value if torch.is_tensor(value) else torch.tensor(value) return tensor.detach().clone() class STBIFNode(base.MemoryModule): def __init__( self, ...
96d1174ac4d3a2bbfeb2cfef2871ff915e7ae60dd990eac0f9a40bea58166bbc
Python
7,228
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...
f84eb02e415233d3e352d10888a4011661ed6d21ec4344b77ea30cff9ccb8a33
Python
7,232
195
import sqlite3 from contextlib import contextmanager from functools import lru_cache from typing import ( NewType, Optional, ) from sqlalchemy import create_engine from sqlalchemy.engine import Engine from sqlalchemy.engine.url import make_url from sqlalchemy.orm import object_session from sqlalchemy.sql.compi...
f756f5a5ed0a1b1ca2ed2650788ca3038f881735b15683f926041c8fe4ce6a6e
Python
7,235
111
import time import numpy as np import matplotlib.pyplot as plt import figplot t1 = time.time() conv_time = 200000 def plot_timeseries_sd_two(g_1, g_2, g_sd_1, g_sd_2, g_min, g_max, t_min, t_max, aspect, fig, plot_x, plot_y, plot_area): time_trace = np.arange(t_min - conv_time + 1, t_max - conv_time + 1) ax...
565a0e66d2824fea9727df4f4d2e84f9c6d02771ca43dad0539cb616f99d0025
Python
7,237
188
import collections import json import logging import os import string from typing import Optional from galaxy.app_unittest_utils.tools_support import UsesTools from galaxy.config_watchers import ConfigWatchers from galaxy.model import tool_shed_install from galaxy.model.tool_shed_install import mapping from galaxy.too...
169382a5585d902176a9f3e72316990c711336eb6fb9288b831e9771e41e20d6
Python
7,239
241
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...
337fa08af8cec8d91cea6498932e3f2ea53267bad2c0408cdaa915987ef676ba
Python
7,239
186
import math import torch import torch.nn as nn import torch.nn.functional as F from torch_sparse import spspmm from .. import BaseModel from cogdl.layers import GCNLayer from cogdl.utils import remove_self_loops, coalesce class GTConv(nn.Module): def __init__(self, in_channels, out_channels, num_nodes): ...
e0b099f63723a637a705f776faa4de67e41b47410a1555ebbd6601e5b9d84b57
Python
7,239
141
import os import numpy as np import nibabel as nb import shutil import glob import argparse from os.path import join as opj from meld_classifier.tools_commands_prints import get_m, run_command def merge_predictions_t1(subject_id, t1_file, prediction_file, output_dir, verbose=False): ''' fusion predictions and t1 ...
2e66f8bee4978c72e5c33b4de19974fb547f6918477127ad7fd3c9246011d809
Python
7,240
243
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...
fb0a56e8c5468911ec45a5220d1d5211375a6ed2a384157fc6af00ce27ab36fa
Python
7,241
142
#!/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.utils.common.testutils import TestCase from ax.utils.measurement.synthetic_...
7093a22e7a0cf05bec121bc88451df96aef3bb6f70d4d8cb9d435953e6c0fe79
Python
7,242
231
#!/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 import * from FEF_contrast_detecti...
10dcae8be9aa0c54b5b5137d642e8bf18bb407fd0a585d59f0622e0282831b7c
Python
7,245
182
import torch import numpy as np import pandas as pd def load_data(x_path, y_path): Y = np.genfromtxt(y_path, delimiter=",") X = np.genfromtxt(x_path, delimiter=",") ## scale each SNPs to have unit variance for i in range(X.shape[1]): X[:,i] = X[:,i] - np.mean(X[:,i]) Y = (Y - np.mean(...
bcc8c68b4e50fd6c11fc7d028d96dc8b0cc4bda862f8028bd58c84c907709067
Python
7,247
200
# -*- coding: utf-8 -*- # Author: Florian Boudin # Date: 09-11-2018 """Single Topical PageRank keyphrase extraction model. This implementation is an improvement on a keyphrase extraction algorithm, Topical PageRank (TPR), incorporating topical information from topic model and described in: * Lucas Sterckx, Thomas De...
2d7433e714973417b3397316fbb088492e1deeff79734d3083b3376e28d2ac90
Python
7,251
183
import hashlib import logging from typing import Optional from galaxy import exceptions from galaxy.files import ( ConfiguredFileSources, FileSourcePath, ProvidesFileSourcesUserContext, ) from galaxy.files.models import FilesSourceOptions from galaxy.files.sources import PluginKind from galaxy.managers.con...
3145f5eca521d51b595aedd1541b74426d7c98b46ace40fed6d5438af871207b
Python
7,252
209
from typing import List, Tuple import torch import torch.nn as nn import torch.nn.functional as F from cogdl.data import Graph from cogdl.layers import GCNLayer from cogdl.utils import dropout_adj, get_activation from torch_sparse import spspmm from .. import BaseModel class Pool(nn.Module): def __init__( ...
c2c30312d1d5dbdacc520319f86dca4ff6169dc97a080bf3dcad5fa2276ea27f
Python
7,253
217
from oct.utils import * import logging from ..load.metadata import Metadata cp, np, convolve, gpuAvailable, freeMemory, e = checkForCupy() class Structure: """ Structure contrast OCT reconstruction """ def __init__(self, mode='log'): acceptedModes = 'log+linear' if mode in acceptedModes: ...
79e1de663147969290cd3260e7bc376bd88136a7de16ce115ee8292d80bb3981
Python
7,254
224
import pytest import networkx as nx class TestConfigurationModel: """Unit tests for the :func:`~networkx.configuration_model` function. """ def test_empty_degree_sequence(self): """Tests that an empty degree sequence yields the null graph.""" G = nx.configuration_model([]) a...
3afcfbe434302274769749fc2a37818556a635a97d8fad762233fc43f45c8cb0
Python
7,256
209
"""Functions for computing reaching centrality of a node or a graph.""" import networkx as nx from networkx.utils import pairwise __all__ = ["global_reaching_centrality", "local_reaching_centrality"] def _average_weight(G, path, weight=None): """Returns the average weight of an edge in a weighted path. Par...
ad82c29a99e51ed93047fc824dc6b969f2ea82eb27995f5c4828a9ce06c17a70
Python
7,257
111
import time import numpy as np import matplotlib.pyplot as plt import figplot t1 = time.time() conv_time = 200000 def plot_timeseries_sd_two(g_1, g_2, g_sd_1, g_sd_2, g_min, g_max, t_min, t_max, aspect, fig, plot_x, plot_y, plot_area): time_trace = np.arange(t_min - conv_time + 1, t_max - conv_time + 1) ax...
57fb0265f6bbed5695e1beb53c81f0f7bc9ad6914ea8a105950fc38968798a1c
Python
7,259
216
""" spaln Composite Dataset """ import logging import os.path from collections.abc import Callable from typing import ( Optional, ) from galaxy.datatypes.data import Data from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetHasHidProtocol, DatasetProtocol, ...
2bbfa934957b43b75e9fb945086600977d65d12bb6ca30664d9c072e77555e68
Python
7,260
242
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...
615184d64d1f01d3dffa081c72e6cb35551b466eb8740db775bbb9249f21c59f
Python
7,261
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...
7b9e81ba6ae534276252025c63e197c0691ef169fc3dc876cacd94cdf6cdf889
Python
7,261
238
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 6 18:10:06 2021 @author: townesf """ import pathlib import numpy as np from math import ceil from copy import deepcopy from dill import dump,load from pandas import read_csv as pd_read_csv from tensorflow import clip_by_value from scipy.sparse impo...
751e51e09591cd12790990c916ba0c73c000cff55c3ceff5a59744e098498578
Python
7,262
191
""" Tests for Robust Single Linkage clustering algorithm """ # import pickle import numpy as np from scipy.spatial import distance from scipy import sparse from sklearn.utils.estimator_checks import check_estimator from hdbscan import RobustSingleLinkage, robust_single_linkage # from sklearn.cluster.tests.common impor...
0893ebc8a075d35876347b37bfe018dfb928a1644ae8ecc2487db708838f30e7
Python
7,265
169
import os.path import shutil import sys import numpy as np import tensorflow as tf import pickle from nets import nets def get_dataset_handlers(opt, opt_datasets): # Initialize dataset and creates TF records if they do not exist datasets = [] test_datasets = [] test_iterators = [] if opt.dataset.d...
901aac32a8a9337d7491433b0e40315583730f7994bd41357b6598eed4a2247b
Python
7,269
247
""" This module includes the main class that handles the computation of the NH-order parameters. """ # Python import(s). import numpy as np # Private import(s). from src.chemical_shifts.auxiliaries import ACCEPTED_RES class NHOrderParameters(object): """ This class computes and returns the "S^2" NH order ...
0215f676a48453858ed3e434b5951f08fc95c7032c57d5c9bfabf1efcf399c6f
Python
7,273
245
# -*- coding: utf-8 -*- """ Parallel tools for writing and reading large data arrays. This module provides parallel reading and writing routines for very large files. """ __author__ = 'Christoph Kirst <ckirst@rockefeller.edu>' __license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>' __copy...
8991e4c927e25c9fc2633fed9670371746b95a925073ab94cf8b2fd675f1eb7b
Python
7,276
200
from __future__ import division from fanc.architecture.architecture import calculateondemand from fanc.architecture.genome_architecture import MatrixArchitecturalRegionFeature, VectorArchitecturalRegionFeature from fanc.data.genomic import GenomicRegion, Node, Edge import tables as t import types import numpy as np c...
6b9872829d56efc8b490ad5f61f7b255c7f03fc1d334ddafb857c83dad5c09dc
Python
7,278
188
# 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 typing import Any, final import pandas as pd from ax.adapter.base import Adapter from ax.analysis.analysis import Analy...
fb30f0e0ed544eddb4f1e34ca08f34d94c9eedef0676bf65b5502da1609ca1b7
Python
7,280
162
# 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...
6d2fc12410068538574e616e718ac6b928392879cb1357e2e866b16807b3ba86
Python
7,282
263
# -*- coding: utf-8 -*- """ SMA === Shared memory arrays for parallel processing. Note ---- Usage of this array can help for parallel processing of shared memory arrays. However, using memmap sources (:mod:`~ClearMap.IO.MMP`) often enable faster implementations. """ __author__ = 'Christoph Kirst <christoph.kirst....
8eb82b8a7d7d33ade35dff26645a978556b922823ac2b546353a9b682bd5fb11
Python
7,282
225
""" Copyright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import time import numpy as np from tqdm import trange import matplotlib.pyplot as plt from pathlib import Path from cellpose import transforms, io, metrics from cellpose.models import CellposeModel # uses torc...
9df1fdb5d5ddd27092aeeea0d218c28931bc4b732bf734bc193bef5cc55fd02b
Python
7,282
205
# -*- coding: utf-8 -*- """ Created on Fri Jun 10 11:03:57 2022 @author: Estefany Suarez """ import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import os import itertools as itr import numpy as np import pandas as pd from scipy import stats #%% RESOLUTION = '100' PROJ_D...
ad424d6bfda72834a4ef9160d72ca030f02a83f05d93480658c0d1298f20d659
Python
7,282
213
import random import pytest import networkx as nx from networkx.algorithms.link_analysis.pagerank_alg import ( _pagerank_numpy, _pagerank_python, _pagerank_scipy, ) from networkx.classes.tests import dispatch_interface np = pytest.importorskip("numpy") pytest.importorskip("scipy") # Example from # A. La...
60acacdae3e88e07d4216df0a4ee13626bc87bd81976ef0cca688afe7e2151d4
Python
7,286
184
from typing import Generator, List, Union from skimage.io import imread from alpineer.image_utils import save_image from alpineer import io_utils import os import re import shutil from tqdm.auto import tqdm import numpy as np import pathlib import pandas as pd def find_and_copy_files(mask_names: List[str], source_fol...
03a351010c203c5820bccae3d350baf7b42ac41273df9a1e27f62ef889f346c7
Python
7,291
187
""" HCBS Pruning Network Inference """ import torch import numpy as np from ...types import bbox from ... import seg_utils from . import locs def prune_candidates(net, img, seg, patchsz, candidates, cleft=None, output_thresh=0, cleft_locs=None, prox=None, cleft_ids=None, l...
b115208bf0a241e03db0952fb579a95422795e8277657077c4e5bee737abcd06
Python
7,291
239
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 6 18:10:06 2021 @author: townesf """ import pathlib import numpy as np #from pickle import dump,load from math import ceil from copy import deepcopy from dill import dump,load from pandas import read_csv as pd_read_csv from tensorflow import clip_b...
b24a87189a653f030734d154743b22ee3ca4b0391df63384bd7c222a0e0b904a
Python
7,292
182
import numpy as np from ... import config from ...config import types from ...connectivity.strategy import roi_key from ...trees import BoxTree from .. import ConnectionStrategy from ..strategy import Hemitype from .geometric_shapes import ShapesComposition @config.node class ShapeHemitype(Hemitype): """ Cla...
3709b61b07a9852276971beeb53d6764ff6f13cccef3cd9c0a0abd338d752925
Python
7,294
158
""" heavy-lifting workflow functions""" # General I/O import os import subprocess import time # fishdot from helpers_and_sources import generators, image_augmentations, image_operators, image_segmentation_model # segmentation from tqdm import tqdm import tifffile as tf import numpy as np import torch def print_cur...
df38f207f70eee5b4218a6a5f18460f72748df90e0f396964dee6bcf89e4b59b
Python
7,294
181
import numpy as np from skimage import filters, measure, morphology from skimage.segmentation import watershed from GeneralFunctions import upper_inner_fence def seeded_watershed(input_binary, input_represent, t, min_seed): """ Seeded watershed to further split undersegmented objects, input...
3494eb389361595844348b5152e5ad9ddb5e6007c9d7d692ce9a4cf41a672476
Python
7,297
242
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...
08349e1cbe7f1a37af5923947afb1d1b1d6e35d4242c9c81baca9aa2b450a395
Python
7,298
237
import torch import triton import triton.language as tl from triton.language.extra import libdevice from ..triton_layout import ( _block_minor, _neuron_grid, _neuron_indices, _spatial_offsets, _time_offset, _triton_layout_args, ) from .autograd import _check, _check_backward @triton.jit def _...
69efd72c6ff9300ace3ead7584545420f90a2847e04e46d2a7518aef0eb6f4cb
Python
7,298
210
""" Created on Dec 30, 2020. Implements a convenient data handler for large, unbalanced data sets. The data manager is to be provided with either a list, a dictionary, or a numpy array. These are traverse in order to save unbalanced data in smaller individual data junks. This avoids excessive memory consumption as obs...
d541f2778fb242ed8cac5ba4e25e7ea5af0a05dd33656e87be048a48976b784b
Python
7,298
187
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Produces the final customer-facing web_summary. """ from __future__ import division from websummary import summarize import json import martian import numpy as np import h5py import pandas as pd import os from plots.plotly_tools import PLOT_CONFIG_KWAR...
28982088a1f11e3da24f9b83384c93ce9e56048b1a3cdccbd92fe485456ee7ca
Python
7,303
229
def load_dnn_data(args): """Load the DNN feature maps of the training and test images, and of the ILSVRC-2012 test and validation images. Parameters ---------- args : Namespace Input arguments. Returns ------- X_train : float Training images feature maps. X_test : float Test images feature maps. X_ils...
3a52a39514dd54482868e5ffa90c6630dc40f4670d2f691715a4f63c64d6b0d8
Python
7,306
258
"""Inspect ICA results and apply them. Here we load the previously computed ICA solution and use several visualizations interactively to determine which ICA components encode blinks, horizontal eye movements, and cardiac artifacts. For this, we will use the VEOG, HEOG, and ECG channels in the data to inform these deci...
ee70f41f5b6ccb09f8b6ffd9b4cc5c4330b96a1aa44bbba26903b4e4b183e431
Python
7,307
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...
5ef94e8e95cead08e238a7bf3e9124753770139715d17e62d14eca5b73e6363c
Python
7,308
163
# 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...
9c5410b8619c5ac3b0802191dff7851906ff609e99805ac140ddca6f029646a1
Python
7,311
200
from __future__ import annotations import sys from datetime import datetime from functools import partial from importlib import metadata from pathlib import Path from typing import TYPE_CHECKING import scverse_doc.config from docutils import nodes from scverse_doc.registry import intersphinx if TYPE_CHECKING: fr...
9abf2e542c06858ed4ba266d8b27dbeae68a5c77ba69d4e18dccc59f61b14dbd
Python
7,312
224
import matplotlib.pyplot as plt from pylab import * import numpy as np import random import math import time import os import glob # change the default font family plt.rcParams.update({'font.family':'Arial'}) plot_in_tiff = True def rmsd(x,y): Nx = len(x) Ny = len(y) if Nx!=Ny: print('WARNING! Nx...
b2d57243f58d92f69ffc5e9b7189ca9a300c50407e95e2814904c204990a537e
Python
7,314
189
from spikingjelly.logger import logger import multiprocessing import shutil from concurrent.futures import ThreadPoolExecutor from pathlib import Path from typing import Callable, Optional, Tuple from torchvision.datasets.utils import extract_archive from . import utils from .base import NeuromorphicDatasetFolder __...
c3e2caeea94cb10d981db65140ff7926fa8cda01c649ee326198bb0973648ff3
Python
7,316
220
""" Local Community Detection Algorithms Local Community Detection (LCD) aims to detected one or a few communities starting from certain source nodes in the network. This differs from Global Community Detection (GCD), which aims to partition an entire network into communities. LCD is often useful when only a portion ...
d4b07afdd8566abb84aae4283080774afdf8ed43e5a39917b5dd34f405bf19d8
Python
7,316
222
""" Compiler for the intermediate representation of a Datalog program. The :class:`DatalogProgram` class processes the intermediate representation of a program and extracts the extensional, intentional, and builtin sets and has support for constraints. """ from typing import Iterable from .expression_processing impor...
8d2a4f6ce2f7241aace5d0c991a1714e16c7215ac7f2ac5da45f8189e4ee8f6f
Python
7,318
173
import numpy as np import pickle import torch from torch.utils import data from torch.utils.data.dataset import TensorDataset from torch.utils.data import DataLoader from torch.nn.utils.rnn import pad_sequence from sklearn.preprocessing import StandardScaler torch.set_default_dtype(torch.float64) class MyDataset(da...
09ac86f14bac60fd5c5519466736dd447280e7b6a8510f822df5ab0e1b7d0d69
Python
7,320
201
# 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,...
855c139b550efdd46a026a6bfc8bbb2b22e9f1aab69c9f4aab55f2857d983876
Python
7,321
226
import pathlib import subprocess from concurrent.futures import ProcessPoolExecutor, as_completed import numpy as np import pandas as pd import pysam import xarray as xr import yaml from ALLCools.mcds.utilities import write_ordered_chunks from ALLCools.utilities import genome_region_chunks from .rms_test import ( ...
bb79c09bf6a2017eb933b1edca52aead45dee422b74256a7589e54b12e3fe5e9
Python
7,322
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...
b8e19682523df4616fcc35ae61bf09301b222303815503eda9bf4d4ee658707e
Python
7,326
225
import numpy as np import random import os import sys sys.path.append("../") import pyedflib from constants import INCLUDED_CHANNELS, FREQUENCY, ALL_LABEL_DICT from scipy.fftpack import fft from scipy.signal import resample, correlate def computeFFT(signals, n): """ Args: signals: EEG signals, (numbe...
1abfee1c0928b288931337165d64375c6be20fdd9fb4983e4fa72f202ef00061
Python
7,331
194
#### tests for scripts/run.py #### # this is a long test, if want to exclude it for quick testing, run # pytest -m "not slow" # tested functionality: # load_config, save_config # overall training / evaluation functionality # creation of expected folders when iterating over network or data parameters # evaluatio...
ff56b6087a49f991bb3794e0ffbdd6cde0fba7334ec622b42c99b6b5dd63d0a9
Python
7,331
277
from typing import Literal, Optional import torch from torch.autograd.function import once_differentiable from spikingjelly.activation_based import surrogate from .. import surrogate_runtime as surrogate_objects from ..native_loader import _native_available from ..projection import ( _check_forward_inputs, _...
36bf2cce2aaafc339f99eb33f7b61e4cac68efa9ee38591d6c3971435cd776c4
Python
7,333
169
from .strategy import Layered, PlacementStrategy from ..helpers import assert_attr_array import math, numpy as np from ..exceptions import * from ..reporting import report, warn class Satellite(PlacementStrategy): """ Implementation of the placement of cells in layers as satellites of existing cells Plac...
bdb6f527ba41c353b0e86f6fe9adab2061a56bf9245b41f3d59a9e9cc93d703f
Python
7,333
195
import random import time import networkx as nx import numpy as np from gensim.models import Word2Vec from cogdl.utils import alias_draw, alias_setup from .. import BaseModel class Node2vec(BaseModel): r"""The node2vec model from the `"node2vec: Scalable feature learning for networks" <http://dl.acm.org/cit...
5b56c274364047d89623ec2557f39e363c85272e8200bb55e19192c7cf82de03
Python
7,334
108
import os import pandas as pd import pathlib from ..preprocess import base_dataset from ..utils import helper_functions, check_functions from ..model import _model_functions def post_generate_feature_importances(results_directory_genotype_level: str, data_dir: str): """ Post-generate the feature importances...
69d8b3bdff5a56a54c1fe27a3e4a41cc8d6e5c112036eb6437115a630d416489
Python
7,335
289
from statistics import mean import pandas as pd import numpy as np import glob import os import nilearn.signal import matplotlib.pyplot as plt from scipy import stats import pingouin as pg import seaborn as sns from scipy.stats import bootstrap ##################################### # arrg=np.array([[[[1],[2]],[[3],[4]...
da8ee77ee23b062c0cccb52246119a6c6751f419d033a5c9619e170eec36247e
Python
7,339
205
from sqlalchemy import DDL # function name prefix fn_prefix = "fn_audit_history_by" # channel used by pg_notify so HistoryAuditMonitor can LISTEN for updates NOTIFY_CHANNEL = "galaxy_history_update" # map between source table and associated incoming id field trigger_config = { "history_dataset_association": "his...
3573e2ec064a219aafb53db2701006ab7e94babcbd60a8413a1764b6b80fd8f4
Python
7,340
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...
93cd37d89e08b59e1a14778eada3a9885f32e1a3e6d8ed60e3852f51fad02608
Python
7,343
212
""" Tests for the temporal aspect of the Temporal VF2 isomorphism algorithm. """ from datetime import date, datetime, timedelta import networkx as nx from networkx.algorithms import isomorphism as iso def provide_g1_edgelist(): return [(0, 1), (0, 2), (1, 2), (2, 4), (1, 3), (3, 4), (4, 5)] def put_same_time(...
1118891efd7a6f9831649bff171b9fd80eca4b0ae9ec4cb1974dc24ea10a52db
Python
7,348
225
"""The Möbius weights of inclusion-exclusion, computed with a containment test that is not complete, see doc/inclusion_exclusion.rst. """ from fractions import Fraction from random import Random import pytest from nl_expr.exceptions import NonLiftableException from nl_expr.expressions import Symbol from nl_expr.logic...
c08e34d35ae1bb9e2f269bb88c71b5dfdf00852f659f7d2108c22454aa510135
Python
7,352
192
#!/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...
975360bb3cfaf05bfdd459c04fbcbb0741974a88def6ea1688e6c7a3b4e58863
Python
7,354
268
import pytest from networkx.utils.mapped_queue import MappedQueue, _HeapElement def test_HeapElement_gtlt(): bar = _HeapElement(1.1, "a") foo = _HeapElement(1, "b") assert foo < bar assert bar > foo assert foo < 1.1 assert 1 < bar def test_HeapElement_gtlt_tied_priority(): bar = _HeapEl...
7d08ad9e635032cbe0e2d140a35d4c2f2c528c758b0fac6f79b538ee8f5588b8
Python
7,355
234
"""Tests for the pretty-printer of named relational algebra plans.""" import operator from typing import AbstractSet from nl_expr.expressions import Constant, FunctionApplication, Symbol from ...utils.relational_algebra_set import NamedRelationalAlgebraFrozenSet from ..pretty_printer import PrettyPrinter, pretty_repr,...
c4a1a339fb367cefe27b0f4cf56fa382afeb23fbafd41c956f4d7b99527c8163
Python
7,355
242
import logging import sys from functools import partial import numpy as np import tqdm from sklearn.base import ( BaseEstimator, ClusterMixin, TransformerMixin, clone, ) from sklearn.utils.validation import check_is_fitted from divik.cluster._kmeans._core import KMeans from divik.core import configura...