sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b0ea573ab8fd18c5e35b2c9c79809bb3339a8d8ccdc8cf5a75f2d4b74781a78f | Python | 5,049 | 151 | import numpy as np
import matplotlib.pyplot as plt
from utils import *
import pickle
from skimage import io
from skimage.transform import rescale,resize
from skimage import color
import cv2 as cv
from pystackreg import StackReg
from skimage import transform, io, exposure
import SimpleITK as sitk
import h5py
... |
6ba83e99fc3d90a64d9ea4df76308e981cb0b0611b5f1f32145b23153de89cc4 | Python | 5,052 | 106 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
import numpy
import tvb.simulator.lab as lab
import matplotlib.pyplot as plt
from tvb.con... |
8bb613aaaace982b673ac773c17016752802519896a42d14fca3e267e6108fc7 | Python | 5,052 | 103 | import pickle
from torch.utils.tensorboard import SummaryWriter
from models.reaction import *
import time
import matplotlib as mpl
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.warning')
mpl.use('Agg')
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8"
args = get_args()
assert args.supervised == 0
assert args.d... |
fd4b500651793701f15dd0f97157251a18b0c50021fe7d21bfeb90011041cb4f | Python | 5,052 | 182 | import re
import sys
import warnings
from pathlib import Path
import numpy as np
from .io_utils import load_neo
def get_base_type(datatype):
if hasattr(datatype, "dtype"):
datatype = datatype.dtype
elif not type(datatype) == type:
datatype = type(datatype)
if datatype == list:
w... |
c0e7abe261f61d981fc7ea4512a9adf73a2f46f0b5970427b8b3ea975b3c3f10 | Python | 5,056 | 139 | import numpy as np
import torch
from torch import Tensor
from torch import distributed as dist
from typing import Union, Optional, Tuple
from common import (
DEFAULT_IMAGE_HEIGHT,
DEFAULT_IMAGE_WIDTH,
DEFAULT_IMAGE_CHANNELS,
DEFAULT_VIDEO_FRAMES,
)
def image_size_from_opts(opts) -> Tuple[int, int]:
... |
56ab2a9ffe25215d65b5a49b9fbb2ba714304bb07b99d87c5fe5a64a8cf0c6fe | Python | 5,057 | 137 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import tempfile
import tests.end_to_end.utils.exceptions as ex
import tests.end_to_end.utils.helper as helper
import tests.end_to_end.utils.ssh_helper as ssh
log = logging.getLogger(__name__)
# Define the Aggrega... |
8e952fe91c10eb68ae66add130b823c7d431bdfe376b06dbb9dfa86d8dc98ca8 | Python | 5,059 | 108 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
from mpi4py import MPI
import numpy as np
from nest_elephant_tvb.transformation.communic... |
f8c678c4fc445bf842807780b5808062a6c31a962e627582c0c6ad34b5135678 | Python | 5,061 | 166 |
'''
Example showing software-timed (on demand) digital output
pinidaqmxegs.do.softwareBasic
Purpose
Generates a class that can be used interactively to switch on and off some
digital lines if instantiated at the Python command prompt. If run at the
system command line, a demo begins.... |
ac0eaa07f3af83fc2c1dd3b23a15e431fb7f367f66a8d389e0e18459c2f5ea7b | Python | 5,063 | 147 | """cuEquivariance backend: e3nn parity (CPU or GPU) and the CUDA multi-head
regression (issue #1298). Capability: cueq; GPU cases carry the gpu marker.
"""
# pylint: disable=wrong-import-position
import os
os.environ["TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD"] = "1"
import pytest
import torch
import torch.nn.functional as F... |
c67218ce9dae0afddba5e524fe8e44fbfdbfae85c036ec8edd297860bc34ae76 | Python | 5,063 | 159 | import pytrec_eval
from tqdm import tqdm
import pandas as pd
import numpy as np
from typing import Any, Dict, List
import matplotlib.pyplot as plt
from chromadb import Collection
from functions.visualize import *
from functions.types import *
# Benchmarking
def query_collection(
collection: Collection,
query_... |
8b31e18a3ca23719746deacd5f32f96a3d36f95f358f6b8869a5a44247e00d62 | Python | 5,064 | 151 | import numpy as np
from numpy.linalg import multi_dot as mdot, norm
from scipy.optimize import minimize
from scipy.linalg import pinv, pinvh, lstsq, cholesky
from scipy.stats import multivariate_normal as mvn
__all__ = ["infer_taus"]
def _infer_taus_hereg(zscores, LD, A):
"""
Infer the variance parameters ... |
5d03ca1e4ab587f224224c84306f0a2f54b4ae33dda73d0524cdb51956ad9a07 | Python | 5,066 | 133 |
import string
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import torch
from matplotlib import cm
import mlspm.preprocessing as pp
from mlspm.datasets import download_dataset
from mlspm.models import EDAFMNet
# # Set matplotlib font rendering to use LaTex
# plt.rcParams.update({
# ... |
25ff22fdd58c15b6491de6989366a7e12b0fb11e7dd89f6e203f4bf80e26ad7a | Python | 5,069 | 135 | import json
import os
import warnings
import numpy as np
from pydfc import data_loader, task_utils
warnings.simplefilter("ignore")
################################# Parameters #################################
# data paths
# main_root = '../../DATA/ds002785' # for local
main_root = "../../../DATA/task-based/openneu... |
557148ccf983fbfabf8e74f608964eb8d67401c62c08135ff6fe47235ec492c3 | Python | 5,069 | 143 | # Copyright (C) 2020-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os.path
import pickle
from typing import Any, Callable, Optional, Tuple
import numpy as np
from PIL import Image
from torchvision.datasets.utils import check_integrity, download_and_extract_archive
from torchvision.datasets.visi... |
b10ec64b35902993fc74487a2ce7780070c1274d654b8e64346cbfe2b0d6e46c | Python | 5,071 | 135 | # -*- coding: utf-8 -*-
import functions.rate_coding
import numpy as np
import functions.Graphs
import matplotlib.pyplot as plt
from scipy import stats
import pandas as pd
import functions.statistics_test as st
#%% Load data
data = np.load('/datapath/dataset.npy', allow_pickle=True).item()
#%% 3A Brai... |
b5520305289a9a7e7837070713f1c38e36214e9e57e9954be2e13986d85a983e | Python | 5,072 | 154 | # ==============================================================================
# Copyright 2025 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
import os
from p... |
dbb365a01099200771b317c835ca982f405be1b0afaa13cd356d00b1f120ba33 | Python | 5,072 | 165 | # ==============================================================================
# Copyright 2025 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
"""Unit tests fo... |
fbe4e8d3e00dcefc53de67a45dcb9c9fefcd533888041d6eadd3ebe62a0a944e | Python | 5,074 | 180 | import os
import sys
from unittest.mock import MagicMock
import toml
from docutils.nodes import raw
sys.path.append(os.path.abspath("./_ext"))
sys.path.append(os.path.abspath("."))
from _ext.gitlab_link import linkcode_resolve # noqa: E402 F401
# I don't understand why torch has to be mocked like this... but it wo... |
aff44e243d064e76f68b8a527d9385cf677850ed431874ff716edc4ee2f3562f | Python | 5,077 | 162 | #! /usr/bin/env python
#
# Copyright 2019 Square Inc.
# Apache License
# Version 2.0, January 2004
# http://www.apache.org/licenses/
import sys
import os
import codecs
import re
import glob
from setuptools import setup, Extension, find_packages
# Checking if numpy is installed
try:
import numpy
except:
import su... |
ef4131a042b95f50e8b6d488b0a816b36dc6d8aa95aea9e98e197ba05df4105f | Python | 5,080 | 143 | # ##############################################################
# This file is received from
# https://github.com/DmitryUlyanov/deep-image-prior/blob/master/models/downsampler.py
# The code is licenced under Apache 2.0 licence
# https://github.com/DmitryUlyanov/deep-image-prior/blob/master/LICENSE
# Please also checko... |
3c1cbc37c1c3b69e5fc31ecd02f3ede2a4ad659997b1d425b4a09cfeb625c0dc | Python | 5,084 | 175 | """
Implementation of dFC methods.
Created on Jun 29 2023
@author: Mohammad Torabi
"""
import time
import numpy as np
from scipy.special import softmax
from sklearn.cluster import KMeans
from ..dfc import DFC
from ..time_series import TIME_SERIES
from .base_dfc_method import BaseDFCMethod
#########################... |
3d08300b190d7f4812880a6512f9e85cfd8ee604fb25abfbe7f61b49e8bbd44b | Python | 5,084 | 145 | #
# calculation of synthetic accessibility score as described in:
#
# Estimation of Synthetic Accessibility Score of Drug-like Molecules based on Molecular Complexity and Fragment Contributions
# Peter Ertl and Ansgar Schuffenhauer
# Journal of Cheminformatics 1:8 (2009)
# http://www.jcheminf.com/content/1/1/8
#
# seve... |
e51e11025ffe172ccfe52f6703d5186d197fd5374c050392b0aa9a0e6e410d45 | Python | 5,085 | 123 | from unittest import TestCase
import numpy as np
from ..image_measures import isotope_pattern_match, isotope_image_correlation
class IsotopePatternMatchTest(TestCase):
def test_empty_inputs(self):
inputs = (
([], []),
([[]], [0.3]),
([[]] * 2, [0.2] * 2),
)
... |
3868a35db9a88eb4703dcd4d024b49cfd371960cfb691de62712db5671aa970e | Python | 5,086 | 140 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
53604579f6fa3734164bae8f9e1fd72ba69818820be4da4e39204ad2dad7f054 | Python | 5,086 | 172 | from __future__ import annotations
import datetime
import hashlib
import json
import os
import pathlib
import platform
import sys
from typing import Any, Dict, List, Optional, Sequence
import pytest
_local_nodeids: List[str] = []
_xdist_nodeids_by_worker: Dict[str, List[str]] = {}
def pytest_addoption(parser: pyt... |
7b290e6b88515048531eb201bf9c165f74d071b3f4ef18149fde79e200f1d0fe | Python | 5,086 | 131 | import sys
slimFileName = sys.argv[1]
mutRate=5e-9
migRateBlocks = """ N_max = max(N[0,0:(num_populations-1)]);
defineConstant("splitTime", asInteger(round(burn_in*N_max)));
splitTimeAgo = 4*N_max;
defineConstant("simEndTime", splitTime + splitTimeAgo);
defineConstant("migTimeUpperBound", 0.25);
... |
aa4b83cbb0695c69da831c59c6c65ca88415900b7ee772933d8b6333cfcc07c7 | Python | 5,086 | 125 | import shutil
from dig.sslgraph.evaluation import GraphSemisupervised
from dig.sslgraph.utils import Encoder
from dig.sslgraph.dataset import get_dataset
from dig.sslgraph.method import GraphCL
from dig.sslgraph.utils import setup_seed
from dig.sslgraph.method.contrastive.views_fn import NodeAttrMask
from dig.ss... |
94023d3d12755de0cb091abccc991ccd06fe0dd29be95cc384f961f393e642a6 | Python | 5,088 | 176 | import numpy as np
import renderapi
import argschema
from ..schemas import *
from ..utils import make_dbconnection
import time
import matplotlib
matplotlib.use('Agg')
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
from shapely.geom... |
ad415138adb1cf618fa280ec825254d6826fbfb30c62d6cc6f2328905497b807 | Python | 5,089 | 155 | import numpy as np
import renderapi
from scipy.sparse import csr_matrix
__all__ = ['AlignerPolynomial2DTransform']
class AlignerPolynomial2DTransform(renderapi.transform.Polynomial2DTransform):
"""
Object for implementing half-size polynomial transforms
"""
def __init__(self, transform=None, order=2... |
be3a8deab4285dc31a3625905d3498d22be4c6e7c09ce6453e682013612d15c9 | Python | 5,089 | 125 | import itertools
import pytest
import torch
from rdkit import Chem
from torch import tensor
from reinvent.models.model_factory.sample_batch import SampleBatch, BatchRow, SmilesState
from reinvent.runmodes.enumeration.aa_enumerator import AAEnumerator
from reinvent.runmodes.enumeration.validation import AAEnumerationC... |
ad20256876c3d565fe3c6e494e0bdb34662cd142d1acdcd155b6f383ab800ec3 | Python | 5,092 | 111 | # Copyright 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import logging
from tests.end_to_end.utils.tr_common_fixtures import \
(
fx_federation_tr, fx_verifiable_dataset_with_s3,
fx_verifiable_dataset_with_azure_blob,
fx_verifiable_dataset_with_all_ds
)
from tests.end_to_end.... |
d4f666f0b0ec62e85464c2c5142fbdbd0372fb019be569878ae1fa384c413438 | Python | 5,092 | 146 | import base64
import random
import re
import time
import traceback
import bcrypt
import logging
from overrides import override
from pydantic import SecretStr
from chromadb.auth import (
UserIdentity,
ServerAuthenticationProvider,
ClientAuthProvider,
ClientAuthHeaders,
AuthError,
)
from chromadb.c... |
11f40aa273a768b9817dda27b35eddb81f4fd94a281790eeec7cf0244cfad129 | Python | 5,096 | 183 | import re
import sys
import warnings
from pathlib import Path
import numpy as np
from .io_utils import load_neo
def get_base_type(datatype):
if hasattr(datatype, "dtype"):
datatype = datatype.dtype
elif not type(datatype) == type:
datatype = type(datatype)
if datatype == list:
w... |
f5414e28d21381d4eb7793f887b9023c53414a8b002598d3286f488a3c40bb75 | Python | 5,097 | 282 | from __future__ import annotations
import re
from typing import Iterable, List, Protocol, cast
DEFAULT_ENGLISH_STOPWORDS: List[str] = [
"a",
"about",
"above",
"after",
"again",
"against",
"ain",
"all",
"am",
"an",
"and",
"any",
"are",
"aren",
"aren't",
... |
5b117a54a49f8a14a85379366c01ab963506f92bf00ad364fe51f110a750e058 | Python | 5,098 | 134 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as D
from .modules import TwoInputSequential, Sub_Adder
__author__ = "Zhijian Yang"
__copyright__ = "Copyright 2019-2020 The CBICA & SBIA Lab"
__credits__ = ["Zhijian Yang"]
__license__ = "See LICENSE file"
__version__ = "0.1... |
7d44bd6ac06ace1ba2465a201f63ccf63213f6ba4240b6bf50cfa8124772cd85 | Python | 5,098 | 183 | import re
import sys
import warnings
from pathlib import Path
import numpy as np
from .io_utils import load_neo
def get_base_type(datatype):
if hasattr(datatype, "dtype"):
datatype = datatype.dtype
elif not type(datatype) == type:
datatype = type(datatype)
if datatype == list:
w... |
9dce8c383a75ff1a8c78eebbfe144e2f5dc9547abc5c3d2dba74ee78d2f95a8f | Python | 5,098 | 91 | # This script reads the PRAAT annotation, then reads the long WAV recordings and segments into 3 sec clips.
# The preprocessing is done (logMel-Spectrograms, Normalisation etc.) and everything is saved as a TF RECORD.
# TF RECORD files are serialised, and TF reads them quite fast -- very useful for training, and we avo... |
e3627ab20e17d8090637519d114a3560279be93eb2408e958f654b6ef12b961a | Python | 5,100 | 149 | """Template file to illustrate how to create a manifold in geomstats.
For additional guidelines on how to contribute to geomstats, visit:
https://geomstats.github.io/contributing.html#contributing-code-workflow
Note: A manifold needs to be created with an associated test file.
The test file for this manifold can be f... |
130ff0692d07a5477b6f0fbfd4ebdcaa200d5e0e9170deb9e8aab7aa57590702 | Python | 5,101 | 111 | """Numbers pasted into ``docs/clustering.md`` must still be the numbers that were measured.
Covers every table row that names a configuration the scorecard knows -- sections 4.3, 4.5 and 9.2,
155 value cells at the time of writing. Section 7's summary table is keyed on the algorithm rather
than the configuration and i... |
f188cf87e30ea1f41ffbf175971390d103ba1c5ba976861bcdf1b45bee4d5b78 | Python | 5,101 | 125 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from typing import Optional, List
import numpy as np
from utils.math_utils import make_divisible
def _image_batch_pairs(
crop_size_w: int,
crop_size_h: int,
batch_size_gpu0: int,
n_gpus: int,
... |
8a544f4588c81e7bf4d5f490b32614920ee4eb31aa75daeec0f35791aa7f66d0 | Python | 5,102 | 155 | from numpy.random import seed
seed(1)
import tensorflow as tf
tf.random.set_seed(1)
import random
random.seed(1)
import tensorflow as tf
import csv
import SimpleITK as sitk
import matplotlib.pyplot as plt
import numpy as np
from numpy import argmax
import pandas as pd
import tensorflow.keras.backend as K
... |
b533ebee06eb1b7025d248f130deaf76f4385a66ca6b1875cb173d01e1bb8d2b | Python | 5,106 | 136 | """Module that defines input pipeline operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def get_iterator_splitted(
tensors_ph_1,
tensors_ph_2,
batch_size,
repeat=True,
shuffle_buffer_size=0,
map... |
4fefe63bb9e8ea8a13bfaf1cde4e3efabba74404c3d103dec126372d36564a87 | Python | 5,108 | 147 | from reinvent.scoring.config import collect_params
from reinvent.scoring.scorer import get_components
from dataclasses import fields
def test_get_components():
components = [
{"QED": {"endpoint": [{"name": "QED drug-like score", "weight": 0.79}]}},
{
"MolecularWeight": {
... |
96c834e8beacc8b74b9113dd2c67594c3c05774c800bdb242c05336024511a0b | Python | 5,108 | 153 | #!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 26.09.2021
# Author: Moritz Smolka
# Contact: moritz.g.smolka@gmail.com
#
import pickle
import json
import gzip
import math
from sniffles import sv
class SNFile:
def __init__(self,config,handle,fil... |
7a2d07ef5a299653b51a7135c6eab9f6fe81bfe5d84003c57abfd86e1fe42ac8 | Python | 5,109 | 108 | """Claims the repository makes about itself, checked instead of trusted.
Two defects found by accident on 2026-09-28 were the same shape: **a comment asserting a property the
code had stopped having.**
* `pyproject.toml` declared a pytest marker for "runtime and peak-RSS budgets; needs RUN_BENCHMARK=1".
No test eve... |
d4f47b30e8ba9efbf351e9d64483ef3bccdc695423e06d29e00de76d52849061 | Python | 5,109 | 123 | from math import ceil
import time
from pathlib import Path
from mlspm.datasets import download_dataset
from ppafm.common import sphereTangentSpace
from ppafm.ml.AuxMap import AtomicDisks, HeightMap, vdwSpheres
from ppafm.ml.Generator import InverseAFMtrainer
from ppafm.ocl.AFMulator import AFMulator
from mlspm.data_g... |
d16cd4c7251d8ef08128e560a642604fd35eab614672814a8204ffc87061a920 | Python | 5,111 | 188 | from Purkinje_morpho_1 import Purkinje_Morpho_1
from Purkinje_morpho_1_number import number_ind_1
from neuron import h,gui
import numpy as np
import multiprocessing
import matplotlib.pyplot as plt
from toolbox_pc import *
import random as rnd
spines_on = 0 # This protocols works without spines for speed and sections ... |
8b404ffbc4e9923bbb33bdffbd94110d76652e7605a4fad11b1b2d1b28dfa865 | Python | 5,112 | 126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 29 15:15:47 2022
@author: shah
"""
import os
from PIL import Image
import numpy as np
from Utils import normalizeImage, AveragePSNR,psnr,SSim, AverageSSIM, numpyToPIL
import ImageHelpers
import tensorflow as tf
def PropagateTestImages(modelPath,o... |
46107468b2f587e5013b5684888aa06e909474ae677a00c8e38b3b9efc6741e4 | Python | 5,113 | 120 | import warnings
import numpy as np
import pandas as pd
import scipy.stats as stats
import sklearn.preprocessing
def process_data(raw_traces, trial_lengths, fr, new_start=1, norm_method='scale', stim_times=None, total_length=None, **kwargs):
"""
Run the post-processing pipeline on traces. Performs min subtract... |
f8bc1f1c0aa9cebe45bf60434f78f0f153b0796091dcaa5418794bd3d94d2856 | Python | 5,114 | 158 | """
Inspired by module `lifelines.utils.sklearn_adapter` in lifelines (https://github.com/CamDavidsonPilon/lifelines)
"""
import inspect
import pandas as pd
import warnings
try:
from sklearn.base import BaseEstimator, RegressorMixin, MetaEstimatorMixin
except ImportError:
raise ImportError("scikit-learn must b... |
de3e51a4b433f7c42cac3ae19ff7808359f55101990a8d487e669b4ca62a90f1 | Python | 5,121 | 165 | import os
from pathlib import Path
import numpy as np
import pytest
from PIL import Image
def test_shardlist():
from mlspm.data_loading import ShardList
urls = "test_K-{0..1}_{0..1}"
base_path = "./base/"
log_path = Path("shards.log")
# Test with subtitution
shard_list = ShardList(urls=urls... |
8366a94867dca950fbafdafbd959e1ea6c66e07a403ff70b96d40195a7a2a782 | Python | 5,122 | 149 | from typing import List
from PyQt5 import QtCore, QtGui, QtWidgets
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__)
class errorTableView(QtWidgets.QTableView):
"""
Display a per spike error table (one row per spike eror)
"""
signalSelectSpike = QtCore.Signal(int, bool)
""... |
813c0fc9f6fe4903fa0d5b3ee8a94df3816bea0bd50371f2ba8ea6105e3dd5eb | Python | 5,125 | 165 | import numpy as np
INVALID = "INVALID"
NONSENSE = "C1CC(Br)CCC1[ClH]"
ASPIRIN = "O=C(C)Oc1ccccc1C(=O)O"
ASPIRIN2 = "CC(=O)Oc1ccccc1C(=O)O" # alternate style
CELECOXIB = "O=S(=O)(c3ccc(n1nc(cc1c2ccc(cc2)C)C(F)(F)F)cc3)N"
CELECOXIB2 = "Cc1ccc(-c2cc(C(F)(F)F)nn2-c2ccc(S(N)(=O)=O)cc2)cc1" # alternate style
CELECOXIB_C =... |
f36cdc8ea1b5db6d78f6be7d04384c00b422427c0ba6b0e7819d137eed32fba5 | Python | 5,125 | 135 | """
Basic Data Operations
=====================
A simple example showing how to download a dataset from neurovault and perform
basic data operations. The bulk of the nltools toolbox is built around the
Brain_Data() class. This class represents imaging data as a vectorized
features by observations matrix. Each image... |
db85919858e2788b13c10425e1fb65d7247779d9400283768847858f5bff542a | Python | 5,126 | 139 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import torch
from torch.utils.data.dataloader import default_collate
from fairseq.data import ConcatDataset
logger = logging... |
04c35243736c5dbf751275b97b7843218a5d22743e05e3286c402f8beb7d55aa | Python | 5,127 | 166 | import flammkuchen as fl
import numpy as np
from joblib import Parallel, delayed
from split_dataset import Blocks, SplitDataset, EmptySplitDataset
from fimpy.roi_extraction import corr_algorithms as ca
from fimpy.roi_extraction.anatomical import extract_traces_around_points
from fimpy.roi_extraction import merging
d... |
af8938145f909478891354889c9b2ac9edf4e4a2249e9501997514d49ae6db74 | Python | 5,127 | 142 | from numba import njit, jit, objmode
from numba.experimental import jitclass
from numba import int32, int64, float32, float64, boolean
from numba import deferred_type
from numba import typed, types
from numba.types import pyobject
import numpy as np
from scipy.io import loadmat, savemat
from .utils import argMin3
spec... |
eb251974f0f387644674476364e348b1fca81e8b2b208968baa8388ca1305804 | Python | 5,128 | 163 | """
Code to sample from an autoregressive transformer model
"""
import os, sys
import logging
from pathlib import Path
import argparse
from tqdm.auto import tqdm
import numpy as np
import pandas as pd
import torch
from foldingdiff import modelling, utils
from foldingdiff import angles_and_coords as ac
def sample_... |
be231ec3c546a7e3eee7d1b3316b89f211ef4638b31eea08e33b4b344cd2a19c | Python | 5,129 | 148 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import shutil
from subprocess import check_call
import os
from pathlib import Path
import tarfile
import yaml
def create_collaborator(col, workspace_root, data_path, archive_name, fed_workspace):
# Copy workspace to collaborator dir... |
7b5cd8de329ba437c09efc6c36940e8a6536c3ccc295a7ab83c6f5a3c53088ec | Python | 5,130 | 91 | import numpy as np
from scipy import stats
if __name__ == "__main__":
best_split_id = [2, 2]
hcp_sessions_list = ['LR_S1', 'RL_S1']
test_session_list = ['645','645']
test_session_alias_list = ['nki_645', 'nki_645']
# we want the combination of hcp_session and test_session to get the features file
dnn_results_p... |
c905279713858f47fbc5b3805c35d22e91b4bd927cd07b65af0cfc56d8083e1f | Python | 5,132 | 156 | import os
import time
from fairseq.models.transformer import BaseFunc
import sys
import dgl
class buildHomo(BaseFunc):
def __init__(self, args):
super().__init__(args)
self.__getArgs(args)
self.__process()
def __getArgs(self, args: dict):
self._raw_dir = args['zipPath']
d... |
2aa742921531513c92285d960fc81a930cc2ecc13ec897e98f1a91f579613c37 | Python | 5,133 | 156 | from typing import List, Optional, Tuple
import logging
from copy import deepcopy
import numpy as np
import torch
from .intrinsic_penalty import IntrinsicPenalty
from reinvent.models.model_factory.sample_batch import SampleBatch
from reinvent.runmodes import create_adapter
logger = logging.getLogger(__name__)
... |
31516a5f0e0e11521f16b7c1c20b9be87db3fa49e5bb46cbe39be86f9aa275b2 | Python | 5,134 | 143 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 22 11:53:34 2023
@author: gritti
"""
import os, glob, tqdm
from skimage.io import imread
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
from skimage.metrics import structural_similarity as ssimi
from skimage.metrics impor... |
1096ef732d96a7238fd2089956c42a5a6663764cb108499999ae9095a1e1be4f | Python | 5,136 | 135 | # translate word into id in documents
import sys
import numpy as np
import pandas as pd
from scipy import sparse
import itertools
import os
w2id = {}
DATA_DIR = 'D:/UB/research/dataset/20newsgroups/'
def indexFile(pt, res_pt, matrix_pt, batch_size, window_size):
print('index file: ', pt)
wf = ope... |
f97240d4ce2cddd1f068ea7f7c2b167c4eb54ce69acf7040bde1853f4743ebc5 | Python | 5,136 | 127 | import os.path
import numpy as np
import matplotlib.pyplot as plt
import torch
from captum.attr import Saliency, DeepLift, IntegratedGradients
def plot_msa_attr(saliency_map, ig_xinput_map, msa, molecule_type='protein',
save=''):
alphabet = 'ACGT-' if molecule_type == 'DNA' else 'ARNDCQEGHILKMF... |
b33a091e1c66c669b3f4a0f1ec4f40cf3bb8954f67d1a7156f52a02e6cabca62 | Python | 5,139 | 150 | # This code takes the reconstructed CT image stacks from a specified directory,
# bins them to size 243x243 (x,y) and saves them in a new path for further processing
import numpy as np
import h5py
import getopt, sys
import numba
from numba import jit
#get command line arguments for which tablet should be processed
#... |
64fa307950c9d5b9621b54b16a6b030b843cedb0aad7f5b6713937ee3f96242e | Python | 5,143 | 164 | """
Short script to parallelize omegafold across GPUs to speed up runtime.
https://github.com/HeliXonProtein/OmegaFold
"""
import os
import logging
import argparse
import subprocess
import shutil
import multiprocessing as mp
from typing import *
import torch
import numpy as np
from biotite.sequence import ProteinSequ... |
12f66d9275863e3c4ed086fd582b9bdb5f703bb0890a72b0ee9b9a017971dc19 | Python | 5,144 | 141 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
86537c1b0ece09e3d9c9c7ec6d9f906264d3c2fb9cbee3b91c4188160901f110 | Python | 5,144 | 192 | import os
import shutil
import logging
import numpy
def create_logger(path, name, log_level):
"""
create a logger
it's important for debugging the co-simulation because each modules is in independent processe
:param path: path of the result
:param name: name of the logger and for the file
:para... |
e969cb476438f95a81409488c56df213bc60d155ad7e75155b121240037c3ffd | Python | 5,146 | 124 | """The vendored clustering metrics, and the wrapper the acceptance rule reads them through.
`validate/metrics_lib.py` is copied verbatim from the benchmark this build has to stay comparable
with, so it must not be edited. It had 0 % coverage across 97 statements while producing the
purity, retention and F1 that `docs/... |
71c86ace653a430aa69b47691245c08d0dd1b3d2ab52f0eeb52b855d692694ed | Python | 5,148 | 154 | """K-medoids clustering.
Lead author: Hadi Zaatiti.
"""
import logging
from sklearn.base import BaseEstimator, ClusterMixin
import geomstats.backend as gs
from geomstats.learning._template import TransformerMixin
class RiemannianKMedoids(TransformerMixin, ClusterMixin, BaseEstimator):
"""Class for K-medoids c... |
b730fe4bb41f6c90318849fe815553b176fde514b9d6619420211b88dc6f09ac | Python | 5,151 | 137 | # Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
import logging
import os
import numpy as np
from src.nii_reader import nii_reader
logger = logging.getLogger(__name__)
def train_val_split(features, labels, perce... |
22da18d8e910d36621be5772319479eb0252896d4c75141fe3791c105552ff3a | Python | 5,154 | 150 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from typing import List, Dict, Union
import torch
from nequip.utils.global_dtype import _GLOBAL_DTYPE
# conversion flow: partial_dict -> full_dict -> tensor -> str
# ... |
e234a5784d49c7d6f1a325710c132059ae965e622c37e7759dcb261e047eab7d | Python | 5,155 | 165 | """
Short and easy wrapper for TMalign
"""
import os
import argparse
import collections
import re
import itertools
import shutil
import subprocess
import multiprocessing as mp
import logging
from typing import *
import numpy as np
import pandas as pd
logging.basicConfig(level=logging.INFO)
def run_tmalign(query: s... |
15293b684f79c0dd399944b60f5211876989881e760ad6d87fe11991c4dfaee0 | Python | 5,156 | 149 | from PymoNNto.NetworkCore.Base_Tagable_Object import *
import inspect
#This class can be used to add tag-searchable functions to the neurongroups, synapsegroups and the network object.
#It has a main execute funtion which can be called with module(...) or module.exec(...)
#Other "normal" functions can be added as well... |
08b1a3ddb0f101e8e5d0398e04ce8443b7a6041e4b20f751719ca1eef11bbc16 | Python | 5,157 | 164 | import numpy as np
import renderapi
from scipy.sparse import csr_matrix
from scipy.spatial.distance import cdist
from .utils import AlignerTransformException
__all__ = ['AlignerThinPlateSplineTransform']
class AlignerThinPlateSplineTransform(renderapi.transform.ThinPlateSplineTransform):
"""
Object for impl... |
a08303088ab74baf664753492781f6dff18288063e9bef0aa9134aed7ce7feb2 | Python | 5,158 | 174 | #!/usr/bin/env python
"""Main entry point into Reinvent."""
from __future__ import annotations
import os
import sys
from dotenv import load_dotenv, find_dotenv
import platform
import getpass
import datetime
from typing import Any
from rdkit import rdBase
import rdkit
import torch
from reinvent.utils import (
pa... |
32b3d211b8723cc91988855319eebb32702b76a0c12deb07b1dbac9bafb3fc50 | Python | 5,160 | 171 | #!/usr/bin/env python
#
# pymonntorch documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
db920fd09e157949c000c946d91a1b2b489f7d51558ca079e99a0127224de012 | Python | 5,160 | 169 | """
Sound loaded from a file.
@author: Mathieu Scheltienne
"""
from pathlib import Path
import numpy as np
from scipy.io import wavfile
from scipy.signal import resample
from ._sound import _Sound
from ... import logger
SUPPORTED = ('.wav')
class Sound(_Sound):
"""
Sound loaded from file.
Parameters
... |
76234efccb7a28962b2ba7841486cbd72bfebbe6069a4f24a2bb17cbd37bf380 | Python | 5,162 | 164 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network model_templates and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human C... |
8937fc5b2d49a46f4a054d9fe5f601be48bd3319e3d7101844a1eabc2d279ac9 | Python | 5,165 | 128 | from typing import Optional, Callable
import torch
from torch import Tensor
from torch.cuda import Stream
from dig_ext.sync import synchronize, read_async, write_async
# synchronize = torch.ops.torch_geometric_autoscale.synchronize
# read_async = torch.ops.torch_geometric_autoscale.read_async
# write_async = torch.o... |
afcab7765bc9aa28e1083f470de3d289a61a1415b478bef7edf00a192a740f40 | Python | 5,165 | 163 | # Author: Guoqing Bao
# School of Computer Science, The University of Sydney
# Date: 2019-12-12
# GitHub Project Link: https://github.com/guoqingbao/Pathofusion
# Please cite our work if you found it is useful for your research or clinical practice
# from IPython import get_ipython
# %%
import os
# os.environ["CUDA... |
b3a83d0b37e2e78ee21a3b49d47b9348b5d0c9035e09980a54171263288d6a3a | Python | 5,167 | 190 | """Vocabulary and token handling"""
import re
import logging
import numpy as np
logger = logging.getLogger(__name__)
class Vocabulary:
"""Stores the tokens and their conversion to vocabulary indexes."""
def __init__(
self, tokens=None, starting_id=0, pad_token=0, bos_token=1, eos_token=2, unk_toke... |
4f2b384f052d49aaa441a98f8bc25b5533db91bb8b42f8beba0dd78e4c4cb3ee | Python | 5,171 | 158 | """
Generate a large batch of image samples from a model and save them as a large
numpy array. This can be used to produce samples for FID evaluation.
"""
import argparse
import os
import numpy as np
import torch as th
import torch.distributed as dist
from datetime import datetime
from PIL import Image
from guided_d... |
2ea2ced5039aebe8962b663fd7278f41e343617ada392973be8c448d51382d45 | Python | 5,174 | 168 | """The browser fetch path: a direct GET, never `hf_hub_download`.
`hf_hub_download` HEAD-probes the resolve URL, and both Pyodide HTTP backends
crash on the bodiless response, so under Pyodide `fetch_resource` must go
straight to a GET instead. The whole Pyodide runtime is faked here — a real one
needs a browser or no... |
5d1c855a3a61c411760b811a1b86f727828bcafa40528a56f3d4593d9114832c | Python | 5,174 | 123 | """
PostgreSQL database
Manifest handler
"""
from python.ManifestHandler import ManifestHandler
from python.glassfunc import build_dict
import psycopg2
import psycopg2.extras
class PostgreSQLManifestHandler(ManifestHandler):
__conn = None
def __init__(self, user, password, database, host = "localhost... |
0e01c681fb053e13eb2bc1981c524320328919920f61a42e4ecb5ba922724d6b | Python | 5,177 | 141 | # %%
import neo
from neo import Spike2IO
import numpy as np
import matplotlib.pyplot as plt
import quantities as pq
from pathlib import Path
import dill
# %%
"""
######## ######## ######
## ## ## ## ##
## ## ## ##
## ## ## ######
## ## ## ##
## ... |
dab0b7831010d030e62701fac4645031a47dcdce4c9791a2b77ae4d0e52011ff | Python | 5,179 | 150 | import itertools
import torch
import torch.nn.functional as F
def NCE_loss(zs=None, zs_n=None, batch=None, sigma=None, **kwargs):
'''The InfoNCE (NT-XENT) loss in contrastive learning.
Args:
zs (list, optipnal): List of tensors of shape [batch_size, z_dim].
zs_n (list, optional): List of ... |
31df0828590cc4b2888269ca209f75078ca94e31356bc4ad632272c3a70d4b97 | Python | 5,182 | 163 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
70fd91b9caa583d60198e72ca7432a4db88a41613bf03c18bc092c3f109b4640 | Python | 5,182 | 165 | from chromadb.utils.embedding_functions.schemas import validate_config_schema
from chromadb.api.types import (
Documents,
Embeddings,
Images,
is_document,
is_image,
Embeddable,
EmbeddingFunction,
Space,
)
from typing import List, Dict, Any, Union, cast, Optional
import os
import importli... |
a39c724e039a3998f5fec89c996f016fb42b2509f6c5b9c8ee887cf334c6a738 | Python | 5,182 | 129 | """
Multivariate Prediction
=======================
Running MVPA style analyses using multivariate regression is even easier and faster
than univariate methods. All you need to do is specify the algorithm and
cross-validation parameters. Currently, we have several different linear algorithms
implemented from `scikit-l... |
d62dd34c67cb1356067c1f0de6b064b70215073995a27187921cfd8cd285eb66 | Python | 5,186 | 162 | import numpy as np
from scipy.interpolate import UnivariateSpline
from utils import load_data, get_costs, polyfunc
from sklearn.decomposition import PCA
from tqdm import tqdm
from optimization.jimbokunisawa import optimize
from scipy.stats import norm
from itertools import product
import pickle
groups = ['feedforward... |
5bf3752d95ce588c1f08808731d1e9e59e2249b79d3510ae8d9c935a449b3525 | Python | 5,189 | 187 | import numpy as np
from roifile import ImagejRoi, roiwrite
from PyQt5.QtCore import QObject, pyqtSignal
import pandas as pd
import imageio as io
import os
from pathlib import Path
class ExportFolder(QObject):
zSignal = pyqtSignal(int, int)
def __init__(self, rois):
"""Class to export ROIs to a folder... |
a746c22d00d0d1aa798bc56ac4a8d6972df6261e833c344ade2138256373917b | Python | 5,190 | 164 | # -*- coding: utf-8 -*-
"""
Created on 20170704 21:15:19
@author: Thawann Malfatti
Loads info from the settings.xml file.
Examples:
File = '/Path/To/Experiment/settings.xml
# To get all info the xml file can provide:
AllInfo = SettingsXML.XML2Dict(File)
# AllInfo will be a dictionary following the ... |
1529db56bc4c1d0fd667a595f367ad1723055208094d143133aed49da862f3a2 | Python | 5,192 | 119 | import os
import argparse
import pandas as pd
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('--run1', '-r1', type=str, default=None, required=True)
parser.add_argument('--run2', '-r2', type=str, default=None, required=True)
parser.add_argument('--run3', '-r3', type=str, default... |
56cabfa90e5bcd1f99054f1d61b39ff5f1463e002e9f8efe48c6f56c300a4f16 | Python | 5,196 | 188 | import torch
import time
#heating up the CPU
#for i in range(1000):
# temp = np.random.rand(10000, 5000)*np.random.rand(10000, 5000)+np.random.rand(10000, 5000)
d = 'cpu'
t = torch.float64
#for i in range(60):
for i in range(1):
measurements = []
steps = 1000
########################################... |
24c96c33ace1a752d18caa947e2f2941f6d548e8bc5c654816063f907e6660fa | Python | 5,197 | 102 | # -*- coding: utf-8 -*-
import functions.rate_coding
import numpy as np
import functions.Graphs
import matplotlib.pyplot as plt
from scipy import stats
import functions.statistics_test as st
#%% Load data
data = np.load('/datapath/dataset.npy', allow_pickle=True).item()
#%% A Prop struggle/immo cells o... |
3f3a2349f6bf1bb3f7e614062525670f021d65beb4854e8a62858b48d7088e63 | Python | 5,198 | 195 | # execute using the same docker to have everything in the same torch version
import torch
import torch_geometric.transforms as T
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
database = 'drugbank'
print(f"Executing Linear regression For {database} & doing Grid Search")
# add line cuda if... |
8fdd911f3af130d1e82e6eef93e14131b7e7c8e2be1b10695d1daec078bfe275 | Python | 5,202 | 122 | from sklearn.manifold import TSNE
from matplotlib.backends.backend_pdf import PdfPages
import pandas as pd
import matplotlib.pyplot as plt
data_21907 = pd.read_csv('Feature_21907.csv', sep='\t')
data_3102 = pd.read_csv('Feature_3102.csv', sep='\t')
data_mutual_1000 = pd.read_csv("Feature_mutual_info_classif_SelectKBe... |
7e54690d2b02dc6683486e7aee2ed82d8804b8990b14afcbbfcc04e896b9acfb | Python | 5,203 | 160 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""KerasDataLoader module."""
import numpy as np
from openfl.federated.data.loader import DataLoader
class KerasDataLoader(DataLoader):
"""A class used to represent a Federation Data Loader for Keras models.
Attributes:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.