sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
369585a526a8c03e6c60adb044c92a7231adef0e3f1d414b6ec35103c26ccedc
Python
6,552
152
import os import json from urllib.parse import quote, unquote import numpy as np from typing import Iterator, Dict, Union import pandas as pd from torcheeg.datasets.module.base_dataset import BaseDataset from .base_model_selection import BaseModelSelection from .utils import create_subset, read_indices, write_indic...
d44053b776a3fa7b1597beb44f0b15b77062829d96aaddd6b776d533202c98f2
Python
6,552
144
import sys import pandas as pd import matplotlib.pyplot as plt import netplotbrain as npb from scipy.io import loadmat import statsmodels.api as sm from matplotlib.colors import LinearSegmentedColormap sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/visualization') fr...
0f0631709e6218326fa25f61ec09bc70e733d8f1d192971df3459a50282d355b
Python
6,553
199
# -*- coding: utf-8 -*- import tempfile, os, pytest import tensorflow as tf import numpy as np import pinn from shutil import rmtree @pytest.mark.forked def test_potential_model(): """A simple example to test training and using a potential""" from ase import Atoms from ase.calculators.lj import LennardJo...
28218ac7b162e15c260a9d006bdfcde04da77a3b100c4808dfeed0b52fca99ad
Python
6,553
163
import torch from torch import nn import timm class LateFusionBackbone(nn.Module): """ image_architecture: Architecture used in the image branch. ResNet, RegNet and ConvNext are supported lidar_architecture: Architecture used in the lidar branch. ResNet, RegNet and ConvNext are supported use_velocity: ...
ee3c3d5d279e400e4af87e08e5ae74df82acda0910aa6e333d78eb8709cfd52e
Python
6,556
223
import logging import mimetypes import os import pathlib from typing import Callable, Iterable, Optional, Tuple from pip._internal.models.candidate import InstallationCandidate from pip._internal.models.link import Link from pip._internal.utils.urls import path_to_url, url_to_path from pip._internal.vcs import is_url ...
d310410aa58e2fab4af2bdd347633afcd2e410e5a2fef7e3fb0983b638678d25
Python
6,558
138
# This script create masks from annotations. import warnings warnings.simplefilter(action='ignore', category=FutureWarning) # Ignore all FutureWarning warnings that might flood the console log warnings.simplefilter(action='ignore', category=DeprecationWarning) # Ignore all DeprecationWarning warnings that might fl...
f748bb79a2029026eb801a1b5e69a79a766d836de32a9a3fa55f2b933332cfad
Python
6,558
184
from __future__ import division, print_function import copy import numpy as np from soundsig.incrowd import ConvolutionalInCrowdModel, fast_conv, fast_conv_grouped class ConvolutionalLinearModel(ConvolutionalInCrowdModel): """ Wrapper class for use with ThresholdGradientDescent optimization class, also ...
225db954def4651f08af18719e26e8ca2a85264744a89bf3cb9a48dd980928c0
Python
6,559
218
import numpy as np from torchvision import transforms from PIL import Image import numbers import torch class ResizeImage(): def __init__(self, size): if isinstance(size, int): self.size = (int(size), int(size)) else: self.size = size def __call__(self, img): th, tw = self.siz...
fa50133341bc90fb6704adf456e63050ee74b8561328b4b639eea30d389da53e
Python
6,560
202
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ from keras.layers import Input, Dropout, Dense, Activation, LeakyReLU, Conv2D from keras.layers import Lambda, Flatten from keras.models import Model from ke...
b55c24cab5eac02da14c308420e97af9118d853da39f3df09900210c803eebb5
Python
6,561
104
"""Built-in components: the reference LiquidAion configuration, registered like any plugin. Factories receive a context object; the fields per category are documented in docs/PLUGINS.md. """ from __future__ import annotations from typing import Any from .connectomes import cue_group, flywire_cx512, random_control_co...
0ea06e646068044f2f39a0778fbfcbfbd88578ca00624feaec149afa1140518d
Python
6,563
81
from argparse import ArgumentParser import numpy as np def get_param(): parser = ArgumentParser('recon_GCAMP') parser.add_argument('--fold_res', type=str, default='../results',help='folder in which the res will be saved') parser.add_argument('--gpu', type=int, default=0, help='gpu index, -1 for cpu') pa...
3789d1825d63b5e165807997f423f067ebfc86a4b18bf2d49708953ec78b1bdd
Python
6,563
163
import math import torch from torch import Tensor from typing import List, Optional from torch.optim.optimizer import Optimizer def adam(params: List[Tensor], grads: List[Tensor], exp_avgs: List[Tensor], exp_avg_sqs: List[Tensor], max_exp_avg_sqs: List[Tensor], state_steps...
df05d814e9721f65c43944a570645ea80814785456716c7f6a35b9aed9bfac3a
Python
6,563
221
import tempfile from pathlib import Path import pytest import torch from torch import nn from elasticai.creator.nn.integer.linear.linear import Linear from elasticai.creator.nn.integer.quant_utils.calculate_quant_params import ( calculate_asymmetric_quant_params, ) from elasticai.creator.nn.integer.relu.relu impo...
59b15774fbd91f27684a2e5df6eee9ddff9882a7a42b06db867aa7f0c4154b57
Python
6,564
175
# -*- coding: utf-8 -*- from __future__ import print_function import errno import logging import os.path import subprocess import sys from . import call from . import limits from . import portfolio_runner from . import returncodes from . import util from .plan_manager import PlanManager #TODO: We might want to turn...
10337326f7ddddbc35198b510abe228337e87f9cfec6e17f91e1bd91a9a01288
Python
6,565
114
from codex.configuration import MIN_SYN_THRESHOLD from codex.data.structured_search_filters import ( STRUCTURED_SEARCH_UNARY_OPERATORS, STRUCTURED_SEARCH_BINARY_OPERATORS, STRUCTURED_SEARCH_NARY_OPERATORS, STRUCTURED_SEARCH_ATTRIBUTES, SEARCH_ATTRIBUTE_NAMES, ) def operators_list(ops): def _ma...
ec10f70fc61e1b4ab6ddf3a2864d0696e52aded8546778ae849e804f7a1f01db
Python
6,566
164
# import time # # import torch # import torch.nn.functional as F # noqa # from torch.dataloaders.preprocessing import DataLoader # from torch.optim.lr_scheduler import ExponentialLR # from torch.optim import Optimizer # from torch.dataloaders.tensorboard import SummaryWriter # # # def train_epoch(model: torch.nn.Modul...
261fba59ee4028e1970ba50b6a8ffeeda8034923ec4e2b6a81fa8aaedeeec4df
Python
6,567
161
"""A worker result that lands DURING teardown must not rebuild the tab. ``_process_template_path`` starts a metadata worker whose GUI-thread result handler calls ``_refresh_preview_template``, which starts ANOTHER QThread and touches widgets. If that result is delivered while the tab is being torn down, it create...
d39b9a20f3b39c93d0ed5811766182986e2c0e750fb7082fe6a39822a6cbd946
Python
6,567
217
# actions.py from .exceptions import ParseException from .util import col, replaced_by_pep8 class OnlyOnce: """ Wrapper for parse actions, to ensure they are only called once. """ def __init__(self, method_call): from .core import _trim_arity self.callable = _trim_arity(method_call)...
52d86d5aa87a1771376b2ae1e0ccb3085537f232bca66dd00fe95e64c37d60d5
Python
6,568
151
import numpy as np import os import pandas as pd import torch import torchvision from tqdm import tqdm from constants import CLASSIFICATION_LABELS, N_ITEMS from src.dataloaders.semantic_transforms_dataloader import get_dataloader from src.utils import class_to_score class SemanticMultilabelEvaluator: def __init_...
b54f18d8a9692fb4cf2902c298169099b0f703f93257b30b0d67b24ac7535604
Python
6,568
232
# 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...
8565a2dbeca8b04458bbde369e47dbb9aee23434c9e38457705a62d3d97be27b
Python
6,569
188
# 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...
3119a5416fecd78d3ad3d099d97ea5a1b4c029d288e817ec62af972650eebb0c
Python
6,571
162
# -*- coding: utf-8 -*- import tensorflow as tf from tfsnippet import Distribution, Normal class RecurrentDistribution(Distribution): """ A multi-variable distribution integrated with recurrent structure. """ @property def dtype(self): return self._dtype @property def is_continuo...
bc6f224ec182f9f7022f1ebd4b5bbf2e666de309a10357c1940b0514c322c694
Python
6,571
138
""" DeepLabCut2.0 Toolbox (deeplabcut.org) copyright A. & M. Mathis Labs https://github.com/AlexEMG/DeepLabCut Please see AUTHORS for contributors. https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0 """ import numpy as np import os from pathlib import Path i...
95b8d8ec69eb553273c76e4e3a4776681f9a90b96c633d794bd33edd31703bb9
Python
6,572
149
#!/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 : # #======================...
d798ad6bc191954ed0e765912e05b0f0f7b7cdafe06adb6c2f45a80574cfbdec
Python
6,572
200
# -*- coding: utf-8 -*- """ Created on Wed May 3 18:52:51 2023 @author: Dustin Garner """ """ ----------- Maintenance ----------- maintenance.find_undone_input() ================ #Last Run 5/8/23, identified 9 neurons. maintenance.check_joined_concurrence(all_mt_l + all_mt_r + tb_l + tb_r + \ ...
c25935b93a3eab8311871d109d5ce0119d0ce14cd1fb6940fb9a0ddf16994a66
Python
6,573
221
""" Functions for command line interface to generate cluster / peak summary """ import argparse import os.path as op from atlasreader.atlasreader import ( _ATLASES, check_atlases, create_output, read_atlas_peak, ) def _check_limit(num, limits=[0, 100]): """ Ensures that `num` is within provi...
4bd5db8f7b6704fcb680ac6526a01db9c76e7c4093e001fa3cbb4e6ca1d455dc
Python
6,575
210
import torch import torch.nn as nn import numpy as np import math from torch import nn, Tensor class PositionalEncoder(nn.Module): def __init__(self, dropout=0.1, max_seq_len: int=5000, d_model: int=512, batch_first: bool=True): super().__init__() self.d_model = d_model self.dropo...
e9de12d8918089299867f1cf1778dc86a396990a64cc50277124acf4052afbc1
Python
6,576
202
import pytest import numpy as np from pupil_recording_interface.device import BaseDevice from pupil_recording_interface.device.video import ( BaseVideoDevice, VideoDeviceUVC, ) from pupil_recording_interface.device.flir import VideoDeviceFLIR from pupil_recording_interface.device.realsense import RealSenseDevi...
61e94378ca1dd29cf3e30ccf2ed7412cca5febcbf2b42835b19019204f28b011
Python
6,579
185
"""The scale-consistency verdict has to reach a human. The check runs on every section and costs roughly a quarter of the batch. All of that is wasted if the result stops inside the worker - and it did: ``MaskingWorker.run`` built its summary dict field by field and simply omitted ``suspect``, so every pipeline-le...
dc0a4c12fdd532604cdc378b716b1402b29dfb6ab3cd08b472eaf4dd3029f33a
Python
6,579
143
from tqdm import tqdm import torch import torch.nn as nn from captum.attr import ( IntegratedGradients, LayerConductance, ) import warnings warnings.filterwarnings("ignore") from dataset import MicroDataset from model import MicroKPNN_MTL def explain_meta_to_disease(model, wrapped_model4disease, batch, device):...
475c4d452c7dbfc510d50ff4d5a383d35113f6e82f10cb8c9c0d6e8339edf951
Python
6,580
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...
fc6ba6c7895926c203ded9afa53019cfb54957fdea205682ed270307f5147a05
Python
6,580
161
#! /usr/bin/env python USAGE = """\ Update baseline: * change BASELINE variable below * push the change * login to computer running the buildslave as the buildslave user * remove ~/experiments dir * run in an updated repo (e.g. in ~/lib/downward): export PYTHONPATH=~/lib/python/lab export DOWNWARD_CO...
70522be328216b39216b592692c1a3332cb9b2311485e41529a7944c65c067e5
Python
6,581
166
import glob import os from os import listdir from os.path import isfile, join from pathlib import Path import numpy as np from uptake import make_data_folder import scipy.signal def define_pkl_filename(particle, mechanics): """ Args: params: class of imput parameters Returns: ...
829b825e90d5df6e19cfb877788848beaae4052d58dd886d16c61df5073de7ff
Python
6,581
172
# # 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,...
792ac0770c73bd305ac87f7ad7ec66bd51ab7a2a01bd42b9cc7b1bd0a6bf0509
Python
6,584
167
import torch import torch.nn as nn import torch.nn.functional as F class GraphConvolution(nn.Module): def __init__(self, in_channels: int, out_channels: int, bias: bool=False): super(GraphConvolution, self).__init__() self.in_channels = in_channels self.out_channels = out_channels ...
089c513c939b16a5cb07c7ace11fef58c00a588f9a8eb90c2abf227f1e8b5be0
Python
6,586
168
from collections import defaultdict import csv from logging import Logger import os import sys from typing import Callable, Dict, List, Tuple import numpy as np import pandas as pd from .run_training import run_training from chemprop.args import TrainArgs from chemprop.constants import TEST_SCORES_FILE_NAME, TRAIN_LO...
613bc15f36a31e5a74c97165bda4d76d9c90736548b1c8e4c6971eb81de9036b
Python
6,586
245
# 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...
9145725cef9d1e22d72539d8eae557484149744d70a8536c245e37c57a938221
Python
6,587
174
# Node group "Principal Components" (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 reg...
dfabebfc105417de9213ccf4476d6b212f89a9424760302f29339254cec50cd9
Python
6,588
226
# 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...
01e19692ec27e341842a2284687ea8e4771f4c93c187b938289ed2982e5de1c6
Python
6,589
143
import numpy as np from .bgwio import bgw_vsc from .lcaodata import LCAOData from .utils import slice_same, tqdm_mpi_tofile from .matlcao import pairs_to_indices, indices_to_pairs, MatLCAO from .gridintg import GridPoints ''' This module implements several functions needed by real-space construction of AO Hamiltonian...
1a05cd0d06ad1a09bbef45b2855e13ca463ade277c58866d91bc2c328a02ffda
Python
6,589
172
""" Train a DARNet Model on the DTU Dataset ======================================= In this tutorial, we'll walk through how to leverage TorchEEG for training a DARNet Model to classify auditory attention using the DTU dataset. Let's walk through the essential steps—from dataset preparation to model evaluation. """ ...
0a90f99e1e76f531fe9ccd901d3d042b1492b1056499f11a47923725143068ce
Python
6,590
189
#!/usr/bin/env python from __future__ import print_function import numpy as np import random from itertools import combinations from collections import namedtuple from copy import deepcopy from examples.continuous_tamp.primitives import get_pose_gen, inverse_kin_fn, get_region_test, plan_motion, \ tight, blocke...
01eb04203fb880f143593c0f88f68666e0f8b70753fa299a1ae311e597d29fcb
Python
6,591
199
import importlib.resources import locale import logging import os import sys from optparse import Values from types import ModuleType from typing import Any, Dict, List, Optional import pip._vendor from pip._vendor.certifi import where from pip._vendor.packaging.version import parse as parse_version from pip._interna...
1ed9009f8d2d862179d907d2f18a95b70f5d6e5c0c2f3d5c859689f98738ed1a
Python
6,591
218
# 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...
51651484bb09a5aab705fc0544abf4b6853e9de3c71948580d9494882d1dfaa4
Python
6,591
212
"""DICOM format loader (.dcm) for volume_io.""" from __future__ import annotations import gc import os from pathlib import Path from typing import List import numpy as np try: import pydicom _HAS_PYDICOM = True except ImportError: _HAS_PYDICOM = False # nibabel is optional - only nee...
accc502ba20d7c0c3e63c3e8a61cd28030cf3c8cc57b868b470be2ca1f6fde58
Python
6,591
161
# -*- coding: utf-8 -*- """ Created on Tuesday August 4th 2022 @author: Pablo Maceira Elvira Logistic regression is used for binary classification. However, predictions can be interpreted as a probability, as the sigmoid (i.e., the logistic function) is bounded between 0 and 1. Ultimately, what I want is to be...
eb8f3f6670533020cacbe45ca718bb77533d90170de59dca336496921507273d
Python
6,592
185
# -*- coding: utf-8 -*- """ Created on 15 october 2023 @author: divyoj """ ## importing libraries: import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # # note that this must be executed before 'import numba' # os.environ[...
806ff15e20f82f686b07e6c73ffc8ae0ef04b4e9ba1ab38905f3d8949a7736b7
Python
6,594
266
# 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...
d17c99e16ee91a3a352950c391c52465254364f2878b4031a85f21ba78756d26
Python
6,595
158
#!/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 : # #======================...
06700b2295e8c083b87338379e2c802541f113d0357b5aa3b78456f09ea169ef
Python
6,596
200
import sys import argparse import os script = os.path.basename(sys.argv[0]) nArgs=len(sys.argv) if nArgs < 2: aid=script+' takes YourFile.csv (or YourFile.zip) of rowsXcols numbers\n\t ' + \ 'and produces a UMAP result in YourFile.umap.csv' else: print('script arguments: '+ " ".join(sys.argv[1:])) ...
074fac8c8d6330bde566987d0b8cf34fc3919641f960d4bbf19005c8cd84734f
Python
6,596
170
# 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...
2cead72e02340a3425743a36ce1399606619ea0e1efdc24e081fe917d68c4564
Python
6,596
184
from __future__ import annotations import ctypes import os import sys from functools import lru_cache from typing import Callable from .api import PlatformDirsABC class Windows(PlatformDirsABC): """`MSDN on where to store app data files <http://support.microsoft.com/default.aspx?scid=kb;en-us;310294#XSLTH31...
91ce4f234ce0fe711011fac27a937138fc9e6a38d0050f187b6d395547a7ea9e
Python
6,598
282
import unittest from parameterized import parameterized from tests.utils import Utils from HyDGL.tools import Tools class TestTools(unittest.TestCase): @parameterized.expand([ [ 2, 0, [1, 0] ], [ 2, 1, [0, 1] ...
bfd976322bdaef6d13867d8b0440c634e2efc0334edf0f5377b636af47d4e5da
Python
6,599
227
device = '0' name = '' import os os.environ['CUDA_VISIBLE_DEVICES'] = device from stephenHeadConfig import conf as conf import PoseUMDN import tensorflow as tf import PoseTools import math import PoseUNet import cv2 import PoseCommon mov = '/home/mayank/Dropbox (HHMI)/temp/stephen/C002H001S0001_c_2.avi' out = '/ho...
24cb1172fb407f3f718f87291a978ac0f677857025abc113e9d5a79fc5f043f4
Python
6,601
175
# 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...
fd261711e2b398357fe91d24db80c64c06ac93a092d1af100ba72bf90ab2a785
Python
6,604
150
import torch from tqdm import tqdm from base import BaseTrainer from .tracker import MetricTracker class Multi_DNN_Trainer(BaseTrainer): ''' Multi DNN Trainer ''' def __init__(self, config, train_data_loader, valid_data_loader=None, test_data_loader=None): ''' Initialize the Multi DNN...
d7d5b476b6ecb5424a8290def850a0c67f18a88eef1216d11228fa5ef9dfe91c
Python
6,606
200
import torch import torch.nn as nn from torch.nn.modules.loss import _Loss from torch.distributions.distribution import Distribution from torch.distributions.kl import kl_divergence # NOTE Here we are defining losses for minimization, so essentially we negate the # log-likelihood or the ELBO. class ReconstructionLo...
0814e9109e9608d19a4f1d4ffe7eddef943fd0af2aad96f452dc83fc921334f5
Python
6,607
128
""" This script summarizes the significant results for global efficiency, participation coefficients, and selected links, organizing them and matching the results with the node coordinates for H3 """ import os import pandas as pd ############################################################################### # Change...
24a2b42d2b70feed920f49db25406be18daff458d7f578349f2824e608d0f137
Python
6,607
169
from codex.data.vocabulary import STOP_WORDS from codex import logger from codex.utils.parsing import tokenize, edit_distance class SearchIndex(object): def __init__(self, texts_labels_id_tuples): self.CS_label_to_row_id = {} self.ci_label_to_row_id = {} self.CS_token_to_row_id = {} ...
77cb9a5c345c41231d863ddeb065f630c8b448be0f017567d2697a9da1798434
Python
6,607
198
# 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...
78c4ed8d6b117b96c1101a26f3bce5a896089691d554b8ac190cff6e7e4903e8
Python
6,608
153
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 KFoldGroupbyTrial: r''' A tool class for k-fold cross-validations, to divide the training set and t...
00a75b668b891fbdae97827881e360ffa5bb651f0ed993ece831f6fcba4252ec
Python
6,610
207
""" Generate the "Color PyMOL", "Color VMD" and "Color CSS" nodes from the named colours that `molecularnodes.color.parse_color` reads. uv run docs/dev/named_color_nodes.py uv run -m nodebpy.assets build && uv run -m nodebpy.assets dump PyMOL and VMD colours come from `molecularnodes/_color_names.py`, CSS col...
9faedb9d69df60ef325909d0efa230a175aada0d8035823b32bd955fca4e35fb
Python
6,610
96
from nipype.pipeline.engine import Workflow, Node from nipype import DataGrabber, DataSink, IdentityInterface import nipype.interfaces.fsl as fsl import nipype.interfaces.freesurfer as fs import nipype.interfaces.spm as spm import nipype.interfaces.matlab as mlab import os from nipype.interfaces.utility import Function...
5d862ff7a346ff9864874608a46808cad504cd19ecc3e4a3ed723ec4d178fce3
Python
6,611
170
from typing import Any, Callable, List, Optional, Type import torch from torch import nn, Tensor from ..modules.residuals import InvertedResidual, Conv2dNormActivation, Block def _make_divisible(v: float, divisor: int, min_value: Optional[int] = None) -> int: """ This function is taken from the original tf r...
596334201287c2d77dafa97208678ca8d69a79e41aaaea91bfc7b79ed42a9a44
Python
6,612
205
import json import os.path import random import dash_bootstrap_components as dbc import dash_renderjson import openai from dash import html, get_app, register_page, Input, Output, State, dcc, ctx random.seed(42) def get_completion(prompt): prompt += "\n\n###\n\n" inference = openai.Completion.create( ...
b627469c7ea77f762259feaaf0bd92a2742fba229333fa7e0fdbf230d175779e
Python
6,613
186
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable def conv3x3(in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): expansion = 1 def __init__(self...
828d949799f72dcbd45177e374704f5581523261b725b159a4f1bc6819a1db74
Python
6,614
176
import ast import glob import logging import os from typing import Dict, Optional import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.init as init from dataLoader.NextXVisit import NextVisit from sklearn.metrics import average_precision_score, roc_auc_score, recall_score, f1_score...
83ae0329a7b268b0fee54ed8e051341b92a3e5a302f5c2accb48a17e0e011bcc
Python
6,614
191
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ...
15b27d134781c155077f821795037b9cec22475bf4951d8a661296dd692d79fc
Python
6,615
129
import csv import itertools import json import uuid from unittest.mock import MagicMock import pytest from NDATools.upload.cli import ValidatedFile from NDATools.upload.validation.api import ValidationV2Credentials, ValidationV2 from NDATools.upload.validation.results_writer import JsonWriter as JsonValidationFileWri...
55c3f114ed15c53b964156bffa7eef8fa5781a3672b3848e638971f249511e89
Python
6,616
167
import numpy as np import torch import torch.nn as nn import torch.optim as optim from typing import Any, Dict, Optional from models.model import Model class He3DCNN_Net(nn.Module): """ MULTI-SCALE 3D DEEP CONVOLUTIONAL NEURAL NETWORK FOR HYPERSPECTRAL IMAGE CLASSIFICATION Mingyi He, Bo Li, Huahui C...
56b3c27509c5fa1be296fa212ac6594fffde9f8d0fc793b086fb46f363e832a8
Python
6,616
149
import copy import os import unittest from hed import schema from hed.models import HedString class Test(unittest.TestCase): @classmethod def setUpClass(cls): cls.base_data_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../data/") cls.hed_schema = schema.load_schema_version(...
5a261446194abe997ad3ba3e52033b57df87d06d2786b681123fc4f8b689aed4
Python
6,616
185
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Script to compute evoked responses and their inverse solution ''' # Append paths proj_name = 'MINDLAB2020_MEG-AuditoryPatternRecognition' wdir = '/projects/' + proj_name + '/scratch/working_memory/' scripts_dir = '/projects/' + proj_name + '/scripts/working_memory/' i...
a3eabb792c191ed142818d67dc9bfac4b694fba8517364ee5e6137f0052b0829
Python
6,616
234
#!/usr/bin/env python import gzip import os import subprocess import sys from datetime import datetime from shutil import which import pysam def run_shell_cmd(cmd): """ Execute a command on bash shell with subprocess. """ p = subprocess.Popen( ["/bin/bash", "-o", "pipefail"], stdin=s...
d633f0c683ec262983d232f4ab030fb910304ea82383f639376a54deb64b3c9b
Python
6,616
198
from __future__ import annotations # built-in import json from collections import defaultdict from copy import deepcopy from importlib import import_module from pathlib import Path from typing import Any, Callable, Sequence LIBRARIES_PATH = Path(__file__).parent / 'libraries.json' class LibrariesManager: libs:...
0bab78dd4a2bcaf929c1945af2070414f9ad43465ce4a97d2ae11564b99f83de
Python
6,617
177
import matplotlib.pyplot as plt import numpy as np from IPython import embed def clean_transfer_data(region, comp, comp2, group): with open(f"txtfiles/avg_transfer_{region}_{comp}_{comp2}_{group}.txt", 'r') as infile: lines = infile.readlines() filename = f"avg_transfer_{region}_{comp}_{comp2}_{gr...
9496002d21fdb4af6fa47e8b84244e3529a439dae6435852d06fb2bd68a44c9f
Python
6,617
152
############ # https://github.com/lessw2020/Ranger-Deep-Learning-Optimizer # This code was taken from the repo above and was not created by me (Fabian)! Full credit goes to the original authors ############ import math import torch from torch.optim.optimizer import Optimizer class Ranger(Optimizer): ...
93923a4bb6c55bb14b50d6d42567d469c7dc1a6ad1f46fee02655006c634145c
Python
6,620
174
import cv2 import numpy as np import os import pandas as pd import shutil from skimage.color import rgb2gray as skimage_rgb2gray from skimage import io from tqdm import tqdm from typing import * from constants import * _DATA_ROOT = '/Users/maurice/phd/src/rey-figure/data/' _TEX_REPORTS_ROOT = os.path.join(ROOT_DIR, '...
b0fc6afd9e8442eda1701c6bda45cb4f335ae2604153dc669dcf6ee6ee164e31
Python
6,620
182
# 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...
32ecf9221b544b579271f24c76bf5b7daec1617227f7b60f4e935130aaad56bd
Python
6,621
171
import argparse from datetime import datetime import json import time import os import ramanspy as rp import unmix def run( scene_sizes, scene_type, num_endmembers, spectral_size, *, replicates, training_epochs, noise=False, baseline=False, ...
eb2248728a02e0407368a4a25391655f965e25cd84dcfa37962e8e0bc25763f1
Python
6,623
156
import numpy as np import torch from torch.nn import Linear as Lin, Sequential as Seq import torch_geometric as tg import torch.nn.functional as F from torch import nn from PAE import PAE from layers import general_GCN_layer, snowball_layer,truncated_krylov_layer class graph_convolutional_network(nn.Module): def _...
8a28d0fe324e268f4529dc6ca1bba1b3b511f35bb2d3cf55b51c0523e6916c77
Python
6,624
146
extensions = dict( required_params=['training_frame', ('cols', "NULL")], validate_required_params="", set_required_params=""" parms$training_frame <- training_frame if(!missing(cols)) parms$ignored_columns <- .verify_datacols(training_frame, cols)$cols_ignore """, set_params=""" # Check if user_y i...
50f3840c8cce400ee35e570186fbb192f149ee615a8edc1eec15133ee5cf7120
Python
6,625
168
""" Code for neuropixel analysis (output kilosort/phy2) """ # look script_dualPhase3-2.m from http://data.cortexlab.net/dualPhase3/data/script_dualPhase3.m # Also time is ok as Marie says: -1 sec at beginning (- 1 at the end) import numpy as np import pandas as pd from pathlib import Path import os.path import pdb i...
5429d0ac4f2491ec0a6d04650210ac1371361cfd2d4e8f6793ae2d5a5f4ef451
Python
6,626
162
#!/usr/bin/env python from __future__ import print_function import argparse import cProfile import pstats import random import numpy as np from examples.continuous_tamp.optimizer.optimizer import cfree_motion_fn, get_optimize_fn from examples.continuous_tamp.primitives import get_pose_gen, collision_test, distance_f...
54d9a034970bd5a8bef4d5f7353b11665ed42d3b468e2ba329f0bff2726b82bc
Python
6,626
193
# 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...
aff1380d7db5dc5515a58dfdecf41fe1de43b9f96649b834952032b12ce662a1
Python
6,627
163
"""The --atlas CLI choice list is sourced from the live ATLAS_REGISTRY, so every registered atlas (BBP, DevCCF, Paxinos, ... not just the original three) is selectable, while a typo is still rejected rather than silently falling back to Allen CCF (get_atlas returns _ALLEN_CCF for unknown names).""" import os imp...
a0d33661dfb3655bb9ae5c896811576f0daef34027bf1850ba215684b5fd9b8c
Python
6,628
169
from sklearn.decomposition import PCA import numpy as np import scipy.signal as signal import pandas as pd def compute_wavelets(x, actual_sr, n_wavelets, C_min, C_max, morlet_w): ## Computation following Sakamoto # Morlet wavlet by scipy: exp(1j*w*x/s) * exp(-0.5*(x/s)**2) * pi**(-0.25) * sqrt(1/s) # not...
a42729d3ae91bcc6da68887641e009eac6515ef1960cad921c5ffcedb99177bd
Python
6,628
224
import numpy as np from tqdm import tqdm import networkx as nx import scipy.sparse as sp import random from time import time from collections import defaultdict import pickle import warnings # from imblearn.over_sampling import SMOTE warnings.filterwarnings('ignore') from os import error import numpy as np import pand...
eeef36bb2e705df6f92812057d67f04958c67dc091dc1f10f3dc081a047903f0
Python
6,628
189
""" Pipeline for preprocessing EEG data. Prodecure includes the following steps: - Load raw data - Remove bad channels - Set reference and eog channels - Anti-alias filter at 1/3 of the goal frequency - Notch filter to remove power line noise - Segment data while accounting for delay - Decimate data to the goal freque...
9c1d56a9df84bfd12b6e6702f02e79eba2232700289cf21db902c0c0bc8fad8e
Python
6,629
198
import numpy as np import pandas as pd from scipy.ndimage import gaussian_filter from src.file_handling import fname, load_tiff, write_tiff, save_params_json from src.visualization import ( plot_corr_heatmap, plot_ccf, plot_aligned, plot_corrmap, save_dual_movie, save_img, ) from src.processing...
0d29074d440ba2b7d211100a13fa1300450579f667669e1b41be2af2b1db2b0b
Python
6,630
225
import sys import time from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Union if sys.version_info >= (3, 8): from typing import Final else: from pip._vendor.typing_extensions import Final # pragma: no cover from .segment import ControlCode, ControlType, Segment if TYPE_CHECKING: from .c...
2d9eeb19d46aab1fa4ed5b093b800be1a09802ee0931245d00413c30fd5755bb
Python
6,631
156
# Node-group asset "Evaluate on Atoms" (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_CHEC...
9d75c8738c8a3e4335d8dde9e4d98656df0eadd501d3aea60814fe15c43e2c45
Python
6,631
226
from collections.abc import Callable import pytest import elasticai.creator.function_dispatch as FD from elasticai.creator import ir from elasticai.creator.ir2vhdl import DataGraph, Shape, factory from elasticai.creator_plugins.grouped_filter import FilterParameters from elasticai.creator_plugins.time_multiplexed_seq...
bb9680453024ef36be161c44184ffc9e9a44361075838698f23a546743d8d52c
Python
6,632
200
from typing import Optional, Callable, Tuple import torch import torch.nn as nn from src.models.utils import conv_block, fc_layer __all__ = ['get_reyclassifier'] class ReyClassifier2(nn.Module): """ binary classifier, designed to predict whether or not a given item is present in the rey figure """ ...
f3e63c9af8d25bfc54f88d7acd0861d177c32d279441dd3929d09a0540959018
Python
6,632
175
""" Superimpose one molecule onto another. The fit is done with biotite on the atoms in Å, in each molecule's own local frame, and applied to the mobile molecule's Blender object as its world matrix. The coordinates themselves are left untouched, so the alignment can be undone, moved by hand afterwards and survives tr...
fc8c7a4d3c18bbac85b3579d0cae640c522813a5d74ee4cb9628b37100a1adc8
Python
6,632
198
from pathlib import Path import numpy as np import torch from torch import nn from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.MPQ.matrixmulti import MatrixMulti from elasticai.creator.nn.integer.MPQ.scaleddotproductattention.design import ( Scal...
ff3ba4f19a4aff1ddf696bdd7a9972d16cbc4630a7fe08addfbb1837938f29de
Python
6,633
205
# 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...
61037b15e1dc041950e11c2bba16279e3983295ae1b428a79e31e64e57120d09
Python
6,636
186
# 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...
9e714d8dc471e01453580934d5f61a49e20e5d1c4bac50a4502a4ee000aaa461
Python
6,636
254
"""Utility functions for dealing with dictionaries.""" from __future__ import annotations import logging from collections.abc import MutableMapping from copy import deepcopy from pathlib import Path from typing import TYPE_CHECKING from monty.json import jsanitize from monty.serialization import dumpfn from quacc.w...
2c89c6814ed7a6e0116e0a6e3f2c2a1f6acb9f06d261bdb65f085972dc694953
Python
6,640
173
# Import necessary libraries import os import torch import numpy as np import matplotlib.pyplot as plt from PIL import Image import imageio # Import imageio for GIF creation # Enable automatic casting for mixed precision training with CUDA torch.autocast(device_type="cuda", dtype=torch.bfloat16).__enter__() # Check ...
cbc32b121b14822ac569b38c44b11be1cbe0f3aa882dc33066220e2839bd1055
Python
6,641
150
import os import re from copy import copy from typing import Dict, Tuple, Union import numpy as np import pandas as pd from sklearn import model_selection from torcheeg.datasets.module.base_dataset import BaseDataset class KFoldCrossTrial: r''' A tool class for k-fold cross-validations, to divide the trainin...