sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
97bc0b569850a5f53fb900e7ee38f8028490d27d36481802a950b3d77d38e2e0 | Python | 7,824 | 190 | import torch
from .decode_strategy import DecodeStrategy
class BeamSearch(DecodeStrategy):
"""Generation with beam search.
"""
def __init__(self, pad, bos, eos, batch_size, beam_size, n_best, min_length,
return_attention, max_length):
super(BeamSearch, self).__init__(
... |
0c8cee3db40f2c3389f5724023fe94692f7ca9374c3c4ba57dbc4078fc205f05 | Python | 7,827 | 236 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.MPQ.addition import Addition
from elasticai.creator.nn.integer.MPQ.batchnorm1d import BatchNorm1d
from elasticai.creator.nn.integer.MPQ.encoderlayer.design import (
... |
dca7fe5b37fa28d657fb83f5b0c21367e28b14434620ed8917b21d4e3e2b495f | Python | 7,828 | 299 | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_backends
class AlbertTokenizerFast:
def __init__(self, *args, **kwargs):
requires_backends(self, ["tokenizers"])
@classmethod
def from_pretrained(self, *args, **kwargs):
requires_... |
1ddf1d474a59f7d8d29e6dfc812f5842539c69f5a663488a94ef2d41de9773bc | Python | 7,829 | 119 | """MB_CRASH.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02i-MB-CRASH.md
The census on the olfactory-system cut-out (antennal lobe + Kenyon cells, APL/DPM, MBONs, DANs, lateral-horn local and
centrifugal neurons; 9,595 neurons): does it put APL first for Kenyon-cell density, and keep the two v2LN30 first fo... |
43e0dcf060bfafdccc701c493f665cb605d1b58b1ba10999f40bb6175fc2a61f | Python | 7,831 | 233 | """"""
from queue import Queue
from uuid import uuid4
from pathlib import Path
import logging
from pupil_recording_interface.decorators import process
from pupil_recording_interface.process import BaseProcess
from pupil_recording_interface.utils import monotonic
from pupil_recording_interface.externals import GPoolDum... |
fcacd0df24b33e1e6eab758841404eeb0efe8fd0f6d48c97e07e16f1673552c7 | Python | 7,831 | 221 | from scipy import ndimage
from scipy.ndimage.interpolation import zoom
from torch.utils.data import Dataset
import imgaug as ia
import imgaug.augmenters as iaa # 导入iaa
from torchvision import transforms
import os
import random
import h5py
import numpy as np
import torch
import albumentations as A
import os
import glo... |
d6602cfb9629ca5ee7d76d0146eef9dc32e0a7d940e3d2f554d01aa9135c2687 | Python | 7,834 | 182 | import os
import sys
import time
model_name = sys.argv[1]
datadir = sys.argv[2] # should point to the directory where the fast5 & reds dir exist
print("Model Name: " + model_name)
# Python Script Paths
exedir = "../run_scripts/" # the path to HierarchyCall's test/run_scripts dir
bonito_script_path = exedir + "ru... |
f64e59142fb899a4e3c82d64f3a57b2deef76fa8ebff19020184728b9301a3ba | Python | 7,834 | 200 | import numpy as np
from scipy import stats
import pandas as pd
from statsmodels.stats.multitest import fdrcorrection
import copy
def f_PermTest(pv_Dist1, pv_Dist2, ps_Alpha=0.05, ps_PermNum=1600):
'''
function f_PermTest2.m
Description:
Inputs:
pv_Dist1: First distribution
pv_... |
2c0d8010692dc6502d81e977086283d74c6f3041e0f562a0a3cd98a1b5b5ff72 | Python | 7,836 | 139 | # 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... |
7ef2ece5d5f2fefac35b884ec3646c988dabbbb57a57e5658bd7d6cbf8816bd8 | Python | 7,837 | 206 | """
Measures the speed-up for computing univarite 2nd oder models and simulate CSRV instances
"""
################# Package import
import os
import sys
import math
import time
import numpy as np
import multiprocessing as mp
from scipy.optimize import curve_fit
from pyorg.surf.model import ModelCSRV, gen_tlist
fr... |
9c8045acad4b9231db0cec00e53abcc6ab9604076854704468444207850837ed | Python | 7,837 | 229 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Xingyi Zhou
# ------------------------------------------------------------------------------
from __future__ import a... |
c9f4df957019070e3c53764a7fa9e1f43c6c4705647afa51e029627c07324c8c | Python | 7,837 | 198 | import time
from pddlstream.language.conversion import substitute_expression, list_from_conjunction, str_from_head
from pddlstream.language.constants import Not, Equal, get_prefix, get_args, is_head, FunctionAction
from pddlstream.language.external import ExternalInfo, Result, Instance, External, DEBUG, get_procedure_... |
0a13e477a7955b7f2fca4e6717bbb187f902071b1a4ff8017f4b758f11e21286 | Python | 7,838 | 280 | auto_scale_lr = dict(base_batch_size=512)
backend_args = dict(backend='local')
codec = dict(
heatmap_size=(
48,
64,
),
input_size=(
192,
256,
),
sigma=2,
type='MSRAHeatmap')
custom_hooks = [
dict(type='SyncBuffersHook'),
]
data_mode = 'topdown'
data_root = 'da... |
8a394b1561780ad7d88a3d13ab55b605f45ded05e573c5f88bed25c661f822ae | Python | 7,839 | 208 | from spikeinterface.extractors import MaxwellRecordingExtractor, NwbRecordingExtractor
from spikeinterface.toolkit.preprocessing import scale, bandpass_filter
import numpy as np
import matplotlib.pyplot as plt
from src.plot import set_ticks
class Recording:
def __init__(self, path, freq_min=300, freq_max=6000, r... |
4fbd423ec14bd36893e3656447e9c801dfc42e2b816dc7ae71a3a854fc16b06b | Python | 7,843 | 236 | #
# Result handling utilities for ACME
#
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd party package imports
import os
import pickle
import logging
import h5py
import numbers
import weakref
import dask.distributed as dd
from abc ... |
d0df0cf656534213b00e4b8c412546b57172a2f7f0444ca7cf231d4da5c69dcf | Python | 7,845 | 175 | import os
import sys
from pddlstream.algorithms.algorithm import get_predicates
from pddlstream.algorithms.downward import get_literals, get_conjunctive_parts, fd_from_fact, EQ, make_object, \
pddl_from_instance, DEFAULT_MAX_TIME
from pddlstream.language.object import Object
from pddlstream.language.conversion imp... |
8546a933accd85245c5d06836f05fba0bb6f84e76f5ac8f718492958d4aa970a | Python | 7,846 | 161 | import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import re
from scipy import stats
def one_sample_ttest(sample_data, null_hypothesis_mean=0.0, significance_level=0.01):
# Calculate the T-test for the mean of ONE group of scores
t_statistic, p_value = stats.ttest_1samp(sample_dat... |
0cbaa537619985e836a394ca761a4ebf9d9211edd7578a8bb1d2a50e413aef31 | Python | 7,847 | 148 | import numpy as np
import pandas as pd
from sklearn import preprocessing
class NCmaPss:
def __init__(self, file_name: str, rul_early: int, sequence_length: int, test_sequence: int, graph_signals: bool):
self.graph_signals = graph_signals
self.train_df = pd.read_csv("file address" + file_na... |
f3b2f8f070cf7d1331fe733e9024eb1473ea24deabc480d5c4a78dd76ec18e30 | Python | 7,849 | 225 | """Test configuration file."""
import tempfile
from collections.abc import Callable, Generator
from pathlib import Path
import numpy as np
import pypulseq as pp
import pytest
from console.interfaces.acquisition_parameter import AcquisitionParameter, Dimensions
from console.interfaces.rx_data import RxData
from conso... |
3cbdff128a911089b61106409a8ad9363a44724b526628c522c8faf7ce06849f | Python | 7,850 | 201 | import unittest
import torch
from torcheeg.models import (CCNN, FBCCNN, LMDA, MTCNN, CSPNet, DeepSleepNet,
EEGNet, FBCNet, FBMSNet, SSTEmotionNet, STNet,
TinySleepNet, TSCeption, TSLANet, USleep)
class TestCNN(unittest.TestCase):
def test_cspnet(self):
... |
ed9946163c8f3ff834892578c7c5cfeab2dd2c290c3284fdd2e96148dc8b04b1 | Python | 7,853 | 162 | """
Model class: Convolutional neural network description
Functions:
1. __init__() : Contains image arrays and ground truth labels for training(X_train, y_train) and validation data(X_val, y_val) and "model name" to save the model
2. model_init(): Defines the model architecture
3. train_predict(): Trains mo... |
fb94d2c9c03470ea26ae57d8250bacfd695c945e2f20c3f4d13f4a2ce09fc8be | Python | 7,854 | 202 | # -*- coding: utf-8 -*-
import os
from typing import Iterable, Union
import torch
from supar.config import Config
from supar.models.dep.biaffine.transform import CoNLL
from supar.models.sdp.biaffine import BiaffineSemanticDependencyModel
from supar.parser import Parser
from supar.utils import Dataset, Embedding
from ... |
23576cf0e6d1886b4ba0852913be8e10ab0937827ad95724640216b9c4873bac | Python | 7,855 | 208 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 6 15:29:31 2021
@author: caroline
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 5 14:15:02 2020
@author: carolinebevalot
"""
import numpy as np
import pickle
import os.path as op
import os
import matplotlib.pyplot as ... |
afa425615425f584b6ca90c19a0f2631ff0f06da78bf234ee8eb3e2baf8296e4 | Python | 7,857 | 217 | from collections.abc import Callable, Iterable, Iterator, Mapping
from typing import Protocol, cast
import elasticai.creator.function_dispatch as FD
from elasticai.creator import ir
from elasticai.creator.graph import bfs_iter_down
type DataGraph = ir.DataGraph[ir.Node, ir.Edge]
type Registry = ir.Registry[DataGraph]... |
6c3e580add26bb6523e09ea226c1e96dd9c7cde6883f3f9ab8376272079be6f1 | Python | 7,858 | 147 | import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import os
import pandas as pd
import scipy.io
import numpy as np
from Functions.f_ECGAnalysis import *
import scipy as sci
Data_dir = './../Data/MatData/' # Filtered and removed artifact data
Out_dir = './../Data/ECGFeatures/' # O... |
5c49254cbc024569a61580a45fced62fe1fd351a92963402c112adc911312d2e | Python | 7,859 | 191 | """
Bonito CTC-CRF Model.
"""
import torch
import numpy as np
from bonito.nn import Module, Convolution, LinearCRFEncoder, Serial, Permute, layers, from_dict
import seqdist.sparse
from seqdist.ctc_simple import logZ_cupy, viterbi_alignments
from seqdist.core import SequenceDist, Max, Log, semiring
def get_stride(m)... |
8a4ea6666dd523e064869998212605bc149a982d04cafab14388b0fb627e9aac | Python | 7,859 | 172 | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Vehicle Maneuvering In Opposite Direction:
Vehicle is passing another vehicle in a rural area, in daylight, under clear
weather conditions, at a non-junction and encroaches i... |
09e5a3d6c7b9da1a5c38b225c4b3409d3f8d1fee704aca84ce79ec280a020896 | Python | 7,861 | 219 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Run some syntax checks. Return 0 if all tests pass and 1 otherwise.
The file bitbucket-pipelines.yml shows how to install the dependencies.
"""
from __future__ import print_function
import errno
import glob
import json
import os
import pipes
import re
import subpro... |
10aba00dd56e242d7dc137dd78da61d5aad225a99947f8c96cab0d3765b28d3b | Python | 7,861 | 138 | """
SIGN_FROM_WIRING.py written 2026-09-07
THE QUESTION, and it is the only one in this project that points forward instead of back.
Every whole-brain model reads the sign off the ELECTRON MICROSCOPE, using a classifier
that is species-specific, needs ground-truth staining to train, and carries an
uncertainty the ... |
6bf443d44d8009b2243b4ee6fb02feafb8932cd59f114f42cfc64e9ce5bbcb35 | Python | 7,861 | 188 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 18:25:59 2018
@author: ***
Training script for spiking LeNet with quantization level k=2 on MNIST.
"""
#! /usr/bin/python
# -*- coding: utf-8 -*-
import time
import tensorflow as tf
import tensorlayer as tl
import os
import ast
print(os.getcwd())
tf.reset_default_g... |
a69aa28be8ed36f82f1621ec4647bbb715f0bb2168969053edca6bd23727868f | Python | 7,863 | 259 | # 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... |
d1ad9152d4276a4a752803752e7155ec75458a237d9b02f8eeb77d47d5fb670a | Python | 7,864 | 196 | # 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... |
f4b3caeae2699fae32e056fdda0ff3bc90b74f301692714f0ea013435943b3c9 | Python | 7,864 | 221 | # -*- coding: utf-8 -*-
import os
import pickle
import numpy as np
from sklearn.preprocessing import MinMaxScaler
prefix = "processed"
def save_z(z, filename='z'):
"""
save the sampled z in a txt file
"""
for i in range(0, z.shape[1], 20):
with open(filename + '_' + str(i) + '.txt', 'w') as ... |
fa727596263f6916483e4ba3385e61494234f4dac7fac8ab8761cfd42f44c322 | Python | 7,865 | 198 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.grucell import GRUCell
from elasticai.creator.nn.integer.lstmcell import LSTMCell
from elasticai.creator.nn.integer.quant_utils import (
AsymmetricSignedQParams,
GlobalMinMaxObserver,
SimQuant,
)
from elasticai.creator.nn.integer.rnnlayer... |
34452c86f1211342e7f91486ca2fb245cb47373475363c5cb52308d381bc8f04 | Python | 7,866 | 193 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
4e94e9cff8c78008f8736fa66804ac9575f4640b48c59abe2cd48788e446fd44 | Python | 7,866 | 139 | # 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... |
18081ac1d740aefe10e7eccc23b5bb1e8824b0536551ff5ca95e0c7e5e606cb1 | Python | 7,867 | 133 | # Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux
# 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 b... |
3685fa18b3d7c0e468d13b0ba2608e6c2233702340fd09d3661cbf59b898db94 | Python | 7,867 | 250 | # 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... |
4405b77b04d4bfe11a16c316d2ee2fa3b017df25ccf9c5bcbec7d2ef5aeccc6c | Python | 7,868 | 155 | #!/usr/bin/env python
def qc(filename):
sys.stdout = sys.__stdout__
## 1. remove samples that are missing more than 5%
print("Setp 1: Removing subjects with missing rate > " + args.mind)
cmd_step1 = ["plink", "--bfile", args.bfile, "--mind", args.mind, "--make-bed", "--out", cwd + rel_tmp_path + filen... |
9891fdf67ecfc26132e665afd540623e2d47737cb2b567d97b4eb48ebda62db7 | Python | 7,870 | 508 | #napsPrimitives.py
from dreamcoder.program import Primitive, Program
from dreamcoder.grammar import Grammar
from dreamcoder.type import tlist, arrow, baseType #, t0, t1, t2
#from functools import reduce
#Internal TYPES:
# NUMBER
# BOOLEAN
# NOTFUNCTYPE
# Type
# ANYTYPE
#types
tsymbol = baseType("symbol")
#PROGRAM =... |
b6163a3a8cf18cd8879cdf6c314ee23cc36207863c14c5f3bed96625df7295cc | Python | 7,872 | 329 | # 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... |
df89b57982edbee7b1e71e618173cbec9111caea92d0ec396c8003234a30baa9 | Python | 7,872 | 167 | rest_api_version = 3
def update_param(name, param):
if name == 'algorithm_params':
param['default_value'] = None
return param
return None # param untouched
extensions = dict(
required_params=['x', 'y', 'training_frame'], # empty to override defaults in gen_defaults
set_required_param... |
c315af87fcfc0d2261d2896dcd941ef31868e22b19e2a8df8e496f8eeb9a1f98 | Python | 7,873 | 294 | # 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... |
118c90f2d5927f7d15283da17d24ae24806a4c462fd78e6b5b0d90b59ec923b3 | Python | 7,875 | 230 | from torch.nn import Linear
from torch_geometric.nn import global_mean_pool
import torch
from torch_geometric.nn import GraphConv,TransformerConv,GCNConv
import numpy as np
class GCN(torch.nn.Module):
def __init__(self, hidden_channels,input_dim,num_classes,num_layers):
super(GCN, self).__init__()
... |
77631ebd85bc1e174ecdea9f8c20c043a505df52f99817a1c1f1c1b4c99421b3 | Python | 7,876 | 265 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from cellsim16popsParams_default import multicompartment_params
import analysis_params
import os
import numpy as np
from matplotlib import gridspec
import matplotlib.pyplot as plt
import matplotlib.style
matplotlib.style.use('classic')
# parameters
params = multicompartmen... |
b63090ea31f9bb7c7ab529b80880e3c7d729bac58f6458802841bbcb7c35c3e8 | Python | 7,876 | 235 | '''
Script that runs the DNN on ECFP data.
'''
import argparse
import math
import os
from collections import defaultdict
from statistics import mean
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from datasets_ECFP import CustomData... |
8b4fafd1087af17c6b3fbb7df7bdec8cf31e01ed45f035ff743ca1bcb4491b6b | Python | 7,878 | 195 | import torch
from typing import List, Callable
from .trainingwrapper import TrainingWrapper
from .solutionnetworks import RootLU
class SimpleConvNet(TrainingWrapper):
def __init__(self, channels_per_layer: List[int], kernel_sizes: List[int],
in_channels: int, out_units: int, loss_fun: Callable, metric... |
8f8239fde8d7cdffebe5f47f231c54eae294914fd599c7320040ad3113544a0d | Python | 7,880 | 215 | """Git-backed version detection and update operations for the RegTools repo.
Pure logic - no Qt. Every git call shells out via _git() with the project root
as cwd and a timeout, so the GUI layer (gui.py) is a thin shell over this.
Tests redirect the repo by monkeypatching get_project_root on this module.
"""
i... |
6846095620e9025269db232a3c9d5c349838788e093438baa2fc31ccbbf71ed8 | Python | 7,883 | 224 | """Custodian handlers for VASP."""
from __future__ import annotations
import os
import shlex
from typing import TYPE_CHECKING
from custodian.custodian import Custodian
from custodian.vasp.handlers import (
FrozenJobErrorHandler,
IncorrectSmearingHandler,
KspacingMetalHandler,
LargeSigmaHandler,
M... |
14baf5c83b828de3847d5b867f97571e574260d70f7f35455ff3be824512a61f | Python | 7,884 | 253 | """
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free software: yo... |
5787eda29966b4a71de657790e38b9b1d68130681b96d43a042c06673e0b89a3 | Python | 7,885 | 227 | # 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... |
436670d7fdf918d15abb56f2c89addaec5d81b9dd314c8ca731fb517ce19019d | Python | 7,886 | 180 | from typing import Tuple
import torch
import torch.nn as nn
class BEncoder(nn.Module):
r'''
The variational autoencoder consists of two parts, an encoder, and a decoder. The encoder compresses the input into the latent space. The decoder receives as input the information sampled from the latent space and pro... |
ca4f98ba2588111a3328393f7917eb91f8e45e12319acd22f308f86e01ee8673 | Python | 7,886 | 205 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
from sklearn.manifold import SpectralEmbedding, Isomap, LocallyLinearEmbedding
import time
from scipy.stats import zscore, spearmanr
from multiprocessing import Pool
from scipy.spatial.distance import pdist
impor... |
32c0bf889944c54f7e89cef90f6f71eda8d95f5193ab692bcd75fa89056809e2 | Python | 7,888 | 200 | """Tests for the 3D extension of the seeded Multi-Otsu-4 GrabCut masker."""
from __future__ import annotations
import numpy as np
import pytest
from regtools.tissue_masking.core.grabcut import (
EntropyGrabCutConfig,
clean_mask_3d,
compute_entropy_grabcut_3d,
volume_tissue_score,
)
d... |
66b565b4fd4144a0ba7f3229c5bad3ee0237ac74e0a16073db2e19540682a93e | Python | 7,888 | 233 | from __future__ import print_function
import os
import numpy as np
import subprocess
#import sys
#sys.path.extend([
# '/Users/caelan/Programs/LIS/git/collaborations/amber',
#])
# Convex decomposition
# Needs this bit of BHPN/Amber - mostly a call to Scipy interface to QHull
# TODO: amber uses python2 only
from pyb... |
aacb381bd4b6e4d695cd8f7bb75b04c63cf891733947da6a277607b51638d1a0 | Python | 7,892 | 188 | ''' plot statistical contrast between listening and imagination and sound 1 and sound 3 '''
import mne
#%gui qt
#import matplotlib
from nilearn import surface
from nilearn import plotting
fsaverage = datasets.fetch_surf_fsaverage()
fsaverage
#%matplotlib qt
import numpy as np
import pandas as pd
from matplotlib import... |
487193d12248ba9a8fa18c5a955a314544770eeb76e6a234d1906f67499f5190 | Python | 7,893 | 212 | import argparse
import os
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef
from sklearn.inspection import per... |
a280bf4ad79e2d9b02e9f68de05e30200c8f3c2a0cefb2a0c27922ad193f28da | Python | 7,893 | 211 | #!/usr/bin/env python
#
# 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... |
e841fbd3dc36ca06c3ed9eac1240a5258127528f4563009ed31a7611b694b638 | Python | 7,895 | 185 | import os
import re
from copy import copy
from typing import List, Tuple, Union, Dict
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
class KFoldPerSubject:
r'''
A tool class for k-fold cross-validations, to divide the training set and the... |
850f1d7ee593302504137aafa8af4671f0a423c7cb2736c97b854e369f3304b9 | Python | 7,898 | 179 | import argparse
import pathlib
from pathlib import Path
import json
import os
from collections import OrderedDict
import shutil
import sys
import nibabel as nib
import numpy as np
import re
from tqdm import tqdm
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via input() and return their answer... |
a9e4c032fd37e33198ad8f1b462f8d6decb6ee4e7da4f27ed594b08564b02468 | Python | 7,898 | 221 | import control.utils.image_processing as image_processing
import numpy as np
from os.path import realpath, dirname, join
try:
import torch
from control.DaSiamRPN.code.net import SiamRPNvot
print(1)
from control.DaSiamRPN.code import vot
print(2)
from control.DaSiamRPN.code.utils import get_axis_aligned_bbox, cx... |
f6a398e8eca2e81d4754db380d81474b26af461c7804f16e82fbd49238e4769f | Python | 7,898 | 184 | import numpy as np
import pandas as pd
from typing import List, Union, Tuple
import scipy.stats as stats
import sklearn.metrics as metrics
from constants import N_ITEMS
__all__ = ["compute_total_score_error", "compute_accuracy_scores", "compute_class_conditional_acc_scores",
"compute_bin_mse_scores", "comp... |
5585601d6385cbdf486183a471b90df05624a3a2d069a2548b4b9b1ab5820242 | Python | 7,899 | 272 | import sys
import click
from pathlib import Path
import yaml
import numpy as np
from PIL import Image
import shutil
import torch
import torch.nn.functional as F
from torch.nn.parallel import DistributedDataParallel as DDP
import sys
from segm.utils import distributed
from segm.utils.logger import MetricLogger
import se... |
8dfb5b8764d9e7a4503d0eeefb5f8a25b0fe2646ef89ab66c73e99e27657c3a1 | Python | 7,899 | 208 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.linear.design import Linear as LinearDesign
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.... |
a8e75a7d2548517f294fc53c11685cfc5996d6267a1fc37798393e4289cda80c | Python | 7,900 | 201 | # -*- coding: utf-8 -*-
"""
Reorganising NIfTI files from dcm2niix into the Brain Imaging Data Structure
"""
import logging
import os
from pathlib import Path
from glob import glob
import shutil
from dcm2bids.dcm2niix_gen import Dcm2niixGen
from dcm2bids.sidecar import Sidecar, SidecarPairing
from dcm2bids.participa... |
38fa9a7b876fff0e3bee8e5765729e7854397e57768b3806178821de336456e2 | Python | 7,901 | 214 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import (
get_padded_q_inputs,
get_padding_len,
)
from elasticai.creator.nn.integer.math_operations.math_ope... |
e8bb7ecd0033dad0b74531169b00fc28367d10183b0d9e8439a4b7437623cac0 | Python | 7,901 | 227 | import torch
import torch.nn as nn
import torch.functional as F
class BasicStem(nn.Sequential):
"""The default conv-batchnorm-relu stem
"""
def __init__(self):
super(BasicStem, self).__init__(
nn.Conv3d(1, 64, kernel_size=(1, 7, 7), stride=(1, 2, 2),
padd... |
a524b4866779d7b6d9be77729854556506435ca272e059b5c18ef9489aa292cb | Python | 7,907 | 175 | # -*- coding: utf-8 -*-
################################################################################
## *
## * Function: filter PE reads by the total length and each-read length of non-N high-quality bases from each pair]
## * Writer:Siyuan Feng
## * Mail: siyuanfeng.bioinfo@gmail.com
## * Version: 10.27.2... |
88a7edd53477bf9629e87f54d0a4903ef753beb6e76394e4d7f00831eda91512 | Python | 7,908 | 172 | from typing import Any, Dict, Optional, Tuple
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import ConcatDataset, DataLoader, Dataset, random_split, TensorDataset
from torchvision.datasets import MNIST
from src.data.mre_brain_datautils import data_splitting, get_bin_centers... |
71ab72fb07053c6dd0980663b51c4781234a1bd972250782fc873b1eff626764 | Python | 7,909 | 201 | import anndata as ad
import jax
import jax.numpy as jnp
import numpy as np
import pandas as pd
import pytest
import scanpy as sc
import pertpy as pt
from pertpy.tools._scgen._base_components import FlaxEncoder
from pertpy.tools._scgen._scgenvae import JaxSCGENVAE
@pytest.fixture
def adata(rng) -> ad.AnnData:
n_o... |
d7d571b2ce1b392b3672dab2e98630e339afa0b25d4bb8803c25249dd941f474 | Python | 7,909 | 216 | # 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... |
205e6b103dfe4cb64016804e6dadcdc38990e4cc90eadac7b66506889d1df4a3 | Python | 7,910 | 226 | from dreamcoder.domains.arc.arcPrimitives import *
from dreamcoder.domains.arc.arcPrimitives import Grid
import numpy as np
def _overlay_and(grid1,grid2):
#both grids must have value in overlay
arr1, arr2 = grid1.grid,grid2.grid
arc_assert(np.shape(arr1)==np.shape(arr2),'overlayed two grids of... |
4b6741e439da46c7021bccc3bbb14eb3a61674b219cf7b901dd2653c568d74ff | Python | 7,911 | 230 | #!/usr/bin/env python
"""Utility functions for statistical analysis."""
# =============================================================================
# GLOBAL IMPORTS
# =============================================================================
import numpy as np
import scipy.stats
import scipy.special
# ====... |
7740967d9bca7db50c9f78513c950d4b7d7405a16ac8855a0352dbb5c76ff810 | Python | 7,911 | 324 | # +
# example script for the Harmonic interaction (non-holomorphic, real parameter case)
import netket as nk
nk.config.netket_experimental_fft_autocorrelation = True
import jax
import jax.numpy as jnp
import netket as nk
import flax
import flax.linen as nn
from typing import Any
import os, sys
import copy
import net... |
6243f508300b64c1a3133b7c6b6aa4f4b064d6e0eb0845e8d01d3bdb02e81dfa | Python | 7,913 | 259 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:AUTHOR: Jens Petersen
:ORGANIZATION: Heidelberg University Hospital; German Cancer Research Center
:CONTACT: jens.petersen@dkfz.de
:SINCE: Wed May 17 14:29:20 2017
:VERSION: 0.1
DESCRIPTION
-----------
Convert all scans under a given XNAT endpoint to NIFTI
REQUIRES... |
5a39ad93a33ed1e759379898feda6e8b069e846a2adfaeaaf1d706f52451818a | Python | 7,914 | 214 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.depthconv1d.design import (
DepthConv1d as DepthConv1dDesign,
)
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import (
... |
b0370fec54aea78097955b7580767a9877b899877d5f372d4e3a35a7f5d07fe5 | Python | 7,916 | 221 | from __future__ import annotations
import logging
from pathlib import Path
import numpy as np
import pytest
from ase.build import bulk, molecule
from ase.constraints import FixAtoms
from ase.md.npt import NPT
from ase.optimize import FIRE
from ase.units import fs
from quacc.recipes.emt.core import relax_job, static_... |
5e65ba31619dfae6d844551dbf3472474513f069417c242b852d8b20a36cf92f | Python | 7,917 | 292 | import numpy as np
from perception_tools.common import create_name
from plan_tools.common import LEFT_ARM, ARMS, TOP, RIGHT_ARM, COFFEE, SUGAR, is_obj_type
from plan_tools.samplers.grasp import Grasp
from plan_tools.planner import Task
from pybullet_tools.pr2_utils import WIDE_LEFT_ARM
HEAD_CONF = [0, np.pi/3]
LEFT_A... |
9be55f1b015a8e86d0ec024c72bb960aff53d0f172a810376964e4112f2e6475 | Python | 7,917 | 220 | import bct
import numpy as np
from tqdm import tqdm
from sklearn.utils import check_random_state
def strength_preserving_rand_sa_signed(A, rewiring_iter = 10,
nstage = 100, niter = 10000,
temp = 1000, frac = 0.5,
... |
1d475d4750bb12497427cd001d6fa09df740a57a015c50897d83e58178712610 | Python | 7,919 | 189 | # 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... |
1e6a37b5748bbf8f00e87a205a2755ce74ee51d9ff307da06daf984f45830bc5 | Python | 7,919 | 234 | """
Helpers to train with 16-bit precision.
"""
import numpy as np
import torch as th
import torch.nn as nn
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
INITIAL_LOG_LOSS_SCALE = 20.0
def convert_module_to_f16(l):
"""
Convert primitive modules to float16.
"""
if isinstanc... |
f379d72bd99be224ee17b7c6118010dedb5be50c02b282a1edf739d29932b751 | Python | 7,921 | 186 | """Preprocessing functions.
This module provides functions for preprocessing either raw or epoched data
"""
import numpy as np
import xarray as xr
from mne import Epochs, EpochsArray, Info, pick_info, pick_types
from mne.channels import DigMontage, make_dig_montage, make_standard_montage
from mne.epochs import EpochsF... |
9a6659868fe383d791caf02466d42a01a753acd467f8f16e9e0ae0686b9121f8 | Python | 7,924 | 162 | """VTK rendering of registered FlyWire geometry and measured reservoir state."""
from __future__ import annotations
from pathlib import Path
import os
import numpy as np
from PySide6.QtCore import Signal, Qt, QTimer
from PySide6.QtWidgets import QWidget, QVBoxLayout, QLabel
from PySide6.QtGui import QImage, QPixmap
im... |
3b4ba865d73575f56fdc08f1d9db94f4a71225c16f1f497315162ae23ba39daf | Python | 7,925 | 284 | import re
from abc import ABC, abstractmethod
from collections.abc import Callable, Iterator
from typing import override
import elasticai.creator.function_dispatch as FD
from elasticai.creator.hdl_ir import Node, Shape
class Signal(ABC):
types: set[type["Signal"]] = set()
@abstractmethod
def define(self... |
cd6dc02b20cefb0a296dfb02317874f304db3f55c730276e024c120c64e6eea7 | Python | 7,927 | 217 | import os
from argparse import ArgumentParser
from pprint import pformat
import joblib as joblib
import mlflow
import numpy as np
import optuna
import pandas as pd
import sys
import yaml
from contextlib import redirect_stdout
import io
from optuna.integration import MLflowCallback
from optuna.samplers import TPESample... |
d9f4b0dfacd7304f2cce351fa0cc9067bde0a9ce835a8b7ac39672845e426e26 | Python | 7,927 | 175 | import numpy as np
from scipy.ndimage import zoom
import cv2
from matplotlib import pyplot as plt
from pathlib import Path
import Filter
import pydicom
from pydicom.uid import generate_uid
import shutil
from numpy.random import default_rng
from pydicom.pixel_data_handlers.util import apply_modality_lut
class CT3D:
... |
631553f0343cc1ada6db63e21c4bf1a733e40e75bc9b0e9b80c89008d08e41cf | Python | 7,928 | 196 | import argparse
from loader import MoleculeDataset
from torch_geometric.data import DataLoader
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
import numpy as np
from model import GNN, GNN_graphpred
from sklearn.metrics import roc_auc_score
from ... |
c7aa44e0aa707f2a3b32c863a10948b4e87506eaf915b5287003a6079b27957b | Python | 7,928 | 242 | #!/usr/bin/env python
# coding: utf-8
# ### Comparison of optimizers for LASSO parameter range experiments
#
# sklearn has 2 ways to fit logistic regression models with a LASSO penalty: [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) (using the libl... |
3cf8f39957f04a321c3ed5ee937eb27e9266e1b58b4f039d86517dd58368ad07 | Python | 7,930 | 238 | import numpy as np
import globals.global_func as gf
REG_PULSE_GAP = 3
REG_MODE = 4
REG_PULSE_COUNT = 5
REG_PULSE_WIDTH = 6
REG_CHIP_NUM = 11
REG_DAC_WL_BASE = 12
REG_DAC_SL_BASE = 28
REG_DAC_BL_BASE = 44
REG_DAC_TIA_BASE = 108
REG_TIAR_SWITCH_BASE = 140
REG_SWITCH_SL_BASE = 144
REG_SWITCH_WL_BASE = 146... |
5bb9d6d4634b9143281177c57986ccbf22a0576987f33c71b7e868ca14640db6 | Python | 7,933 | 215 | import numpy as np
import collections
from tqdm import tqdm
import pandas as pd
import io
import os
import matplotlib.pyplot as plt
import pandas as pd
from tqdm import tqdm
import pickle
import re
import sys
import h5py
from math import ceil
from collections import defaultdict
from scipy.sparse import lil_matrix,csr_m... |
1c98b9adf4e4d5dba4aef7c3fe537a133ad64d501724588f769263798218562b | Python | 7,934 | 194 | from typing import Optional, Dict, List, Type, Any
from .base import AtomicModule
from ..loss import Loss, MissingValueLoss, ForceScaledLoss
import pytorch_lightning as pl
import torch
import torch.nn.functional as F
import logging
log = logging.getLogger(__name__)
class LitAtomicModule(pl.LightningModule):
def... |
4303ef933b71df4f5cbf16cb6d4a00158c36fdf8146525f9e159335258466cea | Python | 7,934 | 231 | import argparse
import random
import numpy as np
import open3d as o3d
import torch
import trimesh
from scipy.spatial import cKDTree as KDTree
def normalize(x):
return x / np.linalg.norm(x)
def viewmatrix(z, up, pos):
vec2 = normalize(z)
vec1_avg = up
vec0 = normalize(np.cross(vec1_avg, vec2))
v... |
518ae706cb6e84e591b48d711debfbe8cc3858da45f90dff29a475ee03f8fde3 | Python | 7,935 | 184 | """Implementation of CLI measure command."""
import os
import json
import math
import multiprocessing as mp
import numpy as np
from treem import Morph, SWC
from treem.io import TreemEncoder
from treem.utils.geom import norm
from treem.morph import get_segdata, SEG
def get_morphometry(reconstruction, args):
""... |
0d3c484995e61e6f22cad0734040298be28a62a462ff64a46ce398c46d0aa994 | Python | 7,938 | 164 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core as core
import control.m... |
349fce512dccc875d365bdb2deb191349b4a027af4d12e6b34e3c2d34fc9138e | Python | 7,939 | 199 | import copy
import shutil
import time
import numpy as np
import os
import torch
import torch.backends.cudnn as cudnn
from torch import optim
from torch.utils.tensorboard import SummaryWriter
from src.training.train_utils import AverageMeter
from src.utils import timestamp_human
class RegressionTrainer:
def __in... |
f8c345c131ada05530fe09484bf57fe0de647b1d753748f844d5f181bbc705d0 | Python | 7,939 | 179 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 31 15:58:36 2023
@author: daltonm
"""
from importlib import reload, sys
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from scipy.stats import binomtest, ttest_rel, ttest_ind
sys.path.insert(0, '/project/nicho/projects... |
9654701479d3283b699caba898aeaa5168a8b578adc16224fb2796e8e7dbe73b | Python | 7,940 | 183 | # 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... |
d2b0680dae48216f00340ef83960675198078782e5a90c7bfe3d328a241ff5f7 | Python | 7,941 | 222 | """
Model for evaluation of logical forms on CLEVR-like scenes.
"""
from collections import Counter, defaultdict
from copy import copy
from copy import deepcopy
import logging
import functools
import time
import traceback
from frozendict import frozendict
from pyccg.logic import *
class Model(object):
"""
Grou... |
c9e77f082734f7ab225a0e83dbd54cd06f3360b41eea4a7378371b02a1b7c943 | Python | 7,942 | 148 | import os
import unittest
from hed.models import DefinitionDict
from hed.models.hed_string import HedString
from hed.models.hed_tag import HedTag
from hed.models.sidecar import Sidecar
from hed.models.tabular_input import TabularInput
from hed.schema.hed_schema_io import load_schema_version
from hed.tools.analysis.hed... |
b894159a6c28eb76429f5ba3f1ba32995a0b934263c44214d33d7a551de7fdef | Python | 7,945 | 238 | from collections.abc import Iterable, Iterator, Mapping
from typing import Any, Self, cast, overload
type AttributeBaseData = float | int | str | bool
type AttributeTuple = tuple["Attribute", ...]
type Attribute = "AttributeBaseData | AttributeTuple | AttributeMapping"
class AttributeMapping(Mapping[str, Attribute... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.