sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6f3d9a8929643b181b58fe18a7746038fc06350aee6ea64618730af477bdaf85 | Python | 6,151 | 165 | # 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... |
a4f61ce5b81f64f4bfce24bd3d66f0e4b0e0e3e9f634fbf8fb31497e6affd52e | Python | 6,151 | 194 | """Backend utilities for pymoten.
Provides set_backend/get_backend for switching between numpy and torch.
"""
import importlib
import types
import warnings
ALL_BACKENDS = [
"numpy",
"torch",
"torch_cuda",
"torch_mps",
]
CURRENT_BACKEND = "numpy"
def set_backend(backend, on_error="raise"):
"""Se... |
c936e0e793f6423223e40ff7a78ad9a06d46e3024bd1e8384c6d51eacd67bb56 | Python | 6,154 | 169 | """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 os
from django.conf import settings
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import extend_schema_field, e... |
ae5a846e3b5c50408b7f00d45d68e87adcd02c939659677e974b3e8f22aa8350 | Python | 6,159 | 182 | from typing import AbstractSet, Callable, Tuple
from nl_expr.exceptions import (
NotConjunctiveExpressionNegation,
ProtectedKeywordError,
)
from nl_expr.expression_walker import PatternWalker, add_match
from nl_expr.expressions import (
Constant,
FunctionApplication,
NeuroLangException,
NonCons... |
5cf49cfdab4adc0999adf9d565cf37d9883c7c8400cafffa4a61565d21532569 | Python | 6,160 | 141 | # -*- coding: utf-8 -*-
import pandas as pd
import os
import seaborn as sns
from matplotlib import pyplot as plt
import numpy as np
from scipy import stats
def change_cell_number_to_string(number):
#not needed right now since all cells are just ints
#convert int to string with cellXXXX
#where ... |
6630475c88e776ec870e2f4f3f52ae3d6767072c0365cd00511a2398b590a4b9 | Python | 6,161 | 163 | #!/usr/bin/env python3
import numpy as np
import torch
from data.load import get_singlecontext_datasets
import utils
from utils import checkattr
from eval import callbacks as cb
from eval import evaluate
import train
import options
import define_models as define
from param_values import check_for_errors,set_default_val... |
4bb0e09cce48e3a1f685d8d7f7d48b1ed030027b95d59af61eefdfb54d831d79 | Python | 6,165 | 219 | # 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... |
9cc4ec479d1ea2ec1991189279271958dec04ba05570b97909c0a244f50c6266 | Python | 6,167 | 202 | # -*- coding: utf-8 -*-
"""
Converts orientation information into image data for visulalization and analysis
"""
__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__ =... |
9aa71c3c91b5e6fb12717d58343f29c37916c77592694fa38b2713281e9b2a15 | Python | 6,169 | 153 | #!/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 typing import Any
import numpy as np
from ax.adapter import ... |
b94bc0feffaea4af5b3ef7d6ba66370a17cd60f14b365b733e0692afa71d7a89 | Python | 6,171 | 138 | 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, ... |
15b07987d2af3fd5074ce1ce18fac9c258a28ca5efb7a744ea9fefc88a8ca5b0 | Python | 6,172 | 164 | from pathlib import Path
import numpy as np
from learnMSA.util.embedding_cache import EmbeddingCache
from .dataset import Dataset
class EmbeddingDataset(Dataset):
"""
Manages a set of embeddings that are stored in a file or provided via an
embedding cache.
Attributes:
filepath (Path): The ... |
e7c97a5f7921736f1c4215cb1aa23096c63a1f24c371f543cd33a8fc4359e417 | Python | 6,172 | 172 | """
Barcode handling functions, including query functions that override tenkit query functions
(Due to changes in tags used to store barcodes)
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
"""
import os
from constants import RAW_BARCODE_TAG, RAW_BARCODE_QUAL_TAG, PROCESSED_BARCODE_TAG
from tools.io impo... |
b3547d44e9820862890fc2780c913a75f9611ccd78500312b29fc78fdcf3d5be | Python | 6,175 | 194 | """Functions for cluster based permutation tesing of RSA timecourses."""
import itertools
import operator
import numpy as np
import pandas as pd
from config import NUMBERS, STREAMS, SUBJS
def prep_for_clusterperm(df, model, orth):
"""Prepare data for cluster based permutation testing.
Parameters
------... |
068bb81cd4ffed23459ca1deca932423225fe6d3ef1e58d3fbd9f0b82b667172 | Python | 6,178 | 190 | from himalaya.progress_bar import bar
from himalaya.progress_bar import ProgressBar
from himalaya.progress_bar import _format_time
import time
import sys
import io
def test_progress_bar():
# simple smoke test
for ii in bar(range(10), title="La barre"):
pass
bar_ = ProgressBar(title="La barre", ma... |
7e3ae9b6486f5d8ca85d350c982c501e181f624af4fb6061d70fd4b0951c124e | Python | 6,182 | 162 | import pandas as pd
import multiprocessing as mp
import time
import os
from src.FindClusters import *
from src.Func import *
def _args_(input_file):
filename = os.path.basename(input_file)
name = os.path.splitext(filename)[0]
return(filename, name)
def findAllRepresentatives(line):
line = line.split('... |
eea9645db78a6f7ca8108e75f282d7d7c5de064d660164d48ff7aa4eeadb9314 | Python | 6,184 | 156 | # import libraries
import os
import time
import torch
from tqdm import tqdm
from clutils import History, logger
from typing import Any
class Trainer():
""" A simple interface for implementing classifier training """
def __init__(self, model: Any, device: Any = None):
self.device = device
self.... |
02713950a09f7cd44191085052083430dcfcc57931934f102d185f8f43571ebb | Python | 6,186 | 145 | from types import SimpleNamespace
import os
import json
from brian2lava.utils.files import scrap_folder
from brian2lava.preset_mode.abstract_model import Model
from brian2lava.utils.const import HARDWARE
from brian2.utils.logger import get_logger
class ModelLoader:
"""
Static class to create and hold a list of avail... |
169cee7cc8fda7bcc273fe15c60ed0c5bc963ff2b8abec886f501db39e9a7f7f | Python | 6,187 | 169 | """Tests of SPECTER2's query encoder in numpy, which runs in a browser."""
import numpy as np
import pytest
from neurolang_apps.utils import specter2_numpy as sn
VOCAB = [
"[PAD]", "[UNK]", "[CLS]", "[SEP]", "visual", "word", "form", "##s",
"read", "##ing", ",", "(", ")", "cafe", "un", "##known", "中",
]
@p... |
540776dff9931b229c8db5905329e54ec8f351cc0a01a94a503d42138256004f | Python | 6,188 | 212 | """Class implementing abstract Tuner."""
from typing import Dict, Tuple
import numpy as np
import pandas as pd
from extra_keras_metrics import (
get_standard_binary_metrics,
get_minimal_multiclass_metrics
)
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.models import Model
from ..m... |
1bb41a58d645a190aa42ec01f0ce1dfdd6c771e4f48e2eee7cd714cc0a7e9b24 | Python | 6,197 | 216 | from collections import defaultdict
from typing import AbstractSet, Any, Mapping
from ..datalog.wrapped_collections import (
WrappedNamedRelationalAlgebraFrozenSet
)
from nl_expr.expression_walker import PatternWalker, add_match
from nl_expr.expressions import Constant, Expression, Symbol
from ..relational_algebra... |
c626d4b5a6e77444bab3fe72522760d5307ab2a45d9a300df4fd1a509c639647 | Python | 6,197 | 170 | # 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... |
f24cfa000530cc2a4723b4134e0609a216773b95fc675ce9d10f04d64125f9b4 | Python | 6,197 | 175 | """Class implementing meta-model for a Conv1D Residual Layer.
That is, a rectangle of Conv1D layers where the first layer is connected
to the last one. This solution reduces the gradient disappearence problem
that is present in deep neural networks.
"""
from typing import Dict
from tensorflow.keras.layers import Add... |
17be34da246c9de896fc41eca2eb54b616f521b43eb05b569d6a2d9704f863ac | Python | 6,200 | 182 | # 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... |
b539ebd0026ca6c7dda5679a847f3f9d76f653e8e73a8fadd3b05ca639db4fbb | Python | 6,202 | 180 | # -*- coding: utf-8 -*-
# Imports
import torch
import gpytorch
from gpytorch.models import ExactGP
from gpytorch.kernels import MaternKernel, ScaleKernel
from gpytorch.means import ConstantMean
from gpytorch.distributions import MultivariateNormal
from sklearn.ensemble import RandomForestRegressor
from .pd_utils i... |
f53b313b33555cc380a5c1c05f91b49eaa090ab382e22e33269b1ce514eb5058 | Python | 6,202 | 121 | import os, sys, argparse, time
from lib.common.util import is_dir, is_file, die, makedir_if_not_exists, clean_dir
from multiprocessing import Pool
from tqdm import tqdm
class uniprot2geno:
def __init__(self,
con_pro_cds_dir: str,
uniprot_official_mapping_file: str,
... |
6fe05b88c34194d4c195d016eae4adddaf147c18b376009020a080779fd0ceab | Python | 6,205 | 188 | import numpy as np
import torch
from torch.nn.functional import one_hot
from ..utils import helper_functions
def get_encoding(models, user_encoding: str) -> list:
"""
Get a list of all required encodings.
:param models: models to consider
:param user_encoding: encoding specified by the user
:re... |
7610ab3d97feb650a45ea7d9ef5169435a228a49b5f8a148865e0d547901d1d3 | Python | 6,206 | 174 | from pathlib import Path
import numpy as np
import numpy.testing as npt
from voxcell import RegionMap
import atlas_densities.densities.glia_densities as tested
from atlas_densities.densities import utils
TESTS_PATH = Path(__file__).parent.parent
def test_compute_glia_cell_counts_per_voxel():
region_map = Regio... |
f03ef6fce8089628d2da4cfe276ade360c8fdeb7adc6d61067db47388e75d9e6 | Python | 6,206 | 180 | import pytest
import json
import yaml
import os
from typing import Tuple
from pkg_resources import resource_stream
from clpipe.config.options import *
"""
Removed tests for lack of fields and extra fields as this test will always pass
because we will always load the config object from the new config file only
"""
d... |
e8ce1a720518b8f50ae45f40111856a1ba464aa5363f11db2328892a4b2db089 | Python | 6,207 | 214 | __doc__ = """
Evaluation functions for scoring segments by overlap
Nicholas Turner, 2017-8
"""
import numpy as np
import scipy.sparse as sp
from .. import seg_utils
def score_overlaps(pred_clf, gt_clf, mode="conservative", to_ignore=[]):
""" Compute object-wise precision and recall scores """
overlaps, pr... |
73359b40a7d524c36a6d3798725acac1e432b1fed6aef4a9f2860f28b61a4f10 | Python | 6,209 | 190 | import functools
import logging
from typing import (
Optional,
Union,
)
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from galaxy.schema.citations import (
BibtexCitationResponse,
CitationErrorResponse,
)
from galaxy.structured_app import BasicSharedApp
from ... |
cf7b0814c3a98dad70963fa523c608e8e21b48b6561ebebab92ab25444995976 | Python | 6,209 | 196 | """
Provides functions for finding and testing for locally `(k, l)`-connected
graphs.
"""
import copy
import networkx as nx
__all__ = ["kl_connected_subgraph", "is_kl_connected"]
@nx._dispatchable(returns_graph=True)
def kl_connected_subgraph(G, k, l, low_memory=False, same_as_graph=False):
"""Returns the max... |
57d914f0bbaa78138ee70f3f95d44def02a9d77375dc59898704b179d3804fae | Python | 6,211 | 149 | # 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... |
780f8db8cc4e668b42bff83e66801661e208e0d19e5a438b133b926eb294591a | Python | 6,211 | 159 | import anndata
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix, issparse, vstack
from sklearn.cluster import MiniBatchKMeans
def _kmeans_division(matrix, cells, max_pseudo_size, max_k=50):
if max_pseudo_size <= 1:
return "|" + pd.Series(range(cells.size), index=cells).astype(str... |
87e714e8169af2ca5c4491ff5d81fc13dc0225501d40cdb8319eff4931655eec | Python | 6,211 | 130 | import math
import numpy as np
from .. import config
from ..config import types
from ..exceptions import ConfigurationError, PackingError
from ..mixins import NotParallel
from ..reporting import report
from .strategy import PlacementStrategy
@config.node
class ParallelArrayPlacement(NotParallel, PlacementStrategy):... |
9dd98579073cbe97f15c7cacdfe15526f87a4acdced451ab4fc6180c57c46ce5 | Python | 6,214 | 192 | # 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... |
f1f5a7ab18a29f8790d5f4bb9ed1717edf09c2d7a2e2a1a8129d1a1914f58df9 | Python | 6,220 | 169 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import logging
from logging import Logger
from time import perf_counter
from ax.adapter.registry impo... |
47576992b008392be198b6c31a5c672b721b09d16d262a41ab25dab40b05b373 | Python | 6,222 | 132 | import base64
from django.test import TestCase
from io_storages.utils import (
decode_resolve_fileuri,
get_all_uris_via_regex,
unwrap_storage_media_path,
)
class TestGetAllUrisViaRegex(TestCase):
"""Unit tests for the get_all_uris_via_regex helper in io_storages/utils.py."""
def test_bare_s3_uri... |
738b7952ee2a7a28c742b1becad8ad3b77a9de915060898583bc6b5fb7f0e10c | Python | 6,225 | 195 | """Torch module for RobustGCN."""
import torch
import torch.nn as nn
import torch.nn.functional as F
from cogdl.layers import GCNLayer
from cogdl.models import BaseModel
import cogdl.utils.grb_utils as utils
from cogdl.utils.grb_utils import getGRBGraph, updateGraph, RobustGCNAdjNorm
import copy
import types
class R... |
a352ac315bfaa973ec217ac09f3da81f833242f1ef2ba4590ffc24695658928d | Python | 6,226 | 186 | """
Hugging Face Hub file source plugin using fsspec.
"""
import logging
from typing import (
Annotated,
Literal,
Optional,
Union,
)
from fsspec import AbstractFileSystem
from pydantic import Field
from galaxy.files.models import (
AnyRemoteEntry,
FilesSourceRuntimeContext,
RemoteDirector... |
d4e489877d85605840558079ceac6164611764b4b41cfa7d92f7c766f5a60f7a | Python | 6,227 | 154 | """Unit tests for the :mod:`networkx.algorithms.boundary` module."""
from itertools import combinations
import pytest
import networkx as nx
from networkx import convert_node_labels_to_integers as cnlti
from networkx.utils import edges_equal
class TestNodeBoundary:
"""Unit tests for the :func:`~networkx.node_bo... |
1bf7ae80eb3df9bf9d5dc146a42b74389ea19d301cbaec05a59046824e294ba6 | Python | 6,232 | 138 | import os
import pickle
import copy
import json
import pprint
import numpy as np
from statistics import mean, stdev
from sklearn import metrics
all_accuracies = dict()
MAX_SEQ = 6
SCOPE = 20
FOLDS = 5
EXPERIMENTS_DIR = ''
BEST_DIR = ''
with open(BEST_DIR, 'r') as file:
best_dir = json.load(file)
for root, dirs, _... |
8d6eb3eacfc5ed2a3f351375c2ef83bcbe5f13095e7bec3a6c8a9799b5bfdbd8 | Python | 6,239 | 205 | from typing import Union, Callable
from abc import abstractmethod
import torch
from cogdl.wrappers.tools.wrapper_utils import merge_batch_indexes
from cogdl.utils.evaluator import setup_evaluator, Accuracy, MultiLabelMicroF1
class ModelWrapper(torch.nn.Module):
@staticmethod
def add_args(parser):
pass... |
2b5275b3905641e31f0a575a8249651201438f548657040c70cb8904f1e9fab1 | Python | 6,240 | 186 | # -*- coding: utf-8 -*-
"""
Files
=====
Module defining test data files.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'
__webpage__ = 'http://idisco.info'
__download__ = '... |
60915402d21dd2f7c97ff1f5377a31e78446900613c1f8661ff39188d0561edc | Python | 6,241 | 164 | import re
import sys
import os
import math
from Bio import SwissProt
import urllib.parse
import urllib.request
from pyfaidx import Fasta
###update the Uniprot ID via uniprot_sprot database
UniProt_ID_update = {}
for record in SwissProt.parse(open(r'E:\学术\PPI project\uniprot_sprot.dat\uniprot_sprot.dat')):
... |
3a08747b15b297c019008bbaa5f0b5aabcd2928babc4d2480f6f4651b123392f | Python | 6,243 | 141 | from .video import Label
from .state import Subroutine, If, Else, UntilDone, Loop, Wait, Log
from .audio import Beep
from .keyboard import KeyPress
from .ref import Ref
from .scale import scale as s
import random
def _gen_questions(num_vars, max_num, min_num, max_probs, plus_and_minus, ans_mod, ans_prob, keys):
... |
ecfc4c0a0a60ae6fd3f948015147c4e9e97c112e81f9781a19cffbfc98d6cae4 | Python | 6,243 | 191 | # -*- coding: utf-8 -*-
#%%
"""
Example of how to extract and plot continuous data saved in Blackrock nsX data files
@author: Mitch Frankel - Blackrock Microsystems
Version History:
v1.0.0 - 07/05/2016 - initial release - requires brpylib v1.0.0 or higher
v1.1.0 - 07/12/2016 - addition of version checking fo... |
2dec1857a3729bed71a34bac7bf55d130862a447df25cad16513d73eb5b09f23 | Python | 6,246 | 185 | # -*- coding: utf-8 -*-
# Author Claudia Cozzolino https://github.com/coclab
# Credits to https://towardsdatascience.com/building-a-web-application-to-deploy-machine-learning-models-e224269c1331
# import libraries for web app
#import os
from flask import Flask, request, redirect, url_for, render_template
... |
a4c9105d20bc0261b25830f71f7076315abf82a1931f0614d90cc378cae519b8 | Python | 6,247 | 221 | """ Database functionality through SQLAlchemy """
import re
import shutil
import tempfile
import sqlalchemy as sa
import psycopg2
import pandas as pd
from . import local
__all__ = ["open_db_metadata", "create_db_tables",
"execute_db_statement", "execute_db_statements",
"read_dframe", "write_df... |
8566607c3eceae209914e9e97aad1bbf6a5b5c397c6177f10f001c534dfaa83b | Python | 6,253 | 158 | # -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:para... |
0a1430f3e854b200aadf5417ec8e10cc4ad7fb9346ed339a4eab791a6ba3c159 | Python | 6,254 | 148 | # 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.core.data import Data
from ax.exceptions.core import UserInputError
from ax.utils.common.testutil... |
9fb39599e5dfc2f9760d666ca55dc3249be33b60d9fb4c21d2fd3e872b4cfcd0 | Python | 6,255 | 181 | """
Galaxy Security
"""
from typing import (
Literal,
Optional,
)
from galaxy.util.bunch import Bunch
ActionModel = Literal["grant", "restrict"]
class Action:
action: str
description: str
model: ActionModel
def __init__(self, action: str, description: str, model: ActionModel):
sel... |
d0a10b879a4e61fc492ed279101f062f5f58239e892756b2bf453124d7e6c0e8 | Python | 6,265 | 160 | import os
import numpy as np
from cellpose import io, transforms, utils, models, dynamics, metrics, resnet_torch, denoise
from natsort import natsorted
from pathlib import Path
from glob import glob
from cellpose.io import logger_setup
def prediction_test_hidden(root):
""" root is path to Hidden folder """
r... |
1824f50e5eeb43227113e9235b8df6f0025a2dfd53eb8a4dff5bc1d490920aaa | Python | 6,275 | 153 | """
@author: Rory Boyle rorytboyle@gmail.com github.com/rorytboyle
@date: 31/10/2019
"""
import pandas as pd
import statsmodels.api as sm
import scipy.stats
import numpy as np
from sklearn.metrics import mean_absolute_error
def robust_reg(y, X, names):
"""
Runs a linear regression using statsmod... |
376e3cd582507dcb65c537d43baed6aa119821fa0cae17193c4bb19eb600a983 | Python | 6,285 | 171 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Collates basic information about reads from a BAM file
"""
from __future__ import division
import os
import martian
import tenkit.bio_io as tk_io
import tenkit.fasta as tk_fasta
import tenkit.safe_json
import tenkit.summary_manager as tk_summary
from te... |
647e07b1add3d041ef280943c41b84cdb7b669936ea811182f2d3c253fea2377 | Python | 6,289 | 203 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 08:58:41 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_vis import *
def generate_visual_neurons(theta_phase,N_FS,N_RS,... |
631c28a228fa80696032b815e4b2e9bf502836bc42bd6cb8c5d9cd48a50c2a9e | Python | 6,292 | 159 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
python -m simulations.benchmark_gof simulations/bm_sp
"""
import numpy as np
import pandas as pd
from os import path
from argparse import ArgumentParser
from contextlib import suppress
from scanpy import read_h5ad
from scipy.spatial.distance import pdist,cdist
from sci... |
debc21de25308a31df6c1e17b54d1f5a9890be87cb1dbf2cef0e573c23edd919 | Python | 6,295 | 162 | #!/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 typing import TYPE_CHECKING
import numpy as np
from ax.adapt... |
3b28ec4b6e570e9521a50977dac177f172d1a300330d80cbf07d95cf444b6a02 | Python | 6,301 | 189 | from __future__ import absolute_import
from __future__ import print_function
import tarfile
import os
import sys
import shutil
import hashlib
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError, HTTPError
import requests
from generic_utils import Progbar
from modac_utils import g... |
372c2cc88398e956d7fbeabf3c773927c0989c40fdfd69952d85269dc716dedf | Python | 6,307 | 175 | """
Unit tests for inhibitory cell density computation
"""
from pathlib import Path
from unittest.mock import Mock, patch
import numpy as np
import numpy.testing as npt
import pytest
from voxcell import RegionMap
import atlas_densities.densities.inhibitory_neuron_density as tested
from atlas_densities.densities impor... |
b6f797854ff629eb94772d72be24072171d1afd371bfdd5b616fec71f5d86327 | Python | 6,307 | 119 | # 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 dataclasses import dataclass
from typing import Literal
from ax.api.configs import (
ChoiceParameterConfig,
Der... |
e7abc670a8ec5e1e22e0a9751098d0faab271a71cb09756f366377cae737f027 | Python | 6,307 | 221 | import pytest
from clpipe.config.options import ProjectOptions, ScrubColumn, ScrubTimepoints
from clpipe.postprocutils.image_workflows import *
from clpipe.postprocutils.confounds_workflows import *
def test_build_confounds_processing_workflow_2_steps(
artifact_dir,
sample_confounds_timeseries,
helpers,
... |
4eb5ecec4dd89ef6b5f1d0666890cee101acc92b5e0b02b7d9c50ac3e5a46742 | Python | 6,309 | 196 | """
Tests for VF2 isomorphism algorithm for weighted graphs.
"""
import math
from operator import eq
import networkx as nx
import networkx.algorithms.isomorphism as iso
def test_simple():
# 16 simple tests
w = "weight"
edges = [(0, 0, 1), (0, 0, 1.5), (0, 1, 2), (1, 0, 3)]
for g1 in [nx.Graph(), nx.... |
d1479e184dac12f683b87bf590327bcec118e4973bcbabd3cc5e6601b7a7e63e | Python | 6,311 | 165 | import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
from .. import BaseModel
from cogdl.layers import SAINTLayer
def parse_arch(architecture, aggr, act, bias, hidden_size, num_features):
num_layers = len(architecture.split("-"))
# set default values, then update by arch_gcn
... |
a980da5cb99b9eb5eb4b18fa0335d131b8acb7a7d4ed58284d5d38313cfbd6c8 | Python | 6,315 | 212 | # 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... |
3d340bf8ef10493d5295ba94c78c93a76fc80a0e969ba608d82f17a6bec0b90e | Python | 6,316 | 170 |
cdef enum:
MAX_DIMS = 10
cdef struct Iterator:
index_t n_dim
index_t shape[MAX_DIMS]
index_t coordinates[MAX_DIMS]
index_t strides[MAX_DIMS]
index_t backstrides[MAX_DIMS]
cdef void init_iterator(Iterator* iterator, index_t n_dim, index_t[:] shape, index_t[:] strides) nogil:
cdef index_t d
iterator[0]... |
a2fd5d5929feb3fd3794d2e58619eebf131600d61668ce3db4250fa956c4a501 | Python | 6,317 | 152 | # 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"... |
93720542635f130643fc513731ffc55016b5c7c4cdc7e0a25c68c42f1713a232 | Python | 6,320 | 166 | # rmf 4.22.2020, last updated 4.24.2021
# cleaned up 3.1.2022
print('Initializing...')
import sys, re
from scipy.stats import hypergeom
# USAGE
usage = 'python ' + sys.argv[0] + ' <fimo results summary file> <global motif counts file> <GOI file list> <background transcripts file> <median expression file> <max backgro... |
ebfee31d6290473439a7f2bc03075cd815598d0cc1bf6f16ddd9ea73ce56168f | Python | 6,321 | 200 | 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
plt.rc('xtick', labelsize=12)
plt.rc('ytick', labelsize=12)
# Height of net:
h = 50e-9 # m
# Constants. Fix later:
F ... |
01ba81e2adabd3bf2fdf8950e30f91fa09e0c41884f10a939b6a1ecd247f2177 | Python | 6,323 | 166 | """Structure-from-motion (SfM). Experiment conditions of Figure 6."""
import numpy as np
from datetime import datetime
from strinf import ObservationGeneratorVelo, WorldVeloFunction,\
FilterStrinfNaturalParameters, FilterStrinfAdiabaticDiagonalSigma,\
inf_method_MAP_sliding_lam2
f... |
5b39012e73a213f21d627fc6f05114f05fcd095c3d9bed1dd38ec3b1d24020d3 | Python | 6,324 | 164 | import torch
from .. import ModelWrapper
import numpy as np
import warnings
class STGATModelWrapper(ModelWrapper):
def __init__(self, model, optimizer_cfg, **args):
super(STGATModelWrapper, self).__init__()
self.model = model
self.optimizer_cfg = optimizer_cfg
self.edge_index = tor... |
c3e7d945b792bc7184d4219ac30848de0fd8ad9f3c9c0b1c78e531eb721023a5 | Python | 6,325 | 231 | import numpy as np
import scipy as sp
import scipy.io
from scipy.sparse.linalg import eigsh
import utils
import matplotlib.pyplot as plt
import power_law
import time
import matplotlib as mpl
from cycler import cycler
import skimage
from skimage import filters as filt
from skimage import transform
import pywt
mpl.rcPar... |
513e38576023cbfd44b31f9c79a5009be1fb89380b79644c369b34e589afba8b | Python | 6,327 | 167 | import codecs
import collections
import logging
from typing import (
Optional,
Union,
)
from Crypto.Cipher import Blowfish
from Crypto.Random import get_random_bytes
import galaxy.exceptions
from galaxy.util import (
hex_to_lowercase_alphanum,
lowercase_alphanum_to_hex,
smart_str,
unicodify,
)... |
1ff7d6426d8a231369247845537aea966929cbf2b82b553eafa5b5c35c7f0bdb | Python | 6,331 | 188 | import pytest
import torch
from spikingjelly.activation_based import functional, neuron
from spikingjelly.activation_based.precision import (
PrecisionArtifacts,
PrecisionConfig,
prepare_model_for_precision,
)
from spikingjelly.activation_based.precision import convert as precision_convert
from spikingjell... |
11c6bae940a2e99ea1aaa9d33c9114c4787e6981434558eb3c67d92aa2a8050d | Python | 6,332 | 185 | # -*- coding: utf-8 -*-
#
#
# Cluster Python XTension
# Inspired by the ImageJ image calculator
#
# <CustomTools>
# <Menu name = "Brainbow plugins">
# <Item name="Brainbow stack filter" icon="Python" tooltip="Filter stack and remove pure RGB neurons.">
# <Command>PythonXT::XTSetup(%i)... |
e6407fc742f47aa8adc6425221d782ed0e1119d3f6cae0b0a3c971d0263afd42 | Python | 6,332 | 197 | import os
import sys
from tkinter import (
Toplevel,
Checkbutton,
IntVar,
Button,
filedialog,
NORMAL,
DISABLED,
OptionMenu,
StringVar,
Label,
)
from ...utils.default_parameters import available_estimations
SUPPORTED_IMAGE_FILETYPES = [
("NIfTI/GIfTI files", ("*.nii", "*.nii... |
249d664029aff16c9da90b485500b51ea92a1050cc78a57327f85ec7053cb170 | Python | 6,333 | 185 | """
=============================
Breadth First Search on Edges
=============================
Algorithms for a breadth-first traversal of edges in a graph.
"""
from collections import deque
import networkx as nx
FORWARD = "forward"
REVERSE = "reverse"
__all__ = ["edge_bfs"]
@nx._dispatchable
def edge_bfs(G, sou... |
151f1072944d398d632b074cfa5d1a91b29a525f908020c495c221fee825f796 | Python | 6,334 | 169 | import random, numpy as np
from ..exceptions import *
from itertools import chain
class TargetsNeurons:
def initialise(self, scaffold):
super().initialise(scaffold)
# Set targetting method
get_targets_name = "_targets_" + self.targetting
method = (
getattr(self, get_tar... |
7c59bddafaed3c48ac9d94e863d299247132089f0c64a0dd49f68b9be1da55b3 | Python | 6,334 | 192 | """Metrics for generic plotting.
Functions
---------
plot_metrics(history,metric)
plot_metrics_panels(history, settings)
plot_map(x, clim=None, title=None, text=None, cmap='RdGy')
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import cartopy as ct
import numpy.ma as ma
import cartopy.... |
ea9bc37ca2d34c3f634aab7fd6ce72eb49efcc50ecef1e084157d61206909721 | Python | 6,334 | 190 | from __future__ import absolute_import
from __future__ import print_function
import tarfile
import os
import sys
import shutil
import hashlib
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError, HTTPError
import requests
from generic_utils import Progbar
from modac_utils import g... |
1a011be6078db9eb3cb34ea5865e4e014a6361825be772900be140c26c89353e | Python | 6,335 | 256 | """
Defines some useful types for this library. Should probably be cleaned up before thinking about exporting.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Literal, Protocol
import h5py
import zarr
from . import typing
from .utils import set_module
if TYPE_CHECKING:
from collections... |
fb37458204b8c2c99fd383ed550cb874a4defcb97fe94745e79d5b9862a30ce9 | Python | 6,335 | 168 | """
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 ... |
25dd0f0b8c92d9fa5c64d4e833d77f9002ea9c114c817af57837a89a8188d536 | Python | 6,338 | 200 | # Created on Tue Jul 20 13:36:00 2021
'''
======================================================================
## neighbor list triplets
'''
import matplotlib.pyplot as plt
import numpy as np
#import pandas as pd
from scipy import stats
from glob import glob
import os
import csv
ds = []
angles = []
files2 = []
all_f... |
7c4582cd7c26df4edb3d680ed44fdb1b881621c74cb955c347f053c7fbbfe639 | Python | 6,338 | 126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 14 17:17:42 2022
@author: akshay
"""
from app import app
from dash import dcc,html
from dash.dependencies import Input, Output
import dash_bootstrap_components as dbc
from UI_com import visualization,pred
from pathlib import Path
from zipfile imp... |
d94b46309169716886d2c42d5c8613d23d374362e11aa58cd86fa97ca6374b0d | Python | 6,340 | 229 | """Unit tests for explicit image comparison with pytest-mpl."""
import pytest
import networkx as nx
pytest.importorskip("pytest_mpl")
mpl = pytest.importorskip("matplotlib")
mpl.use("PS")
plt = pytest.importorskip("matplotlib.pyplot")
plt.rcParams["text.usetex"] = False
np = pytest.importorskip("numpy")
@pytest.m... |
700e90c1c2a28ab67ef4624d15216f89e1136ac79cf37d8ca158ce3ec944dfd7 | Python | 6,341 | 177 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLaye... |
3d6a83eb49ce858997729a99503b3a912387606593dd267c946a63869d42926f | Python | 6,344 | 223 | """
This scripts is used to retrieved the demographics information from patients and controls
and correct information from site specific mistakes
output : homogeneous demographic information csv file
"""
# import necessary packages
import meld_classifier.paths as paths
import pandas as pd
pd.options.mode.chained_ass... |
65ef87791dfb2438e4a7b1665b32a3ec1d4fa530dec636493595365c2073d867 | Python | 6,344 | 218 | import torch
from torch import nn
import numpy as np
def get_loss_func(task_type, model_name):
"""
Gets the loss function corresponding to a given dataset type.
:param args: Namespace containing the dataset type ("classification" or "regression").
:return: A PyTorch loss function.
"""
if task_... |
af0f8836fd27b1859897e5e17f148b7f7f949c55482ee6b088cad573cbeef33c | Python | 6,345 | 204 | """Parse a Dirichlet mixture parameter file.
File format
-----------
Line 1: <num_chars> <num_components>
Lines 2…(num_components+1):
<mixture_weight> <alpha_1> … <alpha_num_chars>
Returns
-------
mixture_weights : np.ndarray, shape (num_components,)
concentrations : np.ndarray, shape (num_components, num_c... |
d285642588e5e3cc44fcf5b692458e61e2752c11368e335d4aa1a820ae240151 | Python | 6,345 | 178 | """
Code to support database helper scripts (create_toolshed_db.py, migrate_toolshed_db.py, etc...).
"""
import argparse
import logging
import os
import sys
import alembic.config
from galaxy.model.migrations import (
GXY,
TSI,
)
from galaxy.model.migrations.scripts import get_configuration
from galaxy.util.p... |
32573b5472e2e350ecd11000c7f7f748d469ae285dcf0f5315ddded526238d47 | Python | 6,346 | 173 | import community
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
# ---- NetworkX compatibility
def node_iter(G):
if float(nx.__version__)<2.0:
return G.nodes()
else:
return G.nodes #{1:(), 2:()}
def node_dict(G):
if float(nx.__version__)>2.1:
node_dict = G... |
50d7762ace57c0a7e8733e217684b86902b17728cdbcf7e4e6a6c8f57cd74227 | Python | 6,346 | 213 | # -*- coding: utf-8 -*-
"""Bessel module
Generates the Bessel-Gauss beam shape based on experimental or theoretical parameters
"""
# Created on Tue Apr 16, 2020
# Contributions and Changelog accessed via a private git repository:
# https://github.com/philipwijesinghe/deep-learning-lsm.git
# philip.wijesinghe@gmail.... |
afd85537b8726fce2f80411238d77119ac0b5e951e9a1ef832d7cd0ee077620d | Python | 6,346 | 186 | # -*- coding: utf-8 -*-
""" Processes data with a trained model
"""
# Created on 20210128
# Contributions and Changelog accessed via a private git repository:
# https://github.com/philipwijesinghe/deep-learning-lsm.git
# philip.wijesinghe@gmail.com
# Copyright (c) 2021 Philip Wijesinghe@University of St Andrews (pw6... |
f01a960d9e3e7a23dd5f18d147fcf2de995fdabef656586fcfedfffb84325b16 | Python | 6,347 | 195 | """Tests of the studies activating the regions of an atlas."""
import nibabel as nib
import numpy as np
import pytest
from neurolang_apps.utils.engine_registry import atlas_activation
def atlas(affine):
"""A 10 x 10 x 10 atlas: region 1 is the voxel (2, 2, 2), region 2 the
voxels (7, 7, 7) and (7, 7, 8)."""... |
3d6ed88e66e9dae63ecdbebfa9707da9c6af6d0f152ca7fc0ed5e262f0f74068 | Python | 6,350 | 214 | import numpy as np
import sys
import datasets
import copy
import pickle
class DNN(object):
def __init__(self):
self.name = "MLP1"
self.pretrained = False
self.version = 1
self.layers = 2
self.stride = 2
self.neuron_multiplier = np.ones([self.layers])
self.n... |
908bd0bc87b796c6f353c3a97b5ec94b47de025f0e4436d4d4b3c50eeb61c9a2 | Python | 6,351 | 159 | import mdtraj as md
import MDAnalysis as mda
import torch
import copy
import argparse
import sys
from torch_batch_svd import svd
import numpy as np
from tqdm import tqdm
from multiprocessing.pool import ThreadPool
import time
import pdb
import rlcompleter
pdb.Pdb.complete=rlcompleter.Completer(locals()).complete
import... |
342a29fde43141c160bcaf5f00537658e12be51d7ee522568c48830e4d9c5405 | Python | 6,352 | 198 |
##########################################################################################
#
# psim_lib.py
#
# - General utility functions for ProBioSim
#
##########################################################################################
#
# ProBioSim
# Copyright (C) 2021 Matthew Lakin
#
# This program i... |
4bf63a8cdcb77abd9c3d17b907f8fa5ddc7a6235e8a700561fbcedb550d1e760 | Python | 6,355 | 182 | import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
import copy
# change the default font family
plt.rcParams.update({'font.family':'Arial'})
plt.rc('xtick',labelsize=12)
plt.rc('ytick',lab... |
355f78447872a0b845db894682f07cb5aceed4c69d504df90fc68e4c6ca62adc | Python | 6,356 | 111 | from __future__ import division
import scipy
import utils
from tenkit.stats import robust_divide
import numpy as np
from constants import NO_BARCODE
def add_bulk_targeting_metrics(summary_info, singlecell_df, species_list):
"""Take singlecell targeting data and calculate bulk targeting metrics from them.
"""
... |
5aa519e8b190393ccb90b02a8db340b4d3d9c3545356312ee6f56ecfd38adbee | Python | 6,356 | 200 | # -*- coding: utf-8 -*-
#
# Himalaya documentation build configuration file.
#
# 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 file.
#
# All configuration values have a default; values that are com... |
5ea2d71a47a02e25524a11d3945b92f4760bb71f48a3c863bf9243d22f22b1b5 | Python | 6,356 | 133 | # rmf 7.1.2020, last modified 4.26.2021
# cleaned up 3.1.2022
import sys, re
usage = 'python ' + sys.argv[0] + ' <results file list> <median expression file> <p-value threshold> <fimoSummaryFile_FPKM1.0_p5e-05.txt> <FDR (True/False)> <TF expr thresh (FPKM)>'
if len(sys.argv) != 7 or '-h' in sys.argv or '--help' in sy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.