sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8bb914dcd78ff4a18ea4d95cc119376b0978293ef5cbbb508f14a4f5bbacb47a | Python | 3,259 | 94 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import numpy as np
import random
import torch
from joblib import load
from collections import OrderedDict
import argparse
from setting import *
from utils import *
from loader import *
from evaluate ... |
8bc9e8cfedb058aaf0035c3ee7a6d921bae66a6e9087191bcc7a4690b9e5bb36 | Python | 3,259 | 85 | import os
import csv
from collections import defaultdict
from tqdm import tqdm
from rdkit import Chem, RDLogger
import torch
from torchdrug import data, utils
from torchdrug.data import feature
from torchdrug.core import Registry as R
@R.register("datasets.QM8")
@utils.copy_args(data.MoleculeDataset.load_csv, igno... |
1c7f5645c2289490a30282d84205fc9b2da9779185b5702b6fb67a960c294458 | Python | 3,260 | 99 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 10 00:01:11 2022
@author: felipe
"""
import numpy as np
import scipy.stats as stats
import scipy.signal as signal
import matplotlib.pyplot as plt
import matplotlib.axes as axes
#Polar axis plots
def polar_statistics(angles,axis=0,nan_policy='omit'... |
162ab7b9d000869efb5ad8447551489dce7f3838e36930b0b08f8b3d59e99428 | Python | 3,261 | 43 | #--------------------------------------------------------------------------------------------------------------------------------------------------------
# Author: Brandon S Coventry
# Date: 12/8/20
# Purpose: This is the main function for running reinformcement learning on in vivo stimulation preparations
# Revision H... |
23d75bc349683f9a62bf78932421befbce7ab7a545d54606949d362f907ce889 | Python | 3,261 | 89 | # Importing core packages
import numpy as np
import matplotlib.pyplot as plt
import os
global slm_pitch
slm_pitch = 36e-6
def CreateBlank(img_size):
# Input sizes
img_dim = [np.int(np.round(img_size[0]/slm_pitch)), np.int(np.round(img_size[1]/slm_pitch))]
# Creating the array
img_array =... |
55a1172d464d21ce25a2dce64bca5f689ff70c0e18a2cd77fd696a2a9ecde360 | Python | 3,261 | 89 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
5c8d30798a4bd44a96ba3e837537afa5b8df473cfb0d96b754b8d4c6e9c7f84c | Python | 3,261 | 107 | '''
Mar 2018 by Sebastiano Barbieri
s.barbieri@unsw.edu.au
https://www.github.com/sebbarb/deep-learning/ivim
'''
import torch
class network_training_hyper_parameters:
def __init__(self):
self.lr = 1e-4
self.lr_mult = 0.1
self.epochs = 2
self.optim = 'adam' # adam 0.0001; sgd 0.1
... |
17674538b9b2daeac647fff50814163d8e9626015214d9b0f4a60fdaddcb0f61 | Python | 3,262 | 69 | import pandas as pd
path = '/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/results/'
hypothesis = 'H2'
meas = 'parti-coeff'
main = pd.read_excel(f'{path}/{hypothesis}/24HMP-8Phys-Spike_HPF_seitzman-set1_finaltable.xlsx', sheet_name='reg-links')
other = pd.read_excel(f'{path}/{hypothesis}/... |
437a7b73a1de0bfa105ada45dbf0e9169c4729de9190fa31d91bc4b45df8b3f4 | Python | 3,262 | 82 | import lightning.pytorch as pl
from lightning.pytorch.loggers import WandbLogger
import argparse
import os
import torch
from datasets import GenomicDataSet
import numpy
import datasets
import lightning.pytorch as pl
from hicdiffusion_model import HiCDiffusion
from lightning.pytorch.callbacks import ModelSummary
import ... |
b6f0e94cfe270e98a392f7ea46eb592d1019beaa1a4200a2910add55426139ca | Python | 3,262 | 105 | # Node-group asset "Select Res ID String" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_C... |
ec1719c3be514f293e0ca0e5d95d7fab2f73165c07f8be4b39316df1f6e62719 | Python | 3,262 | 102 | # Node-group asset "Fallback Vector" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKI... |
44e55158ed2c9006a9761d6efd9c80190873f4220b151a70c6aa4a2c94d90019 | Python | 3,263 | 121 | import numpy as np
from sklearn.metrics import roc_auc_score, cohen_kappa_score
def get_cindex(gt, pred):
gt_mask = gt.reshape((1, -1)) > gt.reshape((-1, 1))
diff = pred.reshape((1, -1)) - pred.reshape((-1, 1))
h_one = (diff > 0)
h_half = (diff == 0)
CI = np.sum(gt_mask * h_one * 1.0 + gt_mask * h_... |
69c99621fd4d0dde3b262982b28b1786e6a5a70d0be09257d49506d137d04346 | Python | 3,263 | 83 | from __future__ import annotations
import argparse
import os
import tempfile
import time
from typing import NoReturn
from optuna.artifacts import FileSystemArtifactStore
from optuna.artifacts import upload_artifact
from optuna_dashboard import register_preference_feedback_component
from optuna_dashboard.preferential ... |
7d1963d2c8f9590cca482800e851af7de24e30c968f3c7691728245e9ed2656d | Python | 3,263 | 75 | """Run mesocircuit
------------------
Main example script to run a simulation of the mesocircuit with NEST and
subsequently analyze and plot the results.
The simulation of the spiking neuronal network can be followed by an LFP
simulation and the corresponding postprocessing and plotting.
"""
########################... |
84a9bb9567881cd859f8844e3bf15351df4f13b7c90d63f83350df4d1e3c7b9c | Python | 3,263 | 103 | import random
import unittest
import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from torcheeg.trainers import BetaVAETrainer, CBetaVAETrainer
class DummyDataset(Dataset):
def __init__(self, length: int = 101):
self.length = length... |
6bb503df4dc171c442ac48468df304969bf94456088a7680840baa62a854be6c | Python | 3,264 | 94 | from typing import Optional, Union
from .color import Color
from .console import Console, ConsoleOptions, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
from .segment import Segment
from .style import Style
# There are left-aligned characters for 1/8 to 7/8, but
# the right-aligned ch... |
b5c29e219aa668578f3c7c13e786de404ac7e252acd3f711f426d24ddb05c2ed | Python | 3,264 | 95 | from typing import List, Tuple
import hydra
import pyrootutils
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning import LightningDataModule, LightningModule, Trainer
from pytorch_lightning.loggers import Logger
pyrootutils.setup_root(__file__, indicator=".project-root", pythonpath=True)
# ------------... |
cd705607e9e091c2720f0834feb26a8d5cf99e577ef9c0907dbcd46d12616007 | Python | 3,264 | 104 | import os
import random
import shutil
import unittest
import numpy as np
import torch
from torcheeg.io import EEGSignalIO
class TestEEGSignalIO(unittest.TestCase):
def setUp(self):
shutil.rmtree('./tmp_out/')
os.mkdir('./tmp_out/')
def test_init(self):
io_io_path = f'./tmp_out/{"".j... |
e2738a85e6816d51105d3192a9a3864f2d53920ec9fec127a37bbc8f10be6dac | Python | 3,264 | 95 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import urllib.parse
from typing import Any, List, Optional, Set
from ._parser import parse_requirement
from ._tokenizer import ParserSynta... |
e92e518c341f2240e85b2fba5913f4d629214059a57a57c76c8837b1142a3814 | Python | 3,264 | 81 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
ef1f943282fb3f3b99ad5610added0331f4c8740eb2ace7ee4fdfd41a4f252a9 | Python | 3,264 | 74 | import json
import argparse
from sklearn.metrics import adjusted_rand_score
import os
import pandas as pd
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description='Likelikehood estimation of models')
parser.add_argument('--params', help="The input of model_outs and preprocessed_data and location of... |
539f8b3cc8bb9821a6dd866a9ed63339acf957df0016ed51734e75859d337cc5 | Python | 3,265 | 73 | """Define argument parser class."""
import argparse
from pathlib import Path
class ArgParser(object):
"""Argument parser for label.py"""
def __init__(self):
"""Initialize argument parser."""
parser = argparse.ArgumentParser()
# Input report parameters.
parser.add_argument('--r... |
bb5372653e488e87e636c7a1e6dd01fbf78ecf2a2f9c21e48a91d6d7d51c6185 | Python | 3,265 | 115 | # %%
import sys
import os
sys.path.append(os.path.abspath("../.."))
sys.path.append(os.path.abspath(".."))
sys.path.append(os.path.abspath("."))
# %%
import torch
import pandas as pd
import numpy as np
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from prosper_nn... |
1f8b981d80176a9cf7644dafd8939a1df066f5011476bba72b7856ad59a70a31 | Python | 3,266 | 76 | # Ultralytics YOLO 🚀, AGPL-3.0 license
import re
from pathlib import Path
import pkg_resources as pkg
from setuptools import find_packages, setup
# Settings
FILE = Path(__file__).resolve()
PARENT = FILE.parent # root directory
README = (PARENT / 'README.md').read_text(encoding='utf-8')
REQUIREMENTS = [f'{x.name}{x... |
85b98af0e0fa67b7d8ea1c229c7114703d5bcbb73390688d62eed28671449369 | Python | 3,266 | 108 | """
ELF file parser.
This provides a class ``ELFFile`` that parses an ELF executable in a similar
interface to ``ZipFile``. Only the read interface is implemented.
Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca
ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
""... |
19a57c79c2e4b73d635196c340f05b660fc2809c580d25ac645cf326e1ab6c34 | Python | 3,268 | 83 | import numpy as np
from tensorflow.keras.backend import int_shape
from tensorflow.keras.layers import Input, Cropping1D, add, Conv1D, GlobalAvgPool1D, Dense, Add, Concatenate, Lambda, Flatten
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.models import Model
from chrombpnet.training.utils.losses imp... |
43b0ad5b7ea9940313b4a18169c3153f3a16ebe515910da3409f059d56545b1a | Python | 3,268 | 83 | import numpy as np
from tensorflow.keras.backend import int_shape
from tensorflow.keras.layers import Input, Cropping1D, add, Conv1D, GlobalAvgPool1D, Dense, Add, Concatenate, Lambda, Flatten
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.models import Model
from chrombpnet.training.utils.losses imp... |
8518ed9d3a54d0ff42313b54763f921a0857335a08d7daaa3a622f06d85a610b | Python | 3,269 | 102 | # Node-group asset "Fallback Integer" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECK... |
190581c5b11b834048f85565525a8db58d148789fdbbbaf4a17a7406994f953f | Python | 3,270 | 89 | import yaml
import numpy as np
import torch
import torch.nn as nn
from BEBE.models.supervised_nn_utils import SupervisedBehaviorModel
from torch_intermediate_layer_getter import IntermediateLayerGetter as MidGetter
class harnet(SupervisedBehaviorModel):
def __init__(self, config):
super(harnet, self).__init__(co... |
7c271b90e82696de490e27f98b53de82601e41f2c5029a5dc53fcb7954ca5aa1 | Python | 3,271 | 92 | from setuptools import setup, find_packages
# http://www.diveintopython3.net/packaging.html
# https://pypi.python.org/pypi?:action=list_classifiers
with open('README.md') as file:
long_description = file.read()
install_requires = [
'scikit-learn==0.24.1',
'scipy==1.7.3',
'numpy>=1.21.1',... |
e3ab0424def5b2d59d5cd74f68850500c543c6bf48ad1daa98bf3a4eb569a9a5 | Python | 3,271 | 110 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
5bbc9452148f30befb9892d84ae1bfc1e435064dd1dc203435e9a8150e4f1e34 | Python | 3,272 | 238 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
7dd4374697475faf3cf4c2b19b6e1a31e7e5e58a02aa9a5560e335697cae87a4 | Python | 3,272 | 111 | # Node group "Smooth by Angle" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenera... |
07ecb5f59612f4a2cfa5af6b08effd2614330ca3ac3b31828a6baf7617aac031 | Python | 3,273 | 85 | import torch
import os
from PIL import Image
import datasets.diagram_aug as T_diagram
import datasets.text_aug as T_text
from datasets.operators import normalize_exp
from datasets.utils import get_combined_text, get_var_arg, get_text_index
from datasets.preprossing import SN
class MyDataset(torch.utils.data.Dataset):
... |
d074a1d518d4aa7891143fa1ca2407eba75cf4d7bf27f7bacfbf9af6e2780ce3 | Python | 3,275 | 92 | """Tests for the --affine_init opt-in (explicit ANTs affine_initializer pre-stage)."""
import os
import sys
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
import inspect
import pytest
from regtools.registr... |
00d1a6259c138d478af8ab2b22dc0c6a060b32a20e412841feafb92425b762d9 | Python | 3,276 | 97 | """
Optuna example that visualizes the optimization result of multi-layer perceptrons.
In this example, we optimize the validation accuracy of object recognition using
scikit-learn and Fashion-MNIST. We optimize a neural network. As it is too time
consuming to use the whole Fashion-MNIST dataset, we here use a small s... |
10c06ad4cedd692c02d7426f1c80f60c7474b3db9a7c45789c4a77725cf65d37 | Python | 3,276 | 101 | # Node-group asset "Fallback Color" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKIN... |
51e31f82477e2644ec1a6170ce6354c0c29f95d48e3bae2d4ec4ebfda978c2e6 | Python | 3,277 | 79 | """
Test model's performance on sample sizes different from what it was trained on
Increasing sample size makes model slower by factor of how much larger sample size is
"""
from src.utils import random_seed
from src.data import RecordingCrossVal
from src.model import ModelSpikeSorter
from src.plot import set_dpi
impo... |
82922cdcece01824e78ec1fcb37f17f5ce7006e5f795ad2d83fbd0fb40426493 | Python | 3,277 | 81 | """Shared random-weight tiny-transformer fixtures: software tests, not scientific evidence."""
from types import SimpleNamespace
import pytest
import torch
from transformers import Qwen3Config, Qwen3ForCausalLM
from liquidaion_fly.observatory_engine import ObservatoryConfig, ObservatoryEngine
QWEN_REVISION = "c1899d... |
6f7cd3caf9d6a369ace092acb01e4e5eea2a8354808e74302706ca5fa054c182 | Python | 3,279 | 81 | from __future__ import annotations
from typing import TYPE_CHECKING, Literal
from sklearn.metrics import (
adjusted_rand_score,
normalized_mutual_info_score,
silhouette_score,
)
if TYPE_CHECKING:
import numpy as np
from numpy._typing import ArrayLike
def nmi(
true_labels: np.ndarray,
pr... |
740c1ce7fc21c572e2dbba2d848632beeee4b0b820f039c218a30cdc1aaa6940 | Python | 3,279 | 99 | #Imports
import sys
import torch
import numpy as np
from src.script_util import create_model, create_gaussian_diffusion
from src.train_util import TrainLoop
from torch.utils.data import DataLoader, TensorDataset
from src.dist_util import setup_dist, dev
from src.logger import configure, log
from basicutility import Rea... |
83a46587a6a82963316f59be1af2f3512e5b1300e396da6b7cf488122f6e3aa4 | Python | 3,279 | 101 | import click
import pandas as pd
from lib.sequence import SeqFastaLoader1D, SeqRegressionDataLoader1D
import tensorflow as tf
# options
@click.command()
@click.option('--test-fasta-file',
'test_fasta_file',
required=False,
type=click.Path(exists=True, readable=True),
... |
966e4b45fd6824ae0fbfbaeee8d6e278200eecb4114808e70a57c94c769b5d62 | Python | 3,280 | 80 | import time
from itertools import takewhile
from .meta import direct_path
from .smoothing import smooth_path, smooth_path_old
from .rrt import TreeNode, configs
from .utils import irange, argmin, RRT_ITERATIONS, RRT_RESTARTS, RRT_SMOOTHING, INF, elapsed_time, \
negate
def asymmetric_extend(q1, q2, extend_fn, ba... |
28a994e378c8a0510c01965f781e2c2518feb14d9cf534a3dff86f2465092892 | Python | 3,281 | 109 | """Models a BIDS file."""
import os
from hed.tools.bids import bids_util
class BidsFile:
"""A BIDS file with entity dictionary.
Attributes:
file_path (str): Real path of the file.
suffix (str): Suffix part of the filename.
ext (str): Exte... |
22c205eb994929af83f95aba4646cec51d2bc1cba2b1e4aab7ba4f31dddf93ef | Python | 3,282 | 106 | # 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, software
# distributed under th... |
2e905e5e652130bf289b699a50ee32a074f4671ead5fc266e700f8cf4325f0d0 | Python | 3,282 | 103 | import ctypes
import functools
import os
import warnings
from ctypes.util import find_library
from inspect import Parameter, Signature, signature
from typing import TYPE_CHECKING, Any, Callable, Optional, Tuple, Type
import numpy as np
from typing_extensions import Annotated, get_args, get_origin
if TYPE_CHECKING:
... |
d1d6cd60044e5b37fcdb259fdfb353ed27540ea59d8d4a5208fa4a73f4709a17 | Python | 3,282 | 140 | """ USe a mahcine learning model to predict brain layers """
import os
import pickle
import pathlib
import click
from layer_recognition.ml.train_and_predict import predict
from layer_recognition.ml.utils import get_classes_and_features
@click.command()
@click.option(
"--model-file",
type=pathlib.Path,
... |
dac0c4b4c4d6256e618844ff57641e533dc4c8383c69585c950b52c29cbea030 | Python | 3,282 | 76 | import torch
import warnings
import numpy as np
import scanpy as sc
import pandas as pd
import anndata as ad
from sklearn import metrics
from sklearn.model_selection import KFold
from scipy.spatial.distance import cosine
from model import *
warnings.filterwarnings('ignore')
seed=42
set_seed(seed)
### L... |
0e119e0f616da236ce65b0afac7c91c298b42085ae1d4634861df97f2e8e5cd6 | Python | 3,283 | 87 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
f7f8f177c0debc4d14d6a0ddf61f822fb3c92e8912179b96ca6cb237fa7c7425 | Python | 3,283 | 100 | import io
import itertools
from typing import Dict, List, Union
import matplotlib
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import PIL
import torch_geometric
from matplotlib import colors
from pylab import cm
from torch_geometric.data import Data
def plot2image(ploter):
buf = io.By... |
63a2b6a289d280df91ebef1cea1b131c91d8c08354cad88fbdab43bdf26c9060 | Python | 3,284 | 106 | # Node-group asset "Boolean First" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING... |
0ee16f995a2808ab38e60cef9215398269087d2ed9131d947765160d8812eaf8 | Python | 3,285 | 96 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
a6b3ed440ed8c1f57676879cc01e5d53804d7d04bbfbac799a3316263a24e717 | Python | 3,285 | 120 | """
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2019 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
------------------------------------... |
0b53e979bcb1150dd36b45ccaae89b9f47ebcea3c69494a048cebc4ba37aac32 | Python | 3,287 | 87 | """Transient toast notifications for the CCF Boundary Editor.
A bottom-of-canvas QLabel that appears for a few seconds when a
user-visible event happens (autosave outcome, batch delete commit,
drop-unused-labels result, export complete, undo/redo). Color-coded
by level. The existing autosave label is small and ea... |
6e4d51364c649c33d2af9cda2662b11eb684c0fed04a48b92dc0bcf3484415e6 | Python | 3,287 | 90 | import subprocess
from sleeplab_format import reader, writer
from pathlib import Path
from sleeplab_format.models import Dataset
def _assert_dirs_equal(dir1, dir2):
p = subprocess.run(['diff', '-r', dir1, dir2])
assert p.returncode == 0
def _assert_datasets_equal(ds1, ds2):
"""Compare the equality of ... |
849cefb49c80bc435cfd57f07e19ce655d7ce75f955bc2421a1f91f7a344e0f7 | Python | 3,287 | 95 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import urllib.parse
from typing import Any, List, Optional, Set
from ._parser import parse_requirement as _parse_requirement
from ._tokeni... |
1f86ff00170168921308ebd80ab0c17f97e1550e20ea715ee9da9207372106c6 | Python | 3,288 | 100 | import numpy as np
from common import *
from gzip import GzipFile as gz
from sklearn.neighbors import NearestNeighbors
def sort_min_diff(amat):
'''this function takes in a SNP matrix with indv on rows and returns the same matrix with indvs sorted by genetic similarity.
this problem is NP-hard, so here we use ... |
7f3be826113811a479b1a434bfe6bc047ae34671d447b243e4d730ac4e11b638 | Python | 3,288 | 89 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 31 14:10:27 2023
@author: felipe
"""
import numpy as np
import matplotlib.pyplot as plt
file=np.load('sd_T_matrix.npz')
var_tensor=file['var_tensor']
var_vector=file['var_vector']
sq_var_tensor=file['sq_var_tensor']
sq_var_vector=file['sq_var_vec... |
e8a122544b704244c1fe6f6231f54477f67ff206c399545853780de03efcdaa4 | Python | 3,289 | 98 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
3abdaab4969170b4bda71e3b1513b811ffb27cf1793042b435126d016d029a91 | Python | 3,291 | 116 | """
.. _calibration_example:
Calibrate gaze mapping
======================
This examples shows how to calibrate the gaze mapper with a connected Pupil
Core headset.
.. note::
This example requires the dependencies for
:ref:`streaming<streaming_dependencies>` and
:ref:`pupil detection<pupil_detection_de... |
bedfded28c7a52c0b903919e90155ea8ec7a4bf137879d3dbf1373b8e5f91e44 | Python | 3,291 | 111 | import os, sys
import numpy as np
import nibabel as nib
import pingouin as pg
import pycircstat as circ
import hcp_utils as hcp
import networkx as nx
from neuromaps import datasets
fslr = datasets.fetch_atlas(atlas='fslr', density='32k')
slh, srh = fslr['midthickness']
lh_vert, lh_face = nib.load(slh).agg_data()
r... |
07609e37f2f426a08b9892b0db78387b04f0c950437049cee79a867e9544e172 | Python | 3,292 | 89 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : sdmatrix.py
# Author : Yufeng Liu
# Date : 2023-01-30
# Description :
#
#======================... |
0f533ada2d275eb62dbc09212f5cdeaac33cb5fdc9d0137b2a1fbd94be8b8402 | Python | 3,292 | 148 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
caabc223dc6163ebf3e1ee530910fbf3c6767657548eec30d45bc83c265c47ce | Python | 3,292 | 82 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
benchmarks_dir=os.path.expanduser('~/projects/downward/benchmarks')
... |
d2179e9778a423ecf95ffeeef8a58eb13bbd8cfd83d8928f0fd4b69ff995613e | Python | 3,292 | 82 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
benchmarks_dir=os.path.expanduser('~/projects/downward/benchmarks')
... |
1c8647e9f1cd950a848534095a4ac05b503de6fb745d6d8ef9196b39911220ad | Python | 3,293 | 71 | #*******************************************************************
# Python Script for Splitting Image Data into Train and Test Sets
# Date: December-2023
#*******************************************************************
# This script is designed to randomly select and copy pairs of images
# and their correspondi... |
3e75ae87ecc4582deddc96966ebe3d8f8018e19a307c9c744c314077d0fa8b6b | Python | 3,294 | 106 | import os
from torch.utils import data as torch_data
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.WN18")
class WN18(data.KnowledgeGraphDataset):
"""
WordNet knowledge base.
Statistics:
- #Entity: 40,943
- #Relation: 18
- #Tripl... |
a3bd0a2ffe88e45706bec294f133c121321991d4da58e47fc4fd4eb9b9f703ae | Python | 3,294 | 100 | """Plotting utilities."""
import numpy as np
from treem.io import SWC
# pylint: disable=invalid-name
def plot_tree(ax, tree, data, **kwargs):
"""Plots entire branch.
Args:
ax: matplotlib axes object.
tree (treem.Node): branch start node.
data (NumPy ndarray): raw data of morphology... |
bf02b033812ee0d5794dd594d8ac5b3f7187079a9c0231854b925877df4158b5 | Python | 3,294 | 98 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
2e4aa521fa32504249ba340704de4c6c00f728ba4262071034c3ccc5ffb62536 | Python | 3,295 | 52 | import sys
module = sys.modules[__name__]
# orderd by perodic table
ATOM_NAME = ["Null",
"Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine",
"Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon",
"Potassium", "Calc... |
535ec1324f69d972ad09dfe981742dd6958f6a8b50e8a7cb0f5c6ee2afb03c2c | Python | 3,295 | 104 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use('seaborn')
# %matplotlib inline
import networkx as nx
import sys
import os
# import modules within repository
my_path = r'C:\Users\Cole S Baker\Desktop\Thesis\Thesis\hgcn\hyperbolic-learning-master\utils' # path ... |
39f8b9c1019ea4922237190d1cddcd053d6fedd5a6fc9f9ca79508a95c5fc058 | Python | 3,297 | 92 | # regtools/registration/gui/job_bat.py
"""Single source of truth for the per-job Windows ``.bat`` launcher.
Both the single-image registration tab (``registration_tab.py``) and the
batch-2D tab (``batch_2d_run.py`` / ``batch_2d_tab.py``) write a tiny ``.bat``
that:
* runs the registration ``python_cmd`` in a f... |
7153f5fae7b727d8f5b9eaff0bc17ed9fe81c944c67ba73276165fd98f12be52 | Python | 3,297 | 116 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
a4a8f4b307918e53ad7b1bbada63c9a99648c894baf4e118b50457bfcce5c08d | Python | 3,297 | 69 | from encoding import lin_or_encoding
import matplotlib.pyplot as plt
from tqdm import tqdm
import numpy as np
import seaborn as sns
import torch
import pdb
def preprocess_features(df,
reads:str = None,
target:str = None,
offtarget_sequence:str = None,
... |
dbab4da66b4cd537ff8edb8e9e45a7d3bac223a4c2fe85ba5bcd8ed2e7af5cab | Python | 3,297 | 36 | import os
import pandas as pd
import numpy as np
import unittest
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
from hornet.uml import cluster_filter
class TestClusterFilter(unittest.TestCase):
def setUp(self):
# Create a sample DataFrame for testing
self.df... |
b6158649b9745eb0957e6649960206f6d236e892f227fe3cb90b13e0243c597d | Python | 3,298 | 107 | # Node-group asset "Offset Color" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
... |
e3ec4bf16d31d702e1485e05a0f8f25b92f7ed7d00a316d4bc8cf0c0f9798ce6 | Python | 3,298 | 70 | """
BUILD_RELEASE_TABLE.py - assemble the public release table.
The confidence column that four whole-brain models dropped, restored, for all
126,419 FlyWire neurons that carry at least 100 classified synapses.
Inputs 06-OUTPUT/pass_e_fullscale_determined.parquet (V-19, the measurement)
06-OUTPUT/flip_... |
1f22e8f04b5fb10999bc2aa8ff284d36eb60ade41d1455d513b18918f033edfb | Python | 3,299 | 92 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
9058af2077481a842faa9151bfdf82972e48735805677c5cb67f4f8dc85afab9 | Python | 3,299 | 95 | import torch
from timm.scheduler.cosine_lr import CosineLRScheduler
from timm.scheduler.step_lr import StepLRScheduler
from timm.scheduler.scheduler import Scheduler
def build_scheduler(config, optimizer, n_iter_per_epoch):
num_steps = int(config.TRAIN.EPOCHS * n_iter_per_epoch)
warmup_steps = int(config.TRAI... |
dcc40bf1d6a28881e9aa1eb612a7898aec3871a4de4119af023dd75e62088fc0 | Python | 3,299 | 90 | """Tests for the startup self-check (issue #127). Pure, no Qt."""
from regtools.self_check import (
check_core_dependencies,
check_import_path,
log_self_check,
run_self_check,
)
# --- check_import_path --------------------------------------------------------
def test_no_shadow_when_sin... |
aad80b8fb0a74ae1658a8440c7430c13c1730bd9759d90136b0b1257ea582cad | Python | 3,301 | 114 | # Node-group asset "Backbone NH" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING, ... |
12cf3bbb0d374874b9f86eac5c76578e10b0dc9e28f4340e2028a2e8b6880fac | Python | 3,303 | 80 | import seaborn as sns
import pandas as pd
import seaborn.objects as so
import matplotlib.pyplot as plt
sns.set(font="Arial")
sns.set(rc={'figure.figsize': (6, 10)})
sns.set_style("white")
# df = pd.read_csv(r"C:\Users\Toan Phung\Downloads\ForCURTAIN_tTest_PBMC_Single_Six.txt", sep="\t")
df = pd.read_csv(r"C:\... |
474dc33eee523cffdaf16715597391e0ba2c658b6c9b988adf10e32face5c5e2 | Python | 3,303 | 87 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Various positional encodings for the trans_utils.
"""
import math
import torch
from torch import nn
class PositionEmbeddingSine(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one
used... |
95e3a6aec3ac61daeabc94074ca61821f49d7fb9972d2b600cbb5e17a5b4b669 | Python | 3,303 | 85 | import torch.utils.data
from torch.utils.data.dataloader import default_collate
from batch import BatchFinetune, BatchMasking, BatchAE, BatchSubstructContext
class DataLoaderFinetune(torch.utils.data.DataLoader):
r"""Data loader which merges data objects from a
:class:`torch_geometric.data.dataset` to a mini-... |
bfae47438f97171c55eedff9f61d4419a570e8e42e59f7f2e1ffab324efaca92 | Python | 3,303 | 90 | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides a dummy agent to control the ego vehicle
"""
from __future__ import print_function
import carla
from leaderboard.autoagents.autonomous_agent import Aut... |
30a1cb2d2049e022921cb44e9bbe0730d937729f54a540d233be176c614e446b | Python | 3,304 | 77 | #!/usr/bin/env python
from __future__ import print_function
import argparse
from examples.continuous_tamp.primitives import get_pose_gen, distance_fn, inverse_kin, \
get_region_test, plan_motion, MOVE_COST, test_reachable, GRASP
from examples.continuous_tamp.run import display_plan, initialize, create_problem, d... |
5e476070a5704b141af3cd0a4a3c472adc24e8c31a0968deab08364be74b1149 | Python | 3,304 | 81 | import nibabel as nib
import glob
import argparse
import matplotlib.cm as cm
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
# Argument parsing
parser = argparse.ArgumentParser(description='Plot lesion frequency maps.')
parser.add_argument('--t... |
b6ee238ec73464cb0a7a24d6ce29371333ff806ddf7343978d61c8c34380be41 | Python | 3,304 | 134 | import torch
import numpy as np
import matplotlib.pyplot as plt
from hippo import get_store_path, get_data_path
from hippo import save_config
from hippo import load_config, get_recents_path
from hippo.data import load_data
from hippo.visualization import format_ax
from hippo.models.cscg import CHMM
import pickle
impo... |
7592bf42503c6563a409c297facbed6cd8fe653f1228c2edba76c98296745aa9 | Python | 3,305 | 102 | # Experiment tracking using W&B
from wandb.keras import WandbCallback
import wandb
import tensorflow as tf
architecture_type = ["cnn", "cnn-bilstm", "bilstm-cnn", "cnn-bilstm-attention"]
#wandb.init(project=architecture_type, entity="onuralp", name="model-name")
sweep_config = {
'method': 'random'
}
metric = {'n... |
850cb48a009d640cba5b1591714e4a32b754ca27a4daea9745bfbb09cfeb2d4f | Python | 3,305 | 90 | # pylint: disable=invalid-name, missing-function-docstring, missing-class-docstring, unused-argument, too-few-public-methods, no-member, too-many-arguments, line-too-long, too-many-instance-attributes
""" BrainNetCNN model module from https://github.com/Wayfear/BrainNetworkTransformer"""
from torch.nn import functiona... |
2067d6510b77047b9d79fd72da4c9433f7c706abf58988e2fc2bf202be625193 | Python | 3,306 | 100 | from lxml import etree as ET
top = ET.Element('modes')
mode_1 = ET.SubElement(top,'mode')
# ID = ET.SubElement(mode_1,'ID')
# ID.text = '123'
mode_1.set('ID','1')
mode_1.set('Name','BF LED matrix full')
mode_1.set('ExposureTime','100')
mode_1.set('AnalogGain','10')
mode_1.set('IlluminationSource','0')
mode_1.set('Illu... |
3c46747380c0658e98385155af03507521acfb7f0ca115b3289522270df6899d | Python | 3,307 | 139 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from .config import MetadataConfig
from .files import (
NomenclatureScan,
print_nomenclature_summary,
scan_nomenclature,
)
from ..technical_record.configuration import save_configuration_csv
from ..technical_r... |
4d00012ff45f0a958ed206d7bc792909f60957f18f8ddc47b27a5c593ad62e30 | Python | 3,307 | 92 | import cv2
import numpy as np
import os
import pandas as pd
import torch
import warnings
from constants import *
from src.utils import class_to_score, map_to_score_grid
from src.inference.preprocess import preprocess_image_v0
from src.models import get_classifier, get_regressor
class PredictorBase:
def __init__... |
31be430db88712edda0828258a64484b5f44576de1da9ae9ef1c4ed4527b66cd | Python | 3,308 | 82 | import torch
from torch import nn
from torch_scatter import scatter_add
from torchdrug import core, layers, data
from torchdrug.core import Registry as R
@R.register("models.Statistic")
class Statistic(nn.Module, core.Configurable):
"""
The statistic feature engineering for protein sequence proposed in
... |
dd691cd2d046cbdcd5479ee6dc93573205fad53d512e92bc1068454c62aef081 | Python | 3,309 | 78 | import os.path
import pandas as pd
import zipfile
from collections import defaultdict
from ckg.graphdb_builder import mapping as mp, builder_utils
##########################################
# Human Protein Atlas (pathology) #
##########################################
def parser(databases_directory, download=Tr... |
0b3e2ed66046dea789851c73d3ddb068ee78690e1c487486ede2b2541c3f2463 | Python | 3,310 | 115 | import sys
import torch
from tqdm import tqdm as tqdm
from .meter import AverageValueMeter
class Epoch:
def __init__(self, model, loss, metrics, stage_name, device="cpu", verbose=True):
self.model = model
self.loss = loss
self.metrics = metrics
self.stage_name = stage_name
... |
49bc43eb2011b346c6089643238d6447782280100371ce4d5543b0984846f7ad | Python | 3,310 | 91 | from typing import Dict, List, Union
import numpy as np
from ..base_transform import EEGTransform
class RearrangeElectrode(EEGTransform):
r'''
Select parts of electrode signals based on a given electrode index list.
.. code-block:: python
from torcheeg import transforms
t = transforms... |
54178c7488e6085e9bc0feeac45fb3e8685dcc17958495053f16eb8d70d3f1a1 | Python | 3,310 | 107 | import argparse
from pathlib import Path
from enum import Enum
class Shape(str, Enum):
circle = "circle"
star = "star"
rect = "rect"
def shape2symfraction(shape: Shape):
if Shape[shape].value == "circle":
return 0
elif Shape[shape].value == "star":
return 1 / 10
elif Shape[sh... |
a4befaae903ad1642fb16f2628707f11b35edf52ed114e7e07ab37425b7f0c6c | Python | 3,310 | 94 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
40b104c733eb466e340d8fb7d83f5ab82abbbb33329e94fd2b80634ce3e9b80e | Python | 3,311 | 101 | from AnDePeD.ReRe import ReRe
import time as timelib
import gc
def run_rere(test_instance, progress_for_executions, executions_max, debug, export_filename): # , testrun_file):
# create new instance of ReRe
rere = ReRe.ReRe()
# rere.TESTRUN_FILE = testrun_file
rere.read_testrun_data()
rere.init_tim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.