sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
07b3052f31f7f808efe34ce4c3eb8dd2be03161b2b619840162e004f3a9eef34
Python
8,335
215
''' Module focused on the implementation of Higher Order SVD (HOSVD) technique. ''' import torch import numpy as np class HOSVD(): def __init__(self, mode_number_list): """ Class that handles Higher Order SVD. Use the tensor of interest shape as parameter, if all the hosvd modes ar...
70e145301060954f149de832cb6922868833ed375f9cd55e62991a481e798d1e
Python
8,335
211
# 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...
826a4d48aef8130ae8f3742dd0e892fe0e7bb59f70a07f46ada155a442148291
Python
8,337
211
import glob import platform import nibabel import os import numpy as np import torch from monai.transforms import Compose, Spacingd, ToTensord, LoadImaged, AddChanneld, ThresholdIntensityd, LoadImage, ScaleIntensityRanged, NormalizeIntensityd from monai.data import NiftiSaver from segment_to_segmentbox import generate_...
f95fdbfe3c26ca8341c19ee7a87190208e330c153ddbd4a36a7ce63c29bad0c8
Python
8,341
207
import os import tempfile from types import SimpleNamespace import numpy as np import torch from ase.build import molecule from ase.calculators.singlepoint import SinglePointCalculator from mace.data.lmdb_dataset import LMDBDataset from mace.data.utils import KeySpecification, update_keyspec_from_kwargs from mace.too...
e862e8e24cc273d371d9ebc16905ec4600649187ed058f8a4ef9411bb85f860d
Python
8,348
186
import h5py import sys import numpy as np """ sl files use an lz4 compression filter for which a plugin needs to be installed Mac: sudo port install hdf5-lz4-plugin Ubuntu: (http://gisaxs.com/index.php/HDF5) sudo add-apt-repository ppa:eugenwintersberger/pni sudo apt-get update sudo apt-get install hdf5-plugin-lz4 ...
fa22bfffb8c68dbf6557ceec7f7cc87941bbc20a14eb3224319d4759478d7b5b
Python
8,357
207
""" Code adapted from https://github.com/ozan-oktay/Attention-Gated-Networks to facilitate LRP, original code was released under the MIT License copied below: MIT License Copyright (c) 2018 Ozan Oktay Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documen...
2ae827c526ac111828548f6b835503f9e5dc84b248f0244ad2a616bd40d017a2
Python
8,383
266
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 22 21:36:36 2020 @ Modified by Hoseok Choi """ """ Created on Sun Aug 16 21:40:26 2020 @author: Soonhyun Yook """ import inspect, os, sys import numpy as np from keras.models import Sequential import tensorflow from keras.layers import TimeDist...
4687e628391c2677d8e5f1ff6e557df5130a03c4bb26fe961498ba474da8f61d
Python
8,384
210
from chromadb.api.types import Embeddings, Documents, EmbeddingFunction, Space from typing import List, Dict, Any, Optional import os import numpy as np from chromadb.utils.embedding_functions.schemas import validate_config_schema import warnings class OpenAIEmbeddingFunction(EmbeddingFunction[Documents]): def __...
8a8de51761a43f2178f8d770e30bb57e470b6cf93175e8bf095077a7e497570d
Python
8,390
211
from __future__ import annotations import argparse from pathlib import Path from typing import Any, Iterable, Sequence import attrs import more_itertools as itx from snakebids import bidsapp from snakebids.bidsapp.args import ArgumentGroups from snakebids.exceptions import ConfigError from snakebids.plugins.base imp...
37904f68c1ed5575ff6ef8a3a524ec1c1be035c70c2ee4222389cda8b16fbc0a
Python
8,391
243
from collections.abc import Iterable, Sequence from itertools import pairwise import numpy as np from qtpy.QtCore import QPointF, QRect, QRectF, Qt from qtpy.QtGui import QColor, QColorConstants, QImage, QPainter from idtrackerai import Blob from idtrackerai.GUI_tools import CanvasPainter def find_selected_blob( ...
3ce03389d50bc419cc934b13086927fe5297a6b0d14e3fc68768f6175e616926
Python
8,393
210
import os import json import random from scipy.io import loadmat from online import * allowed_extensions = ['.mat'] def get_system(config): if config.input_space and not config.online: return System(config=config, input_space=config.input_space), 'offline' elif config.input_space and config.online: ...
6f350a48bfb95ee020fe7495c41210927fa311b567b25b863eaca91068d3821e
Python
8,399
265
import numpy as np from functools import partial from sleepy.processing.signal import Signal from sleepy.gui.tagging.model.event import EventTypeNotSupported, PointEvent, IntervalEvent from sleepy.test.debug import tracing class Engine: def run(algorithm, filter, dataset, settings = None): """E...
7441ed6814a0f13b54573fbc2b5080fcec56f25a0a758fe2b88802e74a1bdab4
Python
8,403
271
"""Test for ExternalProcess component with empty metadata bug""" import pytest import json import tempfile import os import sys import numpy as np import numpy.testing as npt from reinvent_plugins.components.comp_external_process import ExternalProcess, Parameters def create_test_script(script_content: str) -> str:...
11b4728d8b03e13dab072b0786dada38fb9d08c6e1ccf2045f3907b7491fca04
Python
8,409
227
import torch import torch.nn as nn from collections import OrderedDict from hyper_dti.settings import constants from hyper_dti.models.noise import EncoderHead from hyper_dti.models.context import ContextModule from hyper_dti.models.mlp import Classifier from hyper_dti.models.utils.initialization import get_initialize...
c9e5e04d08cc4e56013bcec421b1f2d5369121f16d52753e35224737391c7ff8
Python
8,423
188
import re from typing import Optional, Sequence import config import numpy as np import pytorch_lightning as pl import torch from torch import nn, optim from learning.loss import ComposedLoss, DeepLoss, SoftDiceLoss def dice_torch(true: torch.Tensor, pred: torch.Tensor): intersection = torch.logical_and(true, p...
3ae0b07e75ad71255d0f7026e1cf8a209f7ba46808c040825975c502a67d1963
Python
8,424
249
""" Created on Wed Jun 16 13:47:51 2021 @author: Mathieu Scheltienne """ import cv2 from ._visual import _Visual from ... import logger class Cross(_Visual): """ Class to display a cross, e.g. a fixation cross. Parameters ---------- length : int The number of pixels used to draw the len...
36069c87d91162d5f41c18cdcfc6ac82c91d9f0271c125fb54b0c4293800558f
Python
8,427
204
# -*- 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 Cogn...
5a6f80b0bc18abfad481677ed8a51d0666c781cb518968662e382d194599f4d6
Python
8,430
177
# 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 # # Unless required by appli...
d0d1c368aa50deef47c8bf46e799b51ba6cda82a4d9ca55157f939ca32333645
Python
8,439
244
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # OS stuff import os import sys import warnings from pathlib import Path # Computational stuff import numpy as np import matplotlib as mplb import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec from matplotlib import font_manag...
0bd315f5987526ff5dc99e7d53ccff20d3ef6229b1fcd935a0f932dd8ff18ef2
Python
8,441
250
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
caba36cc6aa39fdbcbef8a3da00165ce35a83d456a6de0bddfb690cab371ca23
Python
8,450
168
import itertools from typing import List, Tuple, Dict import warnings from deeperwin.configuration import set_with_flattened_key, Configuration import copy from deeperwin.run_tools.dispatch import dispatch_job, build_experiment_name, setup_experiment_dir, dump_config_dict, idx_to_job_name from deeperwin.run_tools.geome...
0127f78919b9d91115f5e7c7d7392ccaab8903550422752ae3a7ba6158c82f53
Python
8,451
263
from tqdm.auto import tqdm, trange import numpy as np import torch from sample_for_integral import project2simplex from util import NesterovGD @torch.no_grad() def estimate_weight_wonbr( Y, M, X, sigma_yx, prior_x_mode, prior_x, context, n_epochs=10000, tol=1e-5, update_alg='gd', verbose=True): """ min 1/2σ^2 |...
3e6b09e687fbba4e19fc8d9a348227689d92ae8de8e5346182dbaae9d2cf990b
Python
8,451
247
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openfl.experimental.workflow.interface import FLSpec from openfl.experimental.workflow.placement import aggregator, collaborator from tests.end_to_end.utils.exceptions import ReferenceFlowException import io import math import logging ...
f7d4f656f49b63464b3d2e461e01a028bffe878ed7fdccbf0ec906603a2e6a5f
Python
8,452
275
import json import copy from math import floor, ceil import numpy as np from corgie.helpers import crop def get_bcube_from_coords(start_coord, end_coord, coord_mip, cant_be_empty=True): xs, ys, zs = [int(i) for i in start_coord.split(",")] xe, ye, ze = [int(i) for i in end_coord.split(",")] bcube = Bound...
47c8799bbfaa6d2e601266df424448969270e1cc31c33422fd8222bdd86781e5
Python
8,453
257
from abc import ABC, abstractmethod from typing import Tuple, Dict, Any import gym import numpy as np import torch from ..datasets.preprocess import subsample, gray_scale, binary_image, crop from ..encoding import Encoder, NullEncoder class Environment(ABC): # language=rst """ Abstract environment class...
d62a2c75dcf10c4cea49d2b4dc46010db8404e328050713f96f1f92dcbecd786
Python
8,453
262
import logging from typing import Dict, List, Optional import torch from prettytable import PrettyTable from mace.tools import evaluate def custom_key(key): """ Helper function to sort the keys of the data loader dictionary to ensure that the training set, and validation set are evaluated first ...
a7468d7f8836eac8df5a35617bc468d7c9d07e51a27f7a0b72b7a289859667b7
Python
8,456
261
"""constants.py: Module that stores several useful constants for the project.""" # Dataset name MASS_SS_NAME = "mass_ss" MASS_KC_NAME = "mass_kc" INTA_SS_NAME = "inta_ss" MODA_SS_NAME = "moda_ss" CAP_SS_NAME = "cap_ss" PINK_NAME = "pink_nn" NSRR_SS_NAME = "nsrr_ss" # Database split TRAIN_SUBSET = "train" VAL_SUBSET =...
dd7b4759c68e699eaa5eef19b07283485355affc2c4177408182acf225acf111
Python
8,457
214
import os import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from tqdm import tqdm # load PATH_OUT = 'Results/inferring_dtis/' if not os.path.exists(PATH_OUT): os.makedirs(PATH_OUT) print(f"Folder '{PATH_OUT}' created successfully.") datasets = ['DrugBank', 'BIOSNAP', 'Binding...
0efa80e724c38c905da52075eaa127beec79aaf9a1c387ea6b69bd45cf441ab8
Python
8,461
276
"""Scoring component for generic Maize workflows Calls Maize workflows in a serialized format, utilizing the`ReinventEntry` and `ReinventExit` nodes to provide a consistent JSON interface. Example use: .. code-block:: toml [stage.scoring.component.Maize] params.executable = "/home/me/miniforge3/envs/maize-dev/b...
44d643bd18b9fc5833b941e74d9729b86e4d8effe3acd9f16166c6e230d0bfa3
Python
8,465
245
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
d76a2ea9cac6009a3046304e3c60034a45a90c740a62fe01a10ee729f5ff3ef6
Python
8,470
287
# -*- coding: utf-8 -*- """ Created on Thu Apr 22 14:30:31 2021 @author: nicol """ import os, glob, tqdm from skimage.io import imread, imsave import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib import rc import matplotlib as mpl import scipy.ndimage as ndi fro...
084afec9ff3d33f0a82e0a9698d3ed30ead259cf649ced6acf227cd12443e8e4
Python
8,486
227
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """AggregatorGRPCServer module.""" import logging from concurrent.futures import ThreadPoolExecutor from multiprocessing import cpu_count from random import random from time import sleep from grpc import StatusCode, server, ssl_server_cre...
bbf3d3d15bbbed99ab954c9e7e5ea6a694c4141774c5d5c73e9222821b382748
Python
8,487
262
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """SKCPipeline module.""" import copy as co import gzip as gz import numpy as np from sklearn import cluster from openfl.pipelines.pipeline import TransformationPipeline, Transformer class SparsityTransformer(Transformer): """A tra...
c6ec1a4300251469c011958f23d605559eca5246870e132f54c651728b5f60e5
Python
8,487
257
# WiltingPriesemann toolbox for MR estimation # Authors: Jens Wilting & Viola Priesemann # Max-Planck-Institute for Dynamics and Self-Organization # Am Fassberg 17 # D-37077 Goettingen # Germany # # Minimal toolbox for MR estimation according to # Wilting & Priesemann, 2018 import numpy as np import scipy.stats import...
999655f674991dcd7cdfdd7e70d94719670e782d31420c763c2b8fa9171d74ef
Python
8,489
255
import lungmask from lungmask import mask from monai import transforms from monai.transforms.intensity.array import ThresholdIntensity from monai.transforms.spatial.array import Resize, Spacing from monai.transforms.utility.dictionary import ToTensord import torch import numpy as np from monai.transforms import (Compos...
9c55f645429529ab48006169e2e9b162bf3384aff3abae9ca0a9f419b5d4272c
Python
8,494
257
from typing import Any, Dict, List import pytest from chromadb.api.collection_configuration import ( load_collection_configuration_from_json, load_create_collection_configuration_from_json, load_update_collection_configuration_from_json, ) from chromadb.api.types import ( Documents, Embeddings, ...
078855b6bff20669ea03905a39a79a63e543eb22a79d3531eb311c21df59f075
Python
8,501
195
""" # Fingerprinting - CAMCAN Cohort ## HCTSA Similarity variance Script - hctsa similarity Author: Frédéric St-Onge Date created: 2021-12-08 Date modified: Version: 1.0 -------- Purpose: -------- This script is made to compute temporal similarity like in the paper by Golia et al. (2020; eLife). In this paper,...
7ecfa7b28d0631922976bac8c376825004ba5b6cf334055276f3f1677ed9bebf
Python
8,501
238
"""Inspect one remote DANDI NWB asset through PyNWB and LINDI.""" # /// script # requires-python = ">=3.13,<3.14" # dependencies = [ # "dandi>=0.81,<0.82", # "lindi==0.4.6", # "platformdirs>=4.3,<5", # "pynwb>=4.2,<5", # ] # /// from __future__ import annotations import argparse import time from coll...
09f05bc1187af8915125490deb650be6061fa1019801a1eea94c696d5130cc70
Python
8,506
166
# %% import os import numpy as np import time import h5py import sys from scipy import sparse from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w...
d62b753bd1986edf6bf9ca760ddf56ac6387ebbc4be3ad33832464d872c9eb14
Python
8,508
252
import pytest from nequip.utils.unittests.model_tests_ase_integration import ASEIntegrationMixin from nequip.utils.unittests.model_tests_train_time_compile import TrainTimeCompileMixin from nequip.utils.unittests.model_tests_lammps import LAMMPSMLIAPIntegrationMixin from nequip.utils.unittests.model_tests_torchsim impo...
0f2f32e8d20d7f540661bec977bdfb090f42be6d656800f67b496d20b941f1a9
Python
8,513
190
import math import json from openpyxl.worksheet.table import Table, TableStyleInfo from openpyxl.styles import Alignment from nilearn import plotting,image,surface,datasets from utilityFunctions_yz import * import collections bn_atlas_file = 'PROJECT_DIR/scripts/features/bnatlas_tree.json' parent_substitutions={ ...
1188834ce19d7bfa1486cadc63bac3c9a921be71b6d93def279241f618bcd057
Python
8,514
256
"""Scalar product of a Riemannian metric. Define the product of a Riemannian metric with a scalar number. Public Methods: register_scaled_method(func_name, scaling_type) Public classes ScalarProductMetric Lead author: John Harvey. """ from functools import wraps import geomstats.backend as gs import geoms...
4c43793f4be48f4bfabb6f26502e52eb3ce3b0c1ab7d0d9a23034f14ebeed4cb
Python
8,516
246
"""Sample SMILES from a model LibInvent, LinkInvent and Mol2Mol need input SMILES while Reinvent does not. The output is a list of SMILES including the fragments where applicable and the negative log likelihood if requested. """ __all__ = ["run_sampling"] import logging from torch.utils.tensorboard import SummaryWri...
ad0703fb7b900891d095da64c4ff049ae18fad80041f8b6400f3f50ce219babe
Python
8,523
259
import numpy as np import matplotlib import matplotlib.pyplot as plt from neuron import h, gui from scipy import stats as st h.load_file("nrngui.hoc") h.load_file("import3d.hoc") h.load_file("models/biophys_HL23MN1.hoc") h.load_file("models/biophys_HL23PN1.hoc") h.load_file("models/biophys_HL23BN1.hoc") h.load_file("...
4ced1d0a06ee48b29e0a5b5fe057320eaa962809078ae0076636bbeecf978c36
Python
8,526
197
# 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 # # Unless required by appli...
4a2ad9a2376440a784e26ba16004e3db42c3ef420c8c01047c404743555bf88d
Python
8,529
184
import torch from torch import Tensor from torch_geometric.utils.loop import add_remaining_self_loops from dig.version import debug from ..models.utils import subgraph from .utils import symmetric_edge_mask_indirect_graph from torch.nn.functional import cross_entropy from .base_explainer import ExplainerBase fr...
7a2626d7da71ae5c98c133e23dbcb73da3ed9408eb279e945aa6eeeb9fe9e08e
Python
8,542
260
# -*- coding: utf-8 -*- import os import argparse import logging import torch from torch.nn import CrossEntropyLoss, KLDivLoss, NLLLoss, SmoothL1Loss, BCELoss, BCEWithLogitsLoss import torch from torch import nn import torch.optim as optim from torch.optim.lr_scheduler import ReduceLROnPlateau import torch.utils.da...
9a98698d2af8863a64eb52ff892f02e94797f3f0e6377c7b18326ebcc986e342
Python
8,542
229
import multiprocessing from concurrent.futures import Future, ThreadPoolExecutor, wait import random import threading from typing import Any, Dict, List, Optional, Set, Tuple, cast import numpy as np from chromadb.api import ClientAPI import chromadb.test.property.invariants as invariants from chromadb.api.segment imp...
ab1969a148fbb13c015b689f94bbed6a9072e151f2e068c36474612d767cf6fc
Python
8,543
227
"""Plugin for editing experimental metadata and sweep conditions.""" from __future__ import annotations from functools import partial from typing import Any from PyQt5 import QtCore, QtGui, QtWidgets import sanpy from sanpy.interface.plugins import sanpyPlugin class SetMetaData(sanpyPlugin): """Edit experimen...
40c45513625a90d4a39077099ee657d362c9f85fa2d49ed4a63edf7732721d7c
Python
8,549
193
""" Estimate the logarithmic multi-unit activity (MUA) by averaging the power in a given frequency range. """ import numpy as np from elephant.spectral import welch_psd from elephant.signal_processing import butter from scipy.stats import zscore import quantities as pq import matplotlib.pyplot as plt import seaborn as...
1976c091316b8e566c54f8e6ff884b6a2acb8cf43079484edd50a3b62b8091e1
Python
8,552
224
import numpy as np import matplotlib.pyplot as plt import copy from scipy.io import loadmat from sklearn.decomposition import PCA from matplotlib.gridspec import GridSpec from matplotlib.collections import LineCollection from matplotlib import colors as mcolors import matplotlib.patheffects as pe def preprocess(dat...
292eefbb6380284704e3fd1211e5f39a65538af714d8cf73a6aec254ef2640ea
Python
8,555
193
""" Estimate the logarithmic multi-unit activity (MUA) by averaging the power in a given frequency range. """ import numpy as np from elephant.spectral import welch_psd from elephant.signal_processing import butter from scipy.stats import zscore import quantities as pq import matplotlib.pyplot as plt import seaborn as...
be4bb35b3b09ae05ce45f3040ecc08639a045644e1bf984319ee6d0c61f6987e
Python
8,556
252
import json import logging from pathlib import Path from shutil import copyfile import numpy as np import torch from torch.nn import CrossEntropyLoss from torch.optim.lr_scheduler import MultiStepLR from torch.optim.sgd import SGD from idtrackerai import Session, conf from idtrackerai.utils import load_id_images fro...
66ba1abdbbc86ffafc729cb91fe8b7fdd6607cef5af283c21dd5849ee9fd5b5a
Python
8,557
184
"""What happened to the id you had. An id that vanishes is the failure a consumer cannot diagnose: a reference that used to resolve returns nothing, and nothing distinguishes a correction from a deletion. So every level keeps a lifecycle row, and the row holds only what a build cannot recompute (``ROADMAP.md`` section...
73e1f690029c701e8fbcf694865ddd0c837d7a87dea585a9f7ead0b9e697e10f
Python
8,562
283
# 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...
ef5d3fd44c70aa28284a08aeb92c1c8ae2d318aebdb78326b2e422f447abf343
Python
8,562
229
import pickle import numpy as np from aux_fun import remove_SPH , construct_target_B, performance from regularization import get_firing_power, alarm_generation, alarm_processing from evaluation import alarm_evaluation, sensitivity, FPR_h, statistical_validation from datetime import timedelta as dt import time as ...
b6e9ab01df6144c848c83d2b5eb6d89f9bb4bf564c9015d166e8b68bf6384e7c
Python
8,567
166
# %% import os import numpy as np import time import h5py import sys from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set which GPU to use. '-1' use...
33024fc9c0452a1a11d0d58386439136240983c40d38d1db152075943a0fa7f4
Python
8,568
168
# %% import os import numpy as np import time import h5py import sys from scipy import sparse from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w...
2f08d6f1bfc31873a5842f826ca2771c46db592edb25e139445003d6b94c6cbb
Python
8,569
476
from reinvent.datapipeline.filters.regex import SMILES_TOKENS_REGEX KNOWN = [ ( "Cc1cccc(C2Sc3ccccc3NC3=C2C(=O)c2ccccc23)c1F", [ "C", "c", "1", "c", "c", "c", "c", "(", "C", "2", ...
f2359eaf632f94c8eca03bf58b38f4e5f1bdebb5cb3451a81efce60add15bb76
Python
8,569
249
# Copyright (c) 2020 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...
69937ae1a33aef9b71607e8c8512045fc3bc01cc3572fa8ae3572d89625a2e9d
Python
8,570
232
from chromadb.api.types import Embeddings, Documents, EmbeddingFunction, Space from typing import List, Dict, Any, Union, Optional import os import numpy as np from chromadb.utils.embedding_functions.schemas import validate_config_schema from chromadb.utils.embedding_functions.utils import _get_shared_system_client, ge...
e749772e086654575c3036d4c9f2099399164a99e326fda8a08b7447a8a5cb1b
Python
8,574
233
import numpy as np import pandas as pd import polars as pl import pytest from nltools.data.designmatrix import DesignMatrix class TestDesignMatrixConstruction: """Test all supported ways to create a DesignMatrix.""" @pytest.mark.parametrize( "input_data,kwargs,expected_cols", [ (n...
47528c718b8f5d6d56b752ea1ee3f7048ba122b425f50c341e4c3ac6adcfbe2d
Python
8,575
194
""" Estimate the logarithmic multi-unit activity (MUA) by averaging the power in a given frequency range. """ import numpy as np from elephant.spectral import welch_psd from elephant.signal_processing import butter from scipy.stats import zscore import quantities as pq import matplotlib.pyplot as plt import seaborn as...
33ab9b731bfcfcabcbbd7a7cdc5096fd2bd9cb48acbdcfd8f9ff9b4106170fff
Python
8,578
264
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openfl.experimental.workflow.interface.fl_spec import FLSpec from openfl.experimental.workflow.interface.participants import Aggregator, Collaborator from openfl.experimental.workflow.runtime import LocalRuntime from openfl.experime...
8ba6749ab026c1f3b2c1dc47939577b76f6373e8de0c5645e318f8af515c0803
Python
8,581
261
from matplotlib.backends.backend_pdf import PdfPages import matplotlib import numpy as np import renderapi import argschema from ..schemas import * matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.colors import Normalize import mpl_scatter_density def transform_pq(tspecs, matches): p = [] ...
5f16e81983d496b673424c40781ebe604ea6e8ae07ede80560693d22153eaf8d
Python
8,588
174
from plotly import graph_objs as go import numpy as np import json import pickle5 as pickle import os from scipy.io import savemat # bn_atlas_file = '/Users/zhangyuan/Desktop/Sherlock/projects/sryali/2019_DNN/scripts/features/bnatlas_tree.json' with open(bn_atlas_file) as f: bn_atlas=json.load(f) def generate...
c54998885b86875e7726d5ae6702f438c5284545d3607f3b0bbeb661ed6e0888
Python
8,604
219
# -*- coding: utf-8 -*- """ Twig-profreafing analysis of presynaptic inputs Clean code for publication @author: Sebastian Molina-Obando """ #Importing packages import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import os import numpy as np; np.random.seed(0) ...
5c0e4397dd748519265a6dcea8557e7d5bb23f66940ae646287a531b7ea17ce2
Python
8,612
148
"""PubMed author lists as a reviewed input to offline provenance checks.""" from __future__ import annotations import unicodedata import urllib.parse from pathlib import Path from xml.etree import ElementTree import polars as pl AUTHOR_TABLE = Path("proofreading/pubmed_authors.tsv") def author_key(name: str) -> st...
9062d40d51739ec6d4d712502830c31be06c1c2af90296a6fb81a853a289e7e5
Python
8,612
231
import math import geomstats.backend as gs from geomstats.test.data import TestData from .complex_riemannian_metric import ComplexRiemannianMetricTestData LN_3 = math.log(3.0) EXP_4 = math.exp(4.0) class Siegel2TestData(TestData): def belongs_test_data(self): data = [ dict(point=gs.array([[...
83d009b8c0fcf8addb06d450eefbab683227d829769f75b2f1921174e004a6dc
Python
8,619
264
import os import numpy as np import pandas as pd #import logging import time from itertools import product import torch import torch_geometric.transforms as T from sklearn.metrics import roc_auc_score, average_precision_score from gridsearch_GeNNius import GridSearchModel, EarlyStopper, shuffle_label_data print('-')...
de7d0a7836aeee7a2755a8b5df3c4ae66b30eefcd54dad782ce537bb77223cc6
Python
8,620
253
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys import numpy as np from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator from openfl.experimental.workflow.runtime import LocalRuntime from openfl.experimental.workflow.placement import aggregator...
0cd168faed710b8f12c001b7a0b34658887775c7077728a247fe40652eae9877
Python
8,621
248
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory.abs from pathlib import Path from t...
656ebcae87018b1d1ae7ba6a59e702c617782c9b5bfb5b9c8055492af42f9ada
Python
8,621
245
# 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 # # Un...
18d746dd889541f8c461bce2625056c101c6938b890bf18ba1a1f5dc6838b6da
Python
8,625
220
import torch from torch_geometric.nn import MessagePassing from torch_geometric.nn import global_add_pool, GENConv, DeepGCNLayer import torch.nn.functional as F from torch.nn import ReLU from torch_geometric.nn.conv.gcn_conv import gcn_norm from ogb.graphproppred.mol_encoder import AtomEncoder, BondEncoder def make_m...
bf63adda95e5ab796707cb22bf3d35fb23bc18be7703663d4d937045dfb10b7d
Python
8,631
194
# TWO-NN: Intrinsic dimension estimator by a minimal neighborhood information. # # Author: Maria d'Errico <mariaderr@gmail.com> # # Licence: BSD 3 clause from __future__ import annotations import warnings import numpy as np import heapq from sklearn.base import BaseEstimator from sklearn.utils.validation import check_...
0e97d4ef3983d091ec2012a54dd6de9f4e215ac30d1302f6f2af8574089cce41
Python
8,637
167
# %% import os import numpy as np import time import h5py import sys from scipy import sparse from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w...
914a5e72c20d5d83bc7fcf9e4f51cea9169785d4b7d2682dd2d7df3f32b7aa42
Python
8,642
238
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
4b1e953fb234366037dc6971434614e2ec82148128b4c6a8fb10638814019a2b
Python
8,647
287
import os import click from corgie import scheduling from corgie import helpers, stack from corgie.log import logger as corgie_logger from corgie.boundingcube import get_bcube_from_coords from corgie.cli.compute_stats import ComputeStatsJob from corgie.argparsers import ( LAYER_HELP_STR, corgie_optgroup, c...
1921f74b601d24d4bf00955e9d847650f035e81531d4a372e935fc287e5ede1a
Python
8,648
270
import flammkuchen as fl import numpy as np from joblib import Parallel, delayed from split_dataset import EmptySplitDataset, Blocks from fimpy.alignment.volume import ( find_shifts_sobel, shift_stack, sobel_stack, ) from skimage.registration import phase_cross_correlation from fimpy.alignment.plane import...
8a43c377ea2cf17045719d1c07812f57b73610bc58226193f87378a78a4f37ad
Python
8,650
229
import numpy as np from sleeprnn.common import constants from sleeprnn.detection import metrics from sleeprnn.detection.feeder_dataset import FeederDataset from sleeprnn.helpers import misc def performance_vs_iou_with_seeds( dataset, predictions_dict, optimal_thr_list, iou_curve_axis, iou_hist_bi...
4eecbae38ab5e86c3d5dcc2e7364e2a3b772fb34232a8095c8113b02f47dbb13
Python
8,655
234
"""Similarity metrics and correlation.""" import itertools import numpy as np from scipy.spatial.distance import cdist from scipy.stats import rankdata from .regression import regress def fisher_r_to_z(r): """Convert correlation coefficients to Fisher z values. Args: r (float | np.ndarray): Correl...
a4387a9079f974f60ecd8df98a6eac32aec6ea01ba72f48c3039eacc2997701d
Python
8,658
234
"""Module to report usage analytics and check for updates.""" import json import logging import os import sys from contextlib import suppress from datetime import datetime from enum import Enum from functools import lru_cache from importlib import metadata from pathlib import Path from platform import platform, python...
2b1efe97cf022e82cd43ccd00c2347560cf23c65f86988627edee3d800cdb6bf
Python
8,664
238
#!/usr/bin/env python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import method.io as io import method.nn as nn import numpy as np import argparse import kerastuner as kt from tensorflow.keras.callbacks import EarlyStopping from sklearn.model_selection import train_test_split from sklearn.preprocessing import S...
9e88c42bab9ba8eb1954eed4a724e3410da09dde560d4ae8f2267c03b7b8b8a2
Python
8,664
219
"""Review artwork from existing TCREmp memberships and inferred junction boundaries. Run `python images/render_splash.py` with rsvg-convert installed. Reads the committed display selection; no scientific analysis is run. """ import csv import html import math import subprocess from pathlib import Path OUT = Path(__fi...
119dac9968d1237f31d56c8a3a9896fd07e0e76896e8b238ce41808a9e450306
Python
8,665
197
import torch from torch.utils.data import DataLoader,TensorDataset from modelClasses import * from utilityFunctions import * from sklearn.metrics import confusion_matrix, classification_report, precision_recall_fscore_support os.environ['CUDA_LAUNCH_BLOCKING'] = '1' models_sessions_list = ['LR_S1', 'LR_S2', 'RL_S1', ...
1ca0ef499eae2d313206d80557c55efb37840d0d592f87668718c5b155079f24
Python
8,665
256
import os from typing import cast, ClassVar from chromadb.telemetry.product import ProductTelemetryEvent class ClientStartEvent(ProductTelemetryEvent): def __init__(self) -> None: super().__init__() # Lazy import to avoid circular imports from chromadb import is_in_colab self.in_c...
9bab59ae235d5cdda5cb8563392cb1a0509d4ad1fa4d8961e37e4b9a4e920693
Python
8,673
161
# 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...
7036d6e68e9402fd478e968753e9e83bbe2eb92de089377df4fe31f0c09bd536
Python
8,675
271
"""Useful helper functions of all kinds""" import json import os import errno import pickle import warnings import numpy as np import matplotlib.transforms as transforms from tompy import CustomPDF from matplotlib.patches import Ellipse def pickle_read(path): with open(path, "rb") as file: out = pickle...
a94306be0a2ce2e48403c92fdbedae2d110ba29bf5a843b88de48bee70b96141
Python
8,677
217
# Copyright (c) 2023 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 ap...
ee24cbd820ba06c58cfb6e71ab26706371d14f7ca62d1b87e168f8217647a404
Python
8,679
197
"""The matplotlib panels: the computation they draw, and the null trap that broke it once. The by-year computation was verified against the R it replaces on the real corpus -- 408 (chain, metric, year) cells, zero differences. That check needs R and the full build, so it is not in the suite. What is here is the proper...
07224093aca3df244008c87b05c0f329070703c3d99b148c1dc82000103d1aae
Python
8,689
180
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import os import torch import torch.nn.functional as F import numpy as np from torch_geometric.loader import DataLoader from torch_geometric.datasets import TUDataset from sklearn.model_selection import KFold, train_test_split from dig.a...
999c0a99f60191bfaa923db4c9664e80e352d8c87b5e1d4788a5d75a16d9efb3
Python
8,690
245
from chromadb.api.types import Embeddings, Documents, EmbeddingFunction, Space from typing import List, Dict, Any, Optional import os import numpy as np from chromadb.utils.embedding_functions.schemas import validate_config_schema import warnings class HuggingFaceEmbeddingFunction(EmbeddingFunction[Documents]): "...
197845d4af79fdd3aac401efca88859c21a7aedcdabc448e916ac45a103bb380
Python
8,699
240
import os import unittest import tempfile import numpy as np import torch from transformers import BertConfig from foldingdiff import modelling ATOL, RTOL = 1e-6, 1e-3 class TestHuggingFaceBertModel(unittest.TestCase): """ Test the BERT model for diffusion built on HuggingFace library """ def setU...
eae60ed5a3fb1bbc621304cf7615dc199222329efec5ad499eabf058dcf778b8
Python
8,705
228
import matplotlib.pyplot as plt import numpy as np import csv def load2(filename): sim = [] col = [] num = [] mes = [] with open(filename, newline='') as csvfile: reader = csv.reader(csvfile, delimiter=',') for i, row in enumerate(reader): if i>0: sim.app...
f1b503f2c6ca99ed5d5021058b110ab2d58fcfd662dff61a3347c835202cef85
Python
8,707
236
# Copyright (c) 2023 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...
b7bb7067598dc2024c56912c7da67586953cec528228173092d37dc5087205e2
Python
8,708
296
"""Initial value problem solvers implementation.""" from abc import ABC, abstractmethod import scipy import geomstats.backend as gs import geomstats.integrator as gs_integrator from geomstats.errors import check_parameter_accepted_values from geomstats.numerics._common import result_to_backend_type def _merge_scip...
3041c51b1d6d14cfc69af89e941222dfea1fc515054a814fc363488965e4eae5
Python
8,710
321
# 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 bisect import time from collections import OrderedDict from typing import Dict, Optional try: import torch def type_as(a, b):...
e21487c1cca26a5d9db6fca7c6488ff63061646b5185bb4c4590b46799dfc79c
Python
8,712
280
# 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_V...
271e31703af6e34ce68b71ea44b86ad51ef0a095517b7da6c8853269495a499f
Python
8,713
218
#from __future__ import annotations """The Pepinvent enumeration module""" __all__ = ["AAEnumerator"] import csv import itertools import os from typing import List, Tuple, Union, Dict import logging import pandas as pd import torch from rdkit import Chem from reinvent.runmodes.enumeration.validation import AAEnumera...
36efd80b5b3267958ab9f17114cbe8f1dcecc26d731403ad8d5f0533857dad0d
Python
8,714
169
# %% import os import numpy as np import time import h5py import sys from scipy import sparse from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w...