sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
45e6b13938eba728e1a8768d0c24e974a4d0018d54bb1cf677740b58c9205c81
Python
7,836
224
import json import pickle import dgl import numpy as np import torch from scipy import sparse from torch import nn def get_noed_label(): NCI_set_path = "NCI_node_set_entrez.txt" with open(NCI_set_path, 'r') as fin: lines = fin.readlines() # 获取每个node的set node_entrez = [] ...
877e72f0175c6f8bf700aaed302bb7eb803c18c8bdb6c6edc68d345b165fe67b
Python
7,837
202
# 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 final import numpy as np import pandas as pd import plotly.express as px from ax.adapter.base import Adap...
335284795ca47492af968a84d19413a53e4f01ddbf6816aeeb10399e79123002
Python
7,838
212
import datetime import logging import math from sqlalchemy import text TMP_TABLE = "tmp_unused_history" ASSOC_TABLES = ( "event", "history_audit", "history_tag_association", "history_annotation_association", "history_rating_association", "history_user_share_association", "default_history_...
724535aa55fc10a936e019196417bbe2451f8fabe18095b4dd44d9a00fac904a
Python
7,840
175
# -*- 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 newFo...
c182af5d915344e6e7e094a3f999a2fe9156365c0fa476a15a41e967a7289b5c
Python
7,841
242
# -*- coding: utf-8 -*- """PSF module Generates an LSM point-spread function """ # Created on Thu Mar 21, 2020 # 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@Univer...
eea5ee7aecbc47bdd7100cf98f40825ce249684f5be1da662b40b6bd7abf0ce3
Python
7,841
184
import numpy as np import tensorflow as tf from Dilationlayer import Dilationlayer,CNNlayer from tensorflow.keras.layers import Input,GlobalAveragePooling2D,GlobalMaxPooling2D,SpatialDropout2D import os from InceptionA import InceptionA from InceptionB import InceptionB from InceptionC import InceptionC from InceptionD...
96c2a6ed6af17cc7b70473f4232ee7a809f0f0dd7ccea8864beec61503e94cd5
Python
7,843
188
from __future__ import annotations from dataclasses import dataclass from typing import Literal, Optional @dataclass(frozen=True) class PrecisionConfig: mode: Literal["fp32", "fp16", "bf16", "fp8"] = "fp32" fp8_recipe: Literal["auto", "delayed", "current", "block", "mxfp8"] = "auto" neuron_storage: Optio...
9ff253b6e928d793080fa092052f29097224f5ddc665a490d99be6bf1fe15483
Python
7,844
224
import json import pickle import dgl import numpy as np import torch from scipy import sparse from torch import nn def get_noed_label(): NCI_set_path = "Reactome_node_set_entrez.txt" with open(NCI_set_path, 'r') as fin: lines = fin.readlines() # 获取每个node的set node_entrez = [...
c9765a1780207e8c067e39d4a5f1fc5269e478f0e24a1792894b36530357e379
Python
7,846
194
# coding=utf-8 # Copyright (c) HISSL Contributors try: import h5py except ImportError: raise ValueError("You must have h5py installed to run this script: pip install h5py.") from pathlib import Path # Idea of this script is to take the TCGA-CRCk or TCGA-BC features saved per tile in h5 format and output them ...
11af216cb3853f66875fb37b3dc3637e4ff6afac0faddfc35d8d6734dea95ec8
Python
7,848
214
import pytest import sklearn.metrics from himalaya.backend import set_backend from himalaya.backend import ALL_BACKENDS from himalaya.utils import assert_array_almost_equal from himalaya.scoring import r2_score from himalaya.scoring import l2_neg_loss from himalaya.scoring import correlation_score from himalaya.scori...
dbebdd34012f62cec57964461c91c36e660d7e372146f1976112e614fc372605
Python
7,848
205
# NICE # Copyright (C) 2017 - Authors of NICE # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program ...
9e9d55d9cb5ae11843a4a02fd0c7138fddba8dc421f3cec6974dae70926ab244
Python
7,850
212
# 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 re from collections.abc import Sequence from typing import final from ax.adapter.base import Adapter from ax.analysis...
0c8476a53dcb3b3d774720e042d1ab0db58c6cba06db3828f37a73bd1e3bd4cc
Python
7,851
184
import tensorflow as tf import numpy as np import os from data_reload import * # REGULARIZER = 0.01 BATCH_SIZE = 10 def compute_accuracy(v_xs, v_ys): global prediction y_pre = sess.run(prediction, feed_dict={xs: v_xs, keep_prob: 1}) correct_prediction = tf.equal(tf.argmax(y_pre, 1), tf.argmax(v_ys, 1)) ...
307d65fbd4704588032b02ad95e4941fc14d9cffc08da61c3d446db91dc7565a
Python
7,852
271
from decimal import Decimal import anndata import numpy as np import pandas as pd import seaborn as sns import xarray as xr from sklearn.neighbors import LocalOutlierFactor def _density_based_sample(data: pd.DataFrame, coords: list, portion=None, size=None, seed=None): """Down sample data based on density, to pr...
8fdc434ea013bc74d217caaa5d473d10ebde59a9772c41d24f80016897d7a3a0
Python
7,858
232
from typing import Mapping, Union import numpy as np from torch import optim import torch import logging import anndata from torch.utils.tensorboard import SummaryWriter import torch import torch.autograd as autograd import torch.nn.functional as F from scNTImpute.models import BaseCellModel, BatchClassifier from scNT...
cdf0a3a270680d98947e21f81861dddb85ad7aec5ad1106f137683eef740e388
Python
7,861
172
""" Predict TF binding with a maxATAC model """ import logging import os import glob import timeit import pandas as pd import multiprocessing import pybedtools from multiprocessing import Pool, Manager from maxatac.utilities.system_tools import get_dir, Mute with Mute(): from maxatac.utilities.genome_tools import ...
f75ff5c5a336d1ff824b07ddaa5fff7c323c7776ace011de4cc02f1bb9d9d83c
Python
7,861
174
# -*- coding: utf-8 -*- """ Watch three external tool catalogues for entries that are not on the Related Software page yet: * OpenBehavior (https://edspace.american.edu/openbehavior/) -- projects in its video-analysis and home-cage categories, read from the site's public WordPress API; * the Home Cage Monitoring Tec...
746aad8200f5abc45535c7f96bfac1a6d943ed67a8d9db656ea2bac54aebc383
Python
7,864
280
"""Connected components.""" import networkx as nx from networkx.utils.decorators import not_implemented_for __all__ = [ "number_connected_components", "connected_components", "is_connected", "node_connected_component", ] @not_implemented_for("directed") @nx._dispatchable def connected_components(G):...
9e9ec9b4eba0b418ea4ce47b5bbbb0a12b5e3101e46579966dcbb7bfd8b103ed
Python
7,865
219
import sys, os, time from oct import * import logging from PyQt5.QtWidgets import QApplication class processHandler(): """ Handles the argument cases for cmd line automated processing""" def __init__(self): self.directory = '' self.state = '' self.toggleRange = 1 self.startFram...
42969387ffb36af181617116d008df0d0346a0a9729b49defab5ba6a07dce020
Python
7,866
202
""" Created on Oct 13, 2022. @author: voodoocode """ import numpy as np import scipy.spatial import finnpy.src_rec.utils # @UnresolvedImport def _tessellate_sphere(vert, faces, level): """ Inflates the sphere. Parameters ---------- vert : numpy.ndarray, shape(initial_vtx_cnt, 3) ...
5fec1f12ec544df152fddf356750f56dcc4598b154d95c318ba79e585320021d
Python
7,867
171
import logging from typing import TYPE_CHECKING from galaxy import model from galaxy.jobs.runners import JobState from galaxy.util import now from ._safe_eval import safe_eval if TYPE_CHECKING: from galaxy.app import GalaxyManagerApplication from galaxy.jobs import ResubmitConfigDict from galaxy.jobs.runn...
240476b54abdfa03281d1f0ac8f0fd4376c11dbabfa305bea57a86166f470793
Python
7,869
251
from __future__ import annotations import importlib import sys import types from contextlib import AbstractContextManager, nullcontext from importlib.metadata import version from typing import TYPE_CHECKING import dask.array as da import h5py import numpy as np import pandas as pd import pytest import zarr from packa...
515b8a056328610ecb4f7a363643917cb3d2c907fdb3092d273f78028cfdf6e4
Python
7,869
214
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import datumaro as dm from django.conf import settings from django.db import transaction from rest_framework import serializers from cvat.apps.consensus.intersect_merge import IntersectMerge from cvat.apps.consensus.models import ConsensusSettings f...
90108a8af6baf949ab03b278b872c8aac9b26b0aa576ceb13f7c868bab0a201a
Python
7,869
216
# -*- coding: utf-8 -*- import ctypes import os import math import numpy as np import numpy.ctypeslib as ctl import matplotlib.pyplot as plt import sys import tqdm def debugPrint(msg): sys.stdout.write(msg.decode("utf-8")) return 1 # also print using OutputDebugString on C++ side class NativeAPI: def _...
b05fa91be461ec885702070b12478c42fd8c8a26b06b3a6d0da9ca15cca00bb7
Python
7,871
218
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict from __future__ import annotations from abc import ABC, abstractmethod from collections import ChainMap from collections.abc...
d0b0658bb1e5772eefc6de32ee14fb28ac582e58313ad4592576c2e23185ec20
Python
7,871
213
#emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- #ex: set sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See the COPYING file distributed along with the smile package for the # copyright and license terms. # ### ### ### ### ### ### ### ...
702d9f11a9a62f468535470d6ad475827a5a6add358fb3614003b7da0bccada3
Python
7,879
187
# 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...
c83a7161ab7de5d43774912de9210e4d3797154c507f662ce6e7c327be07319d
Python
7,880
238
"""Reusable helpers for migrating Custos authentication tokens into PSA format.""" from datetime import datetime from typing import ( cast, Optional, ) import jwt from sqlalchemy import ( Column, DateTime, Integer, MetaData, select, String, Table, Text, ) from sqlalchemy.engine...
daa2d6ee2457b075b256f7cf6a875fc9d403b55d8267c3c71d91ae73b851a0f1
Python
7,880
192
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...
6455797d2f60e753a7fdf07902345c3f33379b19b77494858c8881a51a013cb4
Python
7,890
229
import pathlib from typing import Union from matplotlib.axes import Axes from skimage.io import imread from skimage import feature, color, filters from skimage.util import img_as_ubyte import numpy as np import matplotlib.pyplot as plt import os from matplotlib.figure import Figure from matplotlib import gridspec from ...
aa6f025fc6af3ec1c63ceb6cb3e646f509d2944aeada9a26b76f3010cda2ab66
Python
7,894
231
# -*- coding: utf-8 -*- """ MeasureRadius ============= Measures intensity decays at spcified points in the data. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)' __copyright__ = 'Copyright © 2020 by Christoph Kirst' __webpage...
82ef6e632e250fd76e114b23814dfd2baf271002d2daff12fca9be8e2e099c73
Python
7,897
195
# % Statistical test for kernel conditional independence of X and Y given Z with # % incomplete Cholesky factorization for low rank approximation of Gram matrices # % # % Arguments: # % X n x p vector of data points # % Y n x m vector of data points # % Z n x r vector of data points # % alph...
6c9c5e5927bead374c38cd997676b2a0457d9d415519dbe25587e09e30765433
Python
7,898
236
#!/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 json from copy import deepcopy from logging import Logger ...
f40eeffaec05ea2334932d0e706406acef5e9f0fad353bea13d6226245ffda56
Python
7,898
199
import pytest import numpy as np import sklearn.linear_model import sklearn.model_selection import scipy.linalg from himalaya.backend import set_backend from himalaya.backend import ALL_BACKENDS from himalaya.utils import assert_array_almost_equal from himalaya.scoring import r2_score from himalaya.kernel_ridge impo...
1c02c147bd2fecd400ef9032a097c10dd337e7bbc1171cd3b297e8b85bb633ce
Python
7,899
240
# -*- coding: utf-8 -*- """ Created on Fri Nov 22 08:38:28 2019 @author: Amelie Aussel """ from brian2 import * defaultclock.dt = 0.01*ms prefs.codegen.target = 'numpy' eq_TC_mdPul=''' dV/dt=(-INa-IK-IL-IKL-IH-ITLT-J-Isyn-Iapp-Itheta)/Cm_TC : volt J : amp * meter ** -2 Itheta = amptheta * int(...
d54cbc31ef90f0b94708412ca9a8886b0ab24df50090f271275c4d45efb60b7d
Python
7,906
168
import abc import torch from torch import nn from torch.nn import functional as F import numpy as np def reservoir_sampling(samples_so_far, budget): '''Reservoir sampling algorithm to decide whether an new sample should be stored in the buffer or not.''' # If buffer is not yet full, simply add the new sample...
82da1b4deec142a0807001b49142952181cd9eac72da7947af6278d565f65e57
Python
7,908
252
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 11:35:36 2019 @author: aaussel """ from cells.RE_mdPul import * from cells.TC_mdPul import * from scipy import signal prefs.codegen.target = 'numpy' defaultclock.dt = 0.01*ms runtime=3*second start_scope() def create_mdPul(N_TC,N_RE): HTC_A=NeuronGroup(N_TC,...
887ced3b16275895400c9b507c1d223ce67788939b33fd916b8c881d0bf25a29
Python
7,915
380
from typing import AbstractSet import pytest import numpy as np from nl_expr.exceptions import ForbiddenUnstratifiedAggregation from nl_expr.expression_walker import ExpressionBasicEvaluator from nl_expr.expressions import ( Constant, ExpressionBlock, NeuroLangException, Symbol, ) from nl_expr.type_s...
513cecc02d656a66443d2cee04ca69fbc58b562b912af41ee1e0a985c25493c9
Python
7,916
199
"""Unit tests for the :mod:`networkx.algorithms.structuralholes` module.""" import math import pytest import networkx as nx from networkx.classes.tests import dispatch_interface class TestStructuralHolesNoScipy: """Unit tests for computing measures of structural holes. The expected values for these functi...
c76236364709d552bce4888809b929d24f240d47c982ccf9cb63234ca396cfba
Python
7,916
188
import ipaddress import logging import os import socket import tempfile from typing import Optional from urllib.parse import urlparse from galaxy.exceptions import ( AdminRequiredException, ConfigDoesNotAllowException, RequestParameterInvalidException, ) from galaxy.files import ( ConfiguredFileSources...
e052b6c6bc6fe46f0e8d76a6b1f9086e3ff046f2610c2f392a1c81a90cbd14d0
Python
7,920
225
''' Tools for monitoring KK as it runs MonitoringServer and MonitoringClient are lightly adapted from Brian (briansimulator.org). ''' try: import multiprocessing from multiprocessing.connection import Listener, Client except ImportError: multiprocessing = None import select import inspect from six import ...
b2757b647a95f8d861b97c8d9e30184f509d910bc44da033a5907ca0d6e44db2
Python
7,925
257
# ---------------------------------------------------------------------------- # build_region_matrix.py # Author: Antoine Beauchamp # Created: January 31st, 2022 """ Build a gene-by-region expression matrix Description ----------- This script imports a gene-by-voxel expression matrix from a CSV file and aggregates th...
0292b4319566cd9733a8e667fd28a34d5c17c9e7b147b71b04ca0461e60947d2
Python
7,926
172
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. """ import os os.environ["MKL_NUM_THREADS"] = "1" os.environ["NUMEXPR_NUM_THREADS"] = "1" os.environ["OMP_NUM_THREADS"] = "1" import numpy as np import cellranger.analysis.constants as analysis_constants import cellranger.analysis.diffexp as cr_diffexp i...
f7029666ec0b3d9ac700cf59c50af8cb4a43bef501f269ad15432de8c56c99df
Python
7,928
361
#!/usr/bin/env python # coding: utf-8 # # Data analysis for our study on the transparency and open science standards in the policies of medical and health science journals # The protocol and details of our study is openly availble via the OSF [here](https://osf.io/h2xud/). # In[1]: # import libraries required for ...
174421f8a66b1611b7ce584e4578756300fb08e369ae9451f5d2062eca2f2fac
Python
7,931
281
""" Tools for quickly creating a simple websummary, with embedded figures. Copyright (c) 2019 10x Genomics, Inc. All rights reserved. """ import os import base64 from StringIO import StringIO CSS = """ /* Style the metric tables */ table { border-collapse: collapse; } th, td { padding: 15px; } tr:nth-child(e...
f4b072704a7abea66ad57013da99da92c58cd3d1b5e8561591b64a93769d9d72
Python
7,933
239
# 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...
78c90934960ebd74d5ad60e704a3daf57c1547008302758279552b45b5ad6b82
Python
7,940
256
import matplotlib as mpl import seaborn as sns from matplotlib.cm import get_cmap from matplotlib.colors import Normalize from scipy.cluster.hierarchy import dendrogram as _dendrogram def straight_branch(ax, a, b, plot_kws): """Draw link line between a and b.""" a_x, ay = a bx, by = b branch_x = [a_x,...
8adfd6c308b4601034cddf5cc9a9b52242845d2ccba909d5e83f43b47bb55420
Python
7,940
184
import numpy as np import csv from ..strategy import ConnectionStrategy from ...reporting import report, warn class ConnectomeDcnGlyGolgi(ConnectionStrategy): """ Implementation for the connections between mossy fibers and glomeruli. The connectivity is somatotopic and """ def validate(self): ...
b784e0da316f5a18c2ed77821faa2bd9a0098ad13f2225b1afbcfb524a9621d6
Python
7,941
344
from ...expressions import Symbol from .. import ( FALSE, TRUE, Conjunction, Disjunction, ExistentialPredicate, Negation, UniversalPredicate ) from ..transformations import ( AbsorbAssertedConjuncts, AbsorbAssertedConjunctsInNegations, LogicExpressionWalker, PushExistentialsD...
0f4a67bb0711605847df249d38e0209da873a528de6bf58db2f2f88895c8f3c7
Python
7,942
271
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...
edce9d2f83930c7e064f3fb25a742805388d71016a374f3d018528553e8b76dd
Python
7,943
205
from warnings import warn import igraph as ig import leidenalg as la import networkx as nx import numpy as np import pandas as pd def sdi(data): """ Calculate the Shannon Diversity Index (SDI) for a categorical data series. Higher SDI indicates higher diversity. """ if len(data) == 0: re...
72a67ddd7875b7dd401cda9863681cad0870ace81c65018b53f19faaeaf71754
Python
7,948
182
#!/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 math from typing import TYPE_CHECKING import numpy as np f...
8edf25f557022d0ca1f9d480b7cf9e5d6d33b4fbcc4d54d9b6a8d8ea4606ebde
Python
7,956
230
import random import time import numpy as np import scipy.sparse as sp import torch import torch.nn.functional as F from ..base import InjectionAttack from cogdl.utils.grb_utils import eval_acc, feat_preprocess, adj_preprocess, getGraph, getGRBGraph class RAND(InjectionAttack): r""" Description --------...
4b47852f9aa257846e916a6b87f8f0be95d5f51b7bbf141b9aec032c9848c4ea
Python
7,957
176
# -*- coding: utf-8 -*- ''' Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie CUDA_VISIBLE_DEVICES=2 python Training_Experiments.py --config_file ../MolRep/Configs/config_CMPNN.yml \ --dataset_name ogbg-molbbbp \ ...
914e5f2752b01ada35c9f68bfffe57463a651e2e74375278c5167df56496ab95
Python
7,957
293
import operator from typing import AbstractSet from pytest import fixture from ...datalog.expression_processing import extract_logic_atoms from ...datalog.translate_to_named_ra import TranslateToNamedRA from ...datalog.wrapped_collections import WrappedRelationalAlgebraSet from nl_expr.expressions import Constant, Sy...
a1f5cd8d26ddc7294720491d4b7b3caaffac5aa90b4996217ad3dc22d8095aeb
Python
7,960
193
""" Methods for doing peakcalling. Copyright (c) 2019 10x Genomics, Inc. All rights reserved. """ from __future__ import division, print_function, absolute_import from collections import namedtuple import numpy as np from scipy import stats from analysis.em_fitting import ( MLE_dispersion, MLE_geometric_parameter...
f132054c20e60052339cd79f94df1e96207097c2e12e361dc68dc4b30932cb32
Python
7,960
266
from enum import Enum from typing import ( Literal, Optional, ) from pydantic import ( Field, RootModel, ) from galaxy.schema.fields import ( EncodedDatabaseIdField, ModelClassField, ) from galaxy.schema.schema import ( GroupModel, Model, UserModel, WithModelClass, ) QUOTA = L...
c1e93874bf967eda0f376a58812e218e446249d947421639a140e44dc6ac9dbf
Python
7,961
211
""" Shared model and mapping code between Galaxy and Tool Shed, trying to generalize to generic database connections. """ import logging import os import threading from contextvars import ContextVar from inspect import ( getmembers, isclass, ) from types import ModuleType from typing import ( TYPE_CHECKING...
29fb515142648f7b00f144b14d7923ab0052ff7447855a91d8df89095c5d9c3c
Python
7,964
271
"""General utilities""" import os import glob import subprocess from datetime import datetime import natsort import numpy as np import pandas as pd import pingouin as pg import nibabel as nib from brainspace.mesh.mesh_io import read_surface import bct from neuromaps import images from adaptman.config import Config ...
65d73737bcee366d8208eaa48cddaaabb455d2bc6bf58c3eccc27b4fefda8b49
Python
7,973
211
""" Regression tests for all NIST SP 800-22 test modules. Two categories: - Regression tests: run each module against the deterministic binary expansion of e (data/data.e, 1 000 000 bits) and verify p-values match known-good results to 6 significant figures. - Guard tests: verify that each module returns t...
93181af9248743df86f2653116cd7dfef266c9d3dd829530e65ca8feac1a9426
Python
7,974
254
import numpy as np import torch from .base import FactorCollection from .base import VideoWrapper from .factor import TensorFactor class Video(VideoWrapper): """ Manages Unrolled Tensor and multiplication with a Full Video """ def __init__(self, video_shape, device='cuda'): ...
ef024d266589a0bf9f1b5d6029ddde5768b8b17dff47824cf23702e6a8f4a4b2
Python
7,975
223
import os from nipype.interfaces.utility import Function, IdentityInterface import nipype.pipeline.engine as pe from .utils import get_scrub_vector_node, logical_or_across_lists, expand_scrub_dict from .image_workflows import ( build_image_postprocessing_workflow, STEP_CONFOUND_REGRESSION, STEP_SCRUB_TIME...
5e1a4468b840cd2092ba337b0216516a134539aa62c42100121f7d7ccae3654f
Python
7,977
231
from __future__ import division import numpy as np from fanc.regions import Chromosome, Genome, RegionsTable from genomic_regions import GenomicRegion import pytest import os.path import tables as t class TestChromosome: @classmethod def setup_method(self, method): self.chromosome = Chromosome(name=...
9551355a76a6fc25778efe7bd39d613b7681cf7b3484b928b8a25f025cb25c33
Python
7,983
254
import numpy as np import torch from .base import FactorCollection from .base import VideoWrapper from .factor import TensorFactor class Video(VideoWrapper): """ Manages Unrolled Tensor and multiplication with a Full Video """ def __init__(self, video_shape, device='cuda'): ...
a20fba511052adfc16640cd09e79abcc9d8773a8c264ffd429d532d194a5c82e
Python
7,983
197
# 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 pandas as pd from ax.analysis.healthcheck.baseline_improvement import BaselineImprovementAnalysis from ax.analysis.he...
20789d144bfb308efcd73b1d93b5d3f38f2b2ef2f00e4db004ad458cbf8246fe
Python
7,985
241
from itertools import chain, combinations import pytest import networkx as nx def test_directed_not_supported(): with pytest.raises(nx.NetworkXNotImplemented): # not supported for directed graphs test = nx.DiGraph() test.add_edge("a", "b") test.add_edge("a", "c") test.add...
6280fe3e0b9866211f40ed2f7f1817d76e6360d2813f9305f1722b56a9250a9b
Python
7,985
200
# 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 final import pandas as pd from ax.adapter.base import Adapter from ax.adapter.random import RandomAdapter...
94d184238ee23c5e517bd5b024bc11c71213eccce9c3826cedb459061dcb21dd
Python
7,985
264
import shutil from pathlib import Path import click from . import _manager, _mpi from ._fs import clear_cache, get_cache_path, get_local_pkg_path from ._local import create_local_package from .assets import ModName from .exceptions import * from .packaging import PackageManager @click.group() def glia(): pass ...
037a3a61f9c575c66bf117dd566e227ac49675dddc1e3bc52c8b3fbb7e960011
Python
7,986
260
# 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...
e64713a670ff8c6561902a72b12a59cf7a202248d0f385c33189c0ebec31b4b6
Python
7,989
186
# coding: utf-8 # 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"...
87e8f2b4565de90032d9d738097beb438bbb4c54a54e566ac41138c0027615e8
Python
7,997
238
import torch import sys import torch.nn.functional as F from torch.cuda import amp from spikingjelly.activation_based import functional, surrogate, neuron from spikingjelly.activation_based.model import parametric_lif_net from spikingjelly.datasets.dvs128_gesture import DVS128Gesture from torch.utils.tensorboard import...
97e7d8313b0d64522157e731fc5065cc48ead37b3701219e0e0ed0c9d77c313c
Python
8,006
207
import pandas as pd from tensorflow.keras.models import Model import numpy as np from sklearn.model_selection import train_test_split, KFold from sklearn.metrics import accuracy_score from tensorflow.keras.optimizers import Adam, SGD import os import random from sklearn.model_selection import train_test_split...
f21e524df25bc62a0c0b90b5ea64c75030dfce969d9ee8a1432aef84bff26c88
Python
8,008
248
''' Created on Aug 5, 2020 @author: voodoocode ''' import finnpy.misc.timed_pool as tp import time import numpy as np import multiprocessing import psutil import joblib import matplotlib.pyplot as plt import finnpy.filters.frequency as ff import finnpy.data.paths as paths def demo_fnct2(data): data2 = ff.f...
52c4f10c885070cc51524e7e9646baf05806e64d46cb6c793e4d4b7f79f21d10
Python
8,010
196
"""Correlation of each synthetic test EEG data features (EEG_channels x EEG_time_points) with the corresponding biological test EEG data features (across the 200 test image conditions), and noise ceiling calculation. Parameters ---------- sub : int Used subject. encoding_type : str Whether to analyze the 'linearizin...
ea831e3940f1523e39128c86d830a8b75aab61357bde444112fb62ddd02c2eb3
Python
8,013
225
"""Tests of the resampling of a probabilistic choice, ``RESAMPLE``.""" import numpy as np import pytest from nl_expr.exceptions import ForbiddenExpressionError from neurolang.frontend import NeurolangPDL from neurolang.frontend.resampling import resampling_ratios STUDIES = [f"s{i:02d}" for i in range(12)] RNG = np.ra...
41933c27070f11af349cc74769fd2e4a86e3a72df0ee31f8f0f75138117ad28d
Python
8,020
217
# 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...
10e806105d63d8860827841e8aaea0d498a1520b1dce20a697a05a83f71d2e7a
Python
8,023
206
# -*- coding:utf-8 -*- import time import pytest import tensorflow as tf from sklearn.model_selection import train_test_split from keras import backend as K from keras import layers import keras from deeptables.datasets import dsutils from deeptables.models import deepnets from deeptables.models import deeptable from...
46c60880b88644d65ba8832582b0983701a630f6fb6c6a16e8551c69b3df8ee3
Python
8,023
157
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import torch.nn.functional as F from .basic_conv import * class Inception2d(nn.Module): def __init__(self, in_channels, pool_features): super(Inception2d, self).__init__() self.branchA = BasicConv2d(in_channels, pool_feat...
9b7c3185f957b1ec9021974a6fa2ece0e6a6c5e76d719be5534039f78e7fa0c2
Python
8,023
167
from __future__ import print_function import os import sys import pdb import copy import sklearn import tensorflow as tf import pandas as pd import PIL import numpy as np import keras from keras.models import load_model import function as func import function_dl as func_dl def cnn_prediction(cnv_file, model_file, use_...
9c8634ffe4797b4948277a69ca599cd6e3f37d8bedca937c56c092e9e423dda6
Python
8,024
212
import tensorflow as tf from learnMSA.legacy.Utility import deserialize class Bidirectional(tf.keras.layers.Layer): """Simple bidirectional wrapper for forward and backward RNNs with shared state. Args: layer: `keras.layers.RNN` instance. merge_mode: Mode by which outputs of the forward and b...
7852c9188a26287f79016880db4e9d7f9001d8c8f9a662b35282b93a1688fe54
Python
8,026
218
import os import csv import shutil import torch import torch.nn as nn from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from torch.optim import Adam from dataset.e_piano import create_epiano_datasets, compute_epiano_accuracy from model.music_transformer import MusicTransformer from...
8b883498a69a43d45aa36addb583987fa67396d88a20408fea527cdc57cb61db
Python
8,030
178
from typing import TYPE_CHECKING from sqlalchemy import ( literal, union, ) from sqlalchemy.sql import ( expression, select, ) from galaxy import model from galaxy.managers.base import get_class if TYPE_CHECKING: from sqlalchemy.orm import scoped_session class JobConnectionsManager: """Get ...
1d608b47f71ee3580c199ebb0ac682530e2191077aa4709daf1d0c0195634e0a
Python
8,035
168
""" Functionality for dealing with dbkeys. """ import logging import os.path import re from json import loads from typing import ( Optional, ) from sqlalchemy import select from galaxy.model import HistoryDatasetAssociation from galaxy.model.scoped_session import galaxy_scoped_session from galaxy.util import ( ...
6c82b8ce47db3006f022fd66a0c2809257162f178dd960f634d72bbe3349d071
Python
8,040
206
# 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...
c35e29c168404069032f294c18c9e72f1010aeae0a020cc74f759ae5449df2d0
Python
8,042
203
# %% import import sys, os, platform from src.pipelines import ComputeMinimumControlEnergy from src.plotting import my_bsci_pair_plot from src.utils import rank_int, get_null_p, get_fdr_p from src.utils import get_bootstrap_indices from brainsmash.mapgen.base import Base from tqdm import tqdm # %% import workspace os...
e2c311d1bd796a35865614a71432ba413a5622cdc9404259ef4a9f90cfed5ed8
Python
8,043
206
import pandas as pd from keras.models import Model import numpy as np from sklearn.model_selection import train_test_split, KFold from sklearn.metrics import accuracy_score from keras import optimizers import os import random from sklearn.model_selection import train_test_split, KFold from sklearn import metri...
4923b96887df2ffa191f800a2e73a1c637d3975965efe0740e9ea8bb53cf5a9e
Python
8,048
279
from qtpy.QtWidgets import ( QMainWindow, QLabel, QVBoxLayout, QPushButton, QWidget, QListWidget, QHBoxLayout, QLineEdit, QTreeView, QSplitter, ) from qtpy.QtCore import Qt from qtpy import QtGui from qtpy.QtGui import QStandardItemModel from pkg_resources import resource_filenam...
53b4e6c0d8b4e0591dc25481789c2308eed29c0cb022a79b3a37f76e3f7845e6
Python
8,049
193
from __future__ import division import fanc from fanc.data.network import RaoPeakCaller, RaoPeakInfo from fanc.data.genomic import Hic, RegionMatrix, GenomicRegion from fanc.tools.general import pairwise import numpy as np import math import pickle import os.path class TestRaoPeakCaller: def setup_method(self, m...
78999632fb505c7be836473f79b14737a08125dda389c3fe6e46b3e39e494df4
Python
8,051
178
# -*- coding: utf-8 -*- import pandas as pd import os import seaborn as sb from matplotlib import pyplot as plt from matplotlib import image as mpimg import numpy as np from skimage import io from scipy import ndimage from scipy.ndimage import morphology def calculate_length_from_kymograph(path_kymograph, b...
9186e4894c4838a61eca5e4c14930200a8342d05bfc84bad3a00e70399905e74
Python
8,051
171
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Pools single-cell analyses from other stages and calculates bulk metrics from the pooled dataset. """ from __future__ import division import json import pandas as pd import numpy as np from tenkit.stats import robust_divide from tools import ReferenceMan...
d2be1d9efd67ba3483e3a6a33dc88680e79cb5a69c621e7b8d451dd5181587f1
Python
8,051
273
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...
31a3bde28110dcc51e21841779f8eb38258f4716d0104ab3d581a1d6c83cda18
Python
8,055
315
""" ========================== Bipartite Graph Algorithms ========================== """ import networkx as nx from networkx.algorithms.components import connected_components __all__ = [ "is_bipartite", "is_bipartite_node_set", "color", "sets", "density", "degrees", ] @nx._dispatchable def c...
3fc2e80935377e91e618e3dceb1fc90ba49d138a5815bb96a3fcb5b2f255bf2b
Python
8,058
234
# -*- coding: utf-8 -*- """ Created on 2022.06.20 @author: Jiahua Rao """ import os import json import numpy as np import pandas as pd from rdkit import Chem from pathlib import Path from sklearn.model_selection import train_test_split from itertools import repeat, product import torch from torch_geometric.data i...
7706b14841afb455781bab96d5d34b6dfa55f716cf0417436c7b2547514dee37
Python
8,064
197
from __future__ import absolute_import import logging from collections import OrderedDict from pip._internal.exceptions import InstallationError from pip._internal.utils.logging import indent_log from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.wheel import Wheel if MYPY_CHECK_RUNNING: ...
a4c5e7124bc350239e19d349d55c4b0d4b6fc08dab1c60091116ac8c33884ebe
Python
8,067
223
"""Current-flow betweenness centrality measures for subsets of nodes.""" import networkx as nx from networkx.algorithms.centrality.flow_matrix import flow_matrix_row from networkx.utils import not_implemented_for, reverse_cuthill_mckee_ordering __all__ = [ "current_flow_betweenness_centrality_subset", "edge_c...
7ef20e3531002c73fb32a5137bc310679a74cff2d0d5b2c7b9514a6e89dd0f53
Python
8,074
199
# 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 pandas as pd from ax.analysis.healthcheck.healthcheck_analysis import HealthcheckStatus from ax.analysis.healthcheck....
0395db76a505b0e9f7a03e2682f528f8e684075ef8eca79a3a1a0ff4dc0f2fde
Python
8,076
221
""" Tracing the requests the assistant sends to its model, and its replies. :class:`TracingClient` wraps a chat client and reports each request and reply as an event, a dict whose ``event`` key is: * ``request``: the ``call`` number, the ``messages`` added to the conversation since the previous request (from index ...
4da24bdda152c6c5e6a309924e44ee4fa44e8707a7f78101b826704855f7e33a
Python
8,079
247
import logging import os import shutil import json from fibsem_tools.io import read import dask.array as da import numpy as np from numcodecs import Zlib import incasem as fos logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) def make_config_janelia_crops(zarr_ds: str, ...
c47a331b7bc5429703194e7e6166896fdb6e2df9140c06376ffa018a8ddff307
Python
8,079
207
from nl_expr.exceptions import NeuroLangException from nl_expr.expression_pattern_matching import add_match from nl_expr.expression_walker import ExpressionWalker, ReplaceSymbolWalker from nl_expr.expressions import FunctionApplication, Symbol from nl_expr.logic import Conjunction, ExistentialPredicate from nl_core.pro...
90bb5b066d95674a4bf9425b7f07ab10bb5af4460fbad5e3d758dc12ffd46576
Python
8,081
208
"""Combines a folder of single-channel TIFFs into a multiplexed MIBItiff. Copyright (C) 2021 Ionpath, Inc. All rights reserved.""" import argparse import datetime import os import re import numpy as np from skimage import io as skio from mibidata import mibi_image as mi, panels, runs, tiff def _load_single_chann...