sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
11b62bfde999b15b045499081e60f839d1fb186418feb9c51e815402ed4e6763
Python
8,337
187
""" converts electrode (or for that matter, any point) coordinates in MRI space to coordinates in freesurfer mesh space. Requires subject ID to find coords data (in electrodenames_coordinates_native_and_T1.csv) and the two matrices Norig and Torig which can be obtained using mri_info Run: python voxcoords_to_fs.p...
5efd985be5f65a7e8c797c1cab72190434b9a81c50718e25ce8741f5eb275b54
Python
8,337
226
import os import shutil import tempfile import argparse import datetime import json import time import numpy as np import matplotlib.pyplot as plt import torch import torch.nn.functional as F from monai import transforms from monai.apps import DecathlonDataset from monai.config import print_config from monai.data impo...
7b5c5bc04d300408d5add06f55e85a33a517a27773be5973621e656eb27d9047
Python
8,337
270
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Define ParameterSpace for benchmarking of scaling with different MPI pools ''' import os import numpy as np import operator import pickle import hashlib import parameters as ps def sort_deep_dict(d): ''' sort arbitrarily deep dictionaries into tuples Argum...
f0778e3b962e988c436e42e762bf3e69d17d7f0139558ab334de293e4b9efccb
Python
8,337
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...
933e6b26729937bea96c5dc50284196b68f0a425fc2a4d2f72d5a6273b67a28d
Python
8,339
231
import os import tempfile # Importing bpy prepends the user's Blender extension wheels (e.g. # ~/.config/blender/*/extensions/.local/site-packages) to sys.path, shadowing # this environment's packages with whatever the enabled extensions ship - # including possibly incomplete copies while an extension is being rebuilt...
137a7f63e2df4ca23a9cd2b75414af7599782d63e0e30ac600e50b6c00606fb4
Python
8,340
198
import torch import torch.nn as nn from torch.nn.functional import softmax from pywebio.platform.tornado import start_server from pywebio import STATIC_PATH from pywebio.input import file_upload from tornado.ioloop import IOLoop from pywebio.input import * from pywebio.output import * from ipywidgets import Bu...
c1944522a88151d2c773455a125cf9fec86499970381510076186ce83b4b8c55
Python
8,340
198
''' Description: Compare model predictions of six scRNA-seq datasets. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import copy import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import scanpy from plotting.__init__ import * from plotting.PlottingUtils import computeVisEmbeddin...
fdca89b121fadda4b56e06ec631f43487edcaa8382e5d688209ba1d4aa1c431c
Python
8,346
247
import torch import torch.nn as nn import torch.optim as optim from torch.optim.lr_scheduler import ReduceLROnPlateau class TrivialEncoder(nn.Module): def __init__(self, input_size, hidden_sizes, output_size): super(TrivialEncoder, self).__init__() # place holder layer does nothing self.l...
d9443bc082a6099a82340c761a35fa2a0bbcdd3350af5b50fe5554e9d70cace6
Python
8,349
213
# MEGIT file IO functions import os import base64 import copy import csv import json import h5py as h5 import zlib import hashlib import numpy as np import cv2 as cv import warnings """Function list: # Video IO functions img2vid(img_list, vid_name, fps=30, vid_path=None): Create a lossless AVI v...
0f7d49b0082274b3104c814c287188aa2f79e4cc6c8b0cbeb4ee602b58aa3090
Python
8,350
201
""" 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 wx import deeplabcut import os,sys,pydoc media...
504d8e1e77632a1b27161edb9674ebf41489fe77173f959d03b37667a9ff4645
Python
8,350
184
"""Region list/tree mixin for the CCF boundary editor. Carries the flat region-list and hierarchical region-tree widgets: building their rows from the current slice + atlas hierarchy (``_refresh_region_list``, ``_refresh_region_tree``), the tree's click/context-menu handlers, and the flat-list click handler that ...
341f42350aa70fd703fb63cb40e187409c0b4049e53781443c649667e7007ed4
Python
8,351
163
from pddlstream.algorithms.downward import fd_from_fact, substitute_derived, is_applicable, apply_action, \ fd_from_evaluation, task_from_domain_problem, get_problem, get_action_instances from pddlstream.algorithms.reorder import separate_plan, get_stream_stats, dynamic_programming from pddlstream.algorithms.schedu...
8f3ba23ee740fa50535a5a498d0c58b69914cc7b4a30ba078586237e7f0d756e
Python
8,351
190
""" 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 os from pathlib import Path import cv2 from dee...
6c6537b2115b549e2fa2bc28f0105158d6e90462dd2568296ae8b3cc34324da4
Python
8,352
229
""" Implementation of multi-variate EMD according to: N Rehman and DP Mandic "Multivariate empirical mode decomposition" Proc. R. Soc. A (2010) 466, 1291-1302 doi:10.1098/rspa.2009.0502 """ from __future__ import division, print_function import copy import numpy as np from scipy.interpolate import splre...
47711f5012fb0ffe4e5a571b256452a648bd60e506c9c0b90070afbf560f0415
Python
8,353
199
import numpy as np import torch from torch import nn from torch.nn import functional as F from torch.autograd import Variable from inv_vae.models.graph_conv import GraphConv class VAE(nn.Module): ''' graph auto-encoders. ---- inputs: ---- outputs: ''' def __init__(s...
5ec7c68c82a7fe3870df30c56c8ddb7370cdadc357a49512bdd964ee93d65b70
Python
8,353
195
from __future__ import annotations from shutil import which import pytest DFTBPLUS_EXISTS = bool(which("dftb+")) pytestmark = pytest.mark.skipif(not DFTBPLUS_EXISTS, reason="Needs DFTB+") import os from logging import INFO, getLogger import numpy as np from ase.build import bulk, molecule from quacc import JobFai...
d47ccb3d5155bec715502fd92bfd344ebbe935c880a3c4e38b409adeac62eb9c
Python
8,353
207
# Step 1 of 4: Create k-dimensional bins of neurons, using k selection paramaters and a kd-tree # Number of bins is dependent on configuration file, which specifies bin size # Number of bins is 2^n for the smallest integer n such that 31346/2^n <= (bin size) ## ## Load packages ## print('Loading packages', flush=Tr...
737313e47f1fe014e730cdb938972dbf830dcd32bebe49c4ece5ada7e6726162
Python
8,355
216
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, accuracy from src.utils import timestamp_human class ClassificationTrainer...
56c51153b2b9c792e8c1cd0115b644b61223792e9dc9d247e174d98bc88f9b3f
Python
8,357
175
import dsmil as mil import torch import torch.nn as nn from torch.utils.data import DataLoader import torchvision.models as models import torchvision.transforms.functional as VF from torchvision import transforms import sys, argparse, os, glob import pandas as pd import numpy as np from PIL import Image from collecti...
c5008290eb42c90502e90c5da56dc245ed2f79fdb52148dce86c5b8ec978a754
Python
8,357
129
"""Paired fixed-context measurements, controls, and cross-prompt persistence.""" from __future__ import annotations import hashlib import json import logging import os import time from pathlib import Path import numpy as np import torch from .connectome import load_graph, sha256 from .environment import inspect_environ...
0c8ae7f38c7c1964c024d47ef27ef314fb0adbad62b5c7d3716131341536e477
Python
8,359
177
"""Maintainer-fitted midsagittal planes, committed to the repository. No fit ever runs on a user's machine. The maintainer fits each atlas once, inspects the result, and commits the parameters to ``planes.json`` beside this module; users get them with the repository. ``scripts/fit_hemisphere_planes.py`` is what d...
54d8a69c74af7bc0ffb52f958707d70854f7e5768547fbe7d1a575f838227c63
Python
8,360
166
import numpy as np from sklearn.metrics import precision_score, recall_score, f1_score from matplotlib import pyplot as plt import tqdm import os from sklearn.metrics import confusion_matrix def contingency_analysis(gt, pred, num_clusters, num_classes, unknown_value = 0): # gt: 1-dim array of integers, ground tr...
64adb32341f50696768459105d09d8696ff92a895a9149460b60ba0898fa0d18
Python
8,362
193
from __future__ import print_function import time from itertools import product, islice from random import choice from dimensions.common import BOWLS, CUPS from learn_tools.active_gp import STRADDLE_ACTIVE_GP, VAR_ACTIVE_GP, BATCH_MAXVAR_GP, BATCH_STRADDLE_GP from learn_tools.active_rf import BATCH_STRADDLE_RF, BATCH...
dc59a64ee390acbb48a43f7d096d086a080bc89d343ccd9e82d8a1e60edc5dff
Python
8,365
281
# # 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,...
1618a28fbee1ec200bc120341f97adfbe729fadfa35fe0c51efaea401fdc63e9
Python
8,367
208
from typing import Callable, Sequence, Dict, Union import numpy as np from ..base_transform import EEGTransform class Concatenate(EEGTransform): r''' Merge the calculation results of multiple transforms, which are used when feature fusion is required. .. code-block:: python transform = Concate...
8d1cad8cd82ca38ee6457b3a42c8b277a518e791ac142a1964ec2153f4b7c70c
Python
8,368
190
import os import numpy as np from pandas import read_csv, DataFrame from pyrelimri.icc import sumsq_icc def triang_to_fullmat(corr_1darray, size: int): """ Convert a 1D array representing the lower triangular part of a correlation matrix (including diagonal) into a full NxN correlation matrix. Parame...
7998c32804465e770c8578af33af3e19e8c047a22f628b7d000c085e14663c09
Python
8,369
247
""" Tensorflow Hub Object Detection. | Copyright 2017-2022, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ import csv from pathlib import Path from PIL import Image import tensorflow as tf import tensorflow_hub as hub class TensorFlowHubDetector: """Object Detector wrapper class that simplifies use...
81071dd9b26b52cd5c245fe3258c2128532197925ab536a9bb9a4708edd7a915
Python
8,369
243
import os from sklearn.metrics import roc_auc_score from tqdm import tqdm from torch.utils.data import DataLoader from torchvision import datasets, transforms import torch import torch.nn as nn import pandas as pd import os import time import random import torch.nn.functional as F import numpy as np from mpl_toolkits.m...
0eb0b581e1cc51ef4fa6afa8c61949ac1fea46d45daff36af7ff710360274434
Python
8,370
174
# ------------------------------------------------------------------------ # # 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 # # Unle...
ac79f01289a3b0b824b1ff9c508521018299f041c2c06a2c2ace0058450cf7f5
Python
8,372
199
"""""" """ 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...
d596b75e2b695b0c855116b81f43d26dac91bfed6bfc75f643b84c673e3a8aa1
Python
8,372
128
"""SFF_GENERAL.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29-SFF-GENERAL.md Can the LN signs be read back from a PN recording in general? Four hidden truths (the laboratory prior + 3 random), one search (ESCALATE: single-type sweeps, pair moves among the 20 largest types when stuck), started from the cl...
39faa954c7baab727732098ec137bdbe591be66e63d5efe63bf557d5ad1339b1
Python
8,373
227
#!/usr/bin/env python """Utility classes to parse SAMPL submissions.""" # ============================================================================= # GLOBAL IMPORTS # ============================================================================= import os import io import glob import numpy as np import pandas a...
17a1196ad464fe7124212c10e1442ebbbec28230434c2afda5b5d88f65f497b8
Python
8,376
136
#!/usr/bin/env python from __future__ import division, print_function import argparse import sys import numpy as np import topaz.denoise as dn from topaz.cuda import set_device from topaz.denoise import Denoise, denoise_stack, denoise_stream from topaz.denoising.datasets import (make_hdf5_datasets, ...
5df8384660bdf60f2067c5b15ac7a7676805c4248005f22d3f3d71edb99978a1
Python
8,377
240
# # 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,...
5093df8bb1603ee143d02285dc9d601de315b57dc00da71f4ef8465499af2ec1
Python
8,378
135
# 20230503 import os import datetime import argparse import random import numpy as np import torch import logging import logging.config class OptInit(): def __init__(self): # dataset parser = argparse.ArgumentParser(description='PyTorch implementation of EV-GCN') # dataset ...
9f7bea80ef568745f5cccc8dcfbe568574e313c0f5f51e58a19ce641512e4581
Python
8,379
231
""" (*)~--------------------------------------------------------------------------- Pupil - eye tracking platform Copyright (C) 2012-2020 Pupil Labs Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0). See COPYING and COPYING.LESSER for license details. ------------------------------------...
4e41beea3327548e1d78283919f82cb9b658fcc9abccf53360e74d0dd51e3501
Python
8,382
202
""" DenseNet121 Difference from densenet in torchvision for higher resolution: 1. Modify the stride of first convolution layer (7x7 with stride 2) into 1 2. Remove the first max-pooling layer """ import re import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as model_zoo fr...
794fecd91d87a98f61d9baddc2725d6535ccb15479917d6bdc2dcdd104b5fbed
Python
8,382
175
import logging import math import pathlib import traceback from typing import List import botocore from boto3.s3.transfer import TransferConfig from tqdm import tqdm from NDATools import exit_error from NDATools.Utils import get_s3_client_with_config, deconstruct_s3_url, get_directory_input from NDATools.upload.batch...
04bc885c8ac159c28f12966f3b73fee2246e1ea24cea95109d09d7ba3b90563a
Python
8,384
231
#!/usr/bin/env python # -*- coding: utf-8 -*- from figure_10 import fig_exc_inh_contrib from plot_methods import plotPowers, plot_population, plot_signal_sum_colorplot, plot_signal_sum from cellsim16popsParams_modified_spontan import multicompartment_params import analysis_params import plotting_helpers as phlp import ...
d208c96cade36a9c8a8d60244967b4cae963e1c338abdcfb03d89253ce7cc1de
Python
8,384
233
import shutil, os import subprocess from pathlib import Path from tqdm import tqdm from wsilearn.utils.cool_utils import * from wsilearn.utils.path_utils import PathUtils def subprocess_cmd(command, verbose=False): process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True) print('runnning cmd %s...
1ecdd6ea0a22e58013d78edff7634aacc1026af7fb07ff4dcd2025108855256b
Python
8,387
146
"""Identical external injection with and without the external neural cue (real model). Runs the same sampled stream three times with one scheduled injection: cue off, cue on the 16 DA-annotated neurons, and cue on a size-matched random control group. Before the injection the three runs are identical by construction (s...
0bd7c353a71ad9d27ae7a8d52b5c42480a968d2a0f956404afb381dcdcb5ea2f
Python
8,389
219
deprecated_params = dict(Lambda='lambda_') def update_param(name, param): if name == 'lambda': param['ptype'] = 'numeric, [numeric]' param['dtype'] = 'Union[float, List[float]]' return param return None # param untouched def class_extensions(): def rule_importance(self): ...
1387638ad2845575a8fcd598301da40f9ec9c6c8c57760f09e4134bfc9df1281
Python
8,389
254
from __future__ import annotations import gzip import logging import os import shutil from pathlib import Path from shutil import copytree import pytest from ase.build import bulk from ase.io import read from cclib.io import ccread from maggma.stores import MemoryStore from monty.json import MontyDecoder, jsanitize ...
861f3ed43832f879cc0ef82b0f3fc8d7d892f50a8cdb4b50eebf4f3877e917fe
Python
8,392
200
""" 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 Added with: Pretraining boosts out-of-domain robustness fo...
304b2ebc786f3e9b896fc11b2ca00c1b300832ff71318595709b077099cf9822
Python
8,395
230
# A module to perform GUI-tasks outside a GUI import numpy as np from pyclamp.dsp.dtypes import * from pyclamp.dsp.fpfunc import * def rescale(x, xlo, xhi, Xlo = 0., Xhi = 1.): dx = xhi - xlo if dx == 0.: return x return Xlo + (Xhi - Xlo) * (x - xlo) / dx class xygui: X = None Y = None x = None y = Non...
db0c5dccdc8ef1d3ef235297e911de900be1bb69da5a88bd34ee05ed01449d9e
Python
8,395
271
from dreamcoder.domains.arc.arcInput import num_to_id, load_task from dreamcoder.domains.arc.arcPrimitives import Grid, Input from dreamcoder.domains.arc.arcPrimitives import primitive_dict as p from dreamcoder.domains.arc.main import ArcNet from dreamcoder.task import Task import numpy as np import random import torch...
87ffe1599cfeab145ccbd6c224fb6677318118be234bda13292c2a5a031fdf96
Python
8,397
262
import math import torch import torch.nn as nn import torch.nn.functional as F from einops import rearrange import os from timm.models.layers import trunc_normal_ import numpy as np from segm.model.vit import PatchEmbedding from segm.model.blocks import Block, FeedForward, CABlock from segm.model.utils import init_wei...
32477b2382004f6eb5869fd76941bc5fbe01c2f5578f4c866249987f42a389d5
Python
8,398
304
#!/usr/bin/env python3 from argparse import ArgumentParser from os import environ from pathlib import Path from shutil import copyfile, rmtree from ssl import create_default_context, CERT_NONE from subprocess import run from sys import exit from urllib.request import urlopen from zipfile import BadZipFile, ZipFile p...
4f61d0751e9eddc6387fe090c8868325e1611f4021a69c8a86fa8162322a6d24
Python
8,398
249
from __future__ import annotations import glob import logging import os from pathlib import Path from shutil import rmtree import numpy as np import pytest from ase.build import bulk, molecule from ase.calculators.emt import EMT from ase.calculators.lj import LennardJones from ase.io import read from ase.optimize imp...
69276e4d38d7963b34395b5d39eab68b18ac2bfbee6b655bd15826e600fc4e79
Python
8,398
231
# 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...
e87b4e0e45b1fd11e116401aa4a88bd3bc3ea4fd6c6e0a9c7b64f175bb6969f5
Python
8,398
230
import numpy as np from jitcdde import input as system_input from symengine import exp from ....utils.stimulus import OrnsteinUhlenbeckProcess from ..builder.base.constants import EXC, INH from ..builder.base.network import Network, SingleCouplingExcitatoryInhibitoryNode from ..builder.base.neural_mass import NeuralMa...
efbb51bed5e7a943d6a7cb0300334d7df60bc01bddefbc83bfe7bc87f58deaf1
Python
8,399
194
def class_extensions(): @property def baseline_hazard_frame(self): if (self._model_json is not None and self._model_json.get("output", {}).get("baseline_hazard", {}).get("name") is not None): baseline_hazard_name = self._model_json["output"]["baseline_hazard"]["name"] ...
43f1c5519b96fa2b5f7189a4f63904a1fadcaffcc2a7315a16d1c615f3d2991a
Python
8,402
275
#!/usr/bin/env python # -*- coding: utf-8 -*- # # pymrmr documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # auto...
9d8e3e7f7e6f896d66e1ffe8a320524a8f5f77597e45a7a8e01f98dbec921482
Python
8,408
228
import os import os.path as osp import numpy as np import torch import pandas as pd from torch_geometric.data import InMemoryDataset from torch_geometric import data as DATA from rdkit import Chem from rdkit.Chem import MolFromSmiles import networkx as nx from rdkit import Chem from rdkit.Chem import ChemicalFeatures ...
a73a0904cc8b5a1d601074a1d84d42127f38e77fefa0f1ff76e52f50f48a4ca4
Python
8,408
160
# Copyright (C) 2019 by Computational Science Lab, UPF <http://www.compscience.org/> # Copying and distribution is allowed under AGPLv3 license # # This script generates 3D voxel-based molecular representations from ligand PDB files. # It uses the RDKit library for chemical processing, MoleculeKit for voxel descriptor ...
bf7c1ed5bca6b6abc4fa3ffbc824a76f86b4272df6b37cf548b67317dd4da636
Python
8,409
237
"""distutils.command.install_lib Implements the Distutils 'install_lib' command (install all Python modules).""" import os import importlib.util import sys from ..core import Command from ..errors import DistutilsOptionError # Extension for Python source files. PYTHON_SOURCE_EXTENSION = ".py" class install_lib(C...
22b1ac24057be78f7d16abbee2b76ce815b0c9150b2b48466702b088465a6e78
Python
8,410
219
# Import necessary libraries import os import torch import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Button 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...
a04d55061a61356f86f93eb44803c87fc030cf9ec18c3b71a5ce6524178090e9
Python
8,411
184
import pandas as pd import os from tabulate import tabulate import matplotlib.pyplot as plt from src.analyze.utils import init_mpl from src.utils import map_to_score_grid from constants import DATA_DIR, SCORE_COLUMNS from src.preprocessing2.process_ratings import merge_rating_files COLORS = init_mpl() RATINGS_COLUMN...
6e08da535cb563cab3ee5a475a7f92d6cb27368afa2223a78b309ed340fd364a
Python
8,412
292
import numpy as np import numba from ...utils import model_utils as mu def timeIntegration(params): """Sets up the parameters for time integration :param params: Parameter dictionary of the model :type params: dict :return: Integrated activity variables of the model :rtype: (numpy.ndarray,) ...
3b511b20967136b3e10b2ef313e04df0aa6db5ce4d5ab9de31121de9ad8bf472
Python
8,413
155
import numpy as np import nibabel as nib import h5py import os import pkg_resources from .multregconn import * from .corrcoefconn import * from .pc_multregconn import * from .. import tools dilateMM = 10 partitiondir = pkg_resources.resource_filename('ActflowToolbox.dependencies', 'ColeAnticevicNetPartition/') defaul...
886c09719f81ac43e7a830d34a32bc22ff882da54fb2be315c9025c2231213be
Python
8,414
253
# 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...
b82388935107b7ce9a1188517af81c118db98da41f6778dc2edf75c5085edbd0
Python
8,419
285
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Fit Tensor Factor Regression model Training Created on Thu Dec 13 2019 @author: jmagraner """ #%% SLURM custer scheduler specs # As we are submitting a large number of jobs, add these lines before importing # anything to enforce SLURM resource allocation, since set...
75c3829c646fac8a02df5ec8be26c8ec9cfb907cf75a3e6e4aaf073f8552377b
Python
8,421
283
import operator import os import random import sys import dask.array as da import dask.dataframe as dd import joblib import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from dask.distributed import Client from sklearn.ensemble import RandomForestClassifier fro...
f0ef2296f10a3e2b0cf2b2dbd900e27a37458cdf9130a559bd0bca054a1941aa
Python
8,421
223
"""Interface class for acquisition parameters.""" import json import logging from collections.abc import Iterable from dataclasses import asdict, dataclass, field from pathlib import Path from typing import Any, Optional from console.interfaces.dimensions import Dimensions from console.interfaces.enums import DDCMetho...
fba52b083d3fe4445af1af31282434f0f1e87669a474dd7528a309e781120ce3
Python
8,421
231
"""Graph encoders.""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import manifolds from layers.att_layers import GraphAttentionLayer import layers.hyp_layers as hyp_layers from layers.layers import GraphConvolution, Linear, get_dim_act import utils.math_utils as pmath from N...
14b5bb397de438cd6581de4412927e3accca03dcfc10b5bc2f20c89fef3883d7
Python
8,423
203
""" DenseNet121 Difference from densenet in torchvision for higher resolution: 1. Modify the stride of first convolution layer (7x7 with stride 2) into 1 2. Remove the first max-pooling layer """ import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as model_zoo from collect...
12adc7d580df052ee6e19fd2448ca4ff5e9914c74690333c5f883890b0bce7ef
Python
8,425
203
''' Script to plot statistical analyses of source localized decoding patterns ''' import mne #%gui qt #import matplotlib #%matplotlib qt from nilearn import datasets from nilearn import surface from nilearn import plotting from nilearn.plotting import plot_stat_map from nilearn.image import index_img fsaverage = dat...
6a3ced387fbd23b280ff8c2a0d8ca0b476bac54055660169999f0513be071c72
Python
8,425
329
import io import posixpath import zipfile import itertools import contextlib import sys import pathlib if sys.version_info < (3, 7): from collections import OrderedDict else: OrderedDict = dict __all__ = ['Path'] def _parents(path): """ Given a path with elements separated by posixpath.sep, gen...
91e2fad4e01ad8af10832878193fc018f763b22c07d8a622d694b69483897c9d
Python
8,426
216
import argparse import random import sys import numpy as np import os import pandas as pd from tabulate import tabulate from tqdm import tqdm import torch from constants import BIN_LOCATIONS1, BIN_LOCATIONS2 from old_code.dataloaders import get_regression_dataloader_eval from src.training.train_utils import count_par...
bbcdd535bdb82fde02380643daf45a9eebab60c018b778ac6b45c795d42e36af
Python
8,426
237
#!/usr/bin/env python3 """Convert ring-fragments.txt and rigid-fragments.txt into compact C headers. Reads: data/ring-fragments.txt -- SMARTS pattern + xyz lines per fragment data/rigid-fragments.txt -- SMILES + (atomic_num, xyz) lines per fragment Writes: data/ringfragments.h data/rigidfragments.h Each h...
612a5f2e1536a3310dbab79712a509098ccc97dc9968ab6a5fdb113a34d2be54
Python
8,428
269
import os import multiprocessing from collections import defaultdict import torch from torch import distributed as dist cpu_group = None gpu_group = None def get_rank(): """ Get the rank of this process in distributed processes. Return 0 for single process case. """ if dist.is_initialized(): ...
a0c730820d4f575494ac87aad1205c9c7e7f866ecb08bf1eb89bb71109f4fc78
Python
8,429
200
"""Preparing the LEMON EEG data [STEP 1] Preprocessing sensor space data NOTE: This script was adapted from Quinn2022_GLMSpectrum `lemon_preproc.yml`. """ # Install dependencies import os import glob import mne import logging import numpy as np from scipy import io from pathlib import Path from osl import preprocessi...
eaab247b91f2023cc35954ac8dd9c130f6271fb1d76b0ff2cb34c23736412c27
Python
8,429
248
""" Estimation module: This module contains functions to estimate the model """ import numpy as np from itertools import compress import random from scipy.optimize import minimize from TaskAgent.EnAgent import Agent from TaskAgent.en_task_agent_int import task_agent_int import matplotlib.pyplot as plt from TaskAgent.E...
43cd63917e7f887097a4254968175dc853f63b65ccf6f97a3077b8ea6127aa4c
Python
8,431
285
from __future__ import annotations from pathlib import Path import pytest from ase.atoms import Atoms from quacc.calculators.espresso.espresso import Espresso, EspressoTemplate from quacc.calculators.espresso.utils import grid_copy_files, prepare_copy_files def test_grid_copy_files_non_gamma(): directory = Pat...
363bc4df8aff615692cd452683aa20a686ffc638c22c2943ad21ce3a730dcee1
Python
8,432
236
# 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...
6e0778ce1d284dbe5f794e994b1fcaadbb61deb040576ed42df65020966c8c90
Python
8,440
223
############################################################################### # # # ############################################################################### import numpy as np import os, csv import matplotlib.pyplot as plt from numba import types from numba.typed import Dict from scipy.signal import find_peaks...
b4902b340b149e6f92071fca80f1556347a8ed5826a6b347fd7972fb1e0a9e9d
Python
8,441
244
# Node-group asset "Starfile Instances" (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_CHE...
79e59d5a6c59bb32927808758ea0ff40ae22334a5008eb98ec9a25636dce4955
Python
8,444
195
#! /usr/bin/env python from __future__ import print_function import itertools import normalize import pddl import timers REDUCE_CONDITIONS = True # caelan: speeds up instantiation class PrologProgram: def __init__(self): self.facts = [] self.rules = [] self.objects = set() def p...
4d505dcfdf568a725248327ababfd8d433d7ae1ed626f372edd37ae62fea64ad
Python
8,445
188
import torch import torch.nn.functional as F from utils import setup_logger, load_dataset, feature_generator, adj_polynomials, l2_reg_loss, cluster_infer, cluster_number, \ to_sparse_tensor from sampler import get_edge_sampler from model import PolyGCN from loss import BerPossionLoss import stopping from optimizer ...
7a70434cd24a2e35401612c9776e9fad795c321aaeff97e2321961e6c420ed4b
Python
8,447
165
""" Tests for the login flows (bot password, clientlogin, OAuth) against the simulated MediaWiki API. Both the happy paths and the failure paths are covered, without any real credentials or network access. """ import pytest from wikibaseintegrator import wbi_login from wikibaseintegrator.wbi_helpers import edit_entity...
19828f46fec2a63db5d9fa49bbe5f89eb045185a63bb2ba9faedf8ba5d570dfd
Python
8,448
160
import matplotlib.pyplot as plt import matplotlib.ticker as plticker import numpy as np import os import pandas as pd import seaborn as sns from typing import List, Tuple from constants import * from src.utils import assign_bin from src.analyze.utils import init_mpl colors = init_mpl(sns_style='ticks', colorpalette='...
3102ee7013ebcf91bca4bf6b8360661c4afbf114fbb1bb359e56d50061572bce
Python
8,449
210
import filenames import read_files import numpy as np ANOMALY_WINDOW_SIZE = 'NAB' NORMALIZE_METRICS = True ADJUST_ANOMALIES_POSEDGE = True ROUND = 3 def calculate_anomaly_detection_metrics_main(dataset_filename: str, result_filename: str, detector: str, data_dir: str = ...
4022517ba17c086ca36fb853d64dc262cd254ae7320ebcf5fb9aae239592b634
Python
8,450
285
from __future__ import annotations import gzip import os import time from logging import DEBUG, WARNING, getLogger from pathlib import Path import pytest from quacc.utils.files import ( check_logfile, copy_decompress_files, find_recent_logfile, load_yaml_calc, make_unique_dir, safe_decompress...
fb4c253ebcf991348bedd4dc5cb135e4da6c34ac8e6c5cdec8c241cd75397842
Python
8,452
220
from itertools import chain from typing import List, Tuple import numpy as np import pytorch_lightning as pl import torch import torch.nn as nn import torchmetrics from torch.utils.data import DataLoader from ..classifier import ClassifierTrainer, classification_metrics class DualDataLoader: def __init__(self, ...
04e0f31047e1c333123175bd7b15f5c01a2eb388984cf6fd1357896a03ad995b
Python
8,453
199
import torch import numpy as np from model.HighResNet.model import HighResNet from lib.utils import masked_MAE, masked_RMSE, masked_MAPE import pytorch_lightning as pl from model.RNN.model import Teacher from model import const class Supervisor(pl.LightningModule): def __init__(self, adj_mx, scaler, hparams, dp...
72e47f3626d507cd1f628d9bd7550bcc895c81b4172fc4ed7c50531e00a092d7
Python
8,456
232
import torch import torch.nn as nn from transformers import BertPreTrainedModel, BertModel class BertSiameseForSequenceClassification(BertPreTrainedModel): def __init__(self, config): super().__init__(config) self.num_labels = config.num_labels self.bert = BertModel(config) self...
ca230f1dad31c5f55c0fc3cf315cd3823355cb8be8fb08847f4cd07105af6888
Python
8,456
212
import argparse from datetime import datetime from pathlib import Path from warnings import filterwarnings import lightning.pytorch as pl import pandas as pd import torch import yaml from lightning.pytorch.loggers import CSVLogger from tqdm import tqdm from dataset import TCGA_Program_Dataset from datasets_manager imp...
a122183a9e7a0a036c5341ccf3626bf288add9759df7ce2b1f8032f0c224b122
Python
8,458
217
"""Qualitative comparison of dynamic M/EEG resting-state networks """ # Set up dependencies import os import numpy as np from sys import argv from osl_dynamics import analysis from osl_dynamics.inference import modes from utils.data import load_data, save_data, load_order from utils.visualize import DynamicVisualizer...
6f67eaf659fcec252f3fd30c1b4977e3820d281363486a93ab6ed2a683c18338
Python
8,461
261
"""Module to detect arousals """ from logging import getLogger from numpy import abs, argmin, asarray, hstack, mean, sum, vstack, where, zeros from scipy.signal import spectrogram try: from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QProgressDialog except ImportError: pass from .spindle import wi...
90d20870e79591f82e69364002264ae7f96d3a3f37b24f2e4195458adccc20f6
Python
8,463
198
"""Multi-slice propagation mixin for the CCF boundary editor. Carries the two cross-slice propagation commands: translation propagation (``_on_propagate_active`` -> ``_propagate_to_slice``), which applies the active component's net centroid shift to neighbouring slices with linear falloff and same-hemisphere matc...
e8cbae69357e9eb3bcacdd0e8e1fbe56337dd8f2ef9ff9fb7984f7d84df790ed
Python
8,463
249
from typing import Iterable, List, Tuple import numpy as onp import meep as mp from . import ObjectiveQuantity # Meep field components used to compute adjoint sensitivities _ADJOINT_FIELD_COMPONENTS = [mp.Dx, mp.Dy, mp.Dz] _ADJOINT_FIELD_COMPONENTS_CYL = [mp.Dr, mp.Dp, mp.Dz] # The frequency axis in the array retu...
454cb25f4f6d36fdb400a67992ed32a42ee59d833d724d1356ac1282919229cb
Python
8,465
243
import numpy as np import torch from torch import nn def _crop_tensors_to_match(x1, x2, axis=-1): dim_cropped = min(x1.shape[axis], x2.shape[axis]) x1_cropped = torch.index_select( x1, dim=axis, index=torch.arange(dim_cropped).to(device=x1.device) ) x2_cropped = torch.index_select( ...
ddf911a7c165b915a5a1381985fc132e4932382ef2e781b45e4743e5f03e7c03
Python
8,465
266
#https://github.com/sanghvirajit/Medical-Image-Classification-using-CNN/blob/main/Medical_Image_Classification.ipynb #Fixing issues faced during installation of libraries### ## cv2: https://stackoverflow.com/questions/63732353/error-could-not-build-wheels-for-opencv-python-which-use-pep-517-and-cannot-be #pip3 inst...
c1822bc73f029e55b68db8aa56dd79a85d02ae8309f226bafd0a4f2221b3ec09
Python
8,466
214
import torch from einops.layers.torch import Rearrange from torch import nn from torch.nn import functional as F class CausalConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1, ...
eed2c89c7d4a82d29d3472a1e15cb196efe0c620879e9328724ebe998326dfbd
Python
8,467
194
import numpy as np from sklearn.utils.validation import (check_array, check_consistent_length) def _ecdf(data): """ Estimates empirical cumulative distribution function of `data` Taken directly from StackOverflow. See original answer at https://stackoverflow.com/questions/33345780. Parameters -...
be9a82a4ca00040efff2031bc0f28db102b55ddb7b40cc92e5c7ebf08e56644a
Python
8,468
242
"""Convenience functions built on top of `make_vjp`.""" from collections import OrderedDict try: from inspect import getfullargspec as _getargspec # Python 3 except ImportError: from inspect import getargspec as _getargspec # Python 2 import warnings import autograd.numpy as np from .builtins import tuple...
3a9296a1e2976ec18bb5014a1f63c0567a5a7a9917e22046232bc713ec1a6141
Python
8,469
245
#!/usr/bin/python3 # BUGF-Dream 2020 Traning Script by David Jones - (C) University College London 2022 import sys import os os.environ["XRT_TPU_CONFIG"] = "localservice;0;localhost:51011" import time import gc import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim...
5ee8166a3664d765e07513befd268c2f41caf88ce853c993703d074b62c847af
Python
8,469
156
# Collect predictions from glob import glob from pathlib import Path import sys import pandas as pd import numpy as np # sample used #beh = 'crycog_ridgeCV' beh = sys.argv[1] n = sys.argv[2] #opts = '_averaged-source_seitzman_nodes_average_runs_REST1_REST1_REST2_REST2-subs_651-params_FC_gm_FSL025_no_overlap_dt_flt01...
779919cdcadcbeb225a8eb30c0ac1792fd3d328675e77b73085cf359b5c7fd12
Python
8,471
248
#Version 3 from fiji.plugin.trackmate import Model from ij import WindowManager from fiji.plugin.trackmate import Settings from fiji.plugin.trackmate import TrackMate from fiji.plugin.trackmate import SelectionModel from fiji.plugin.trackmate import Logger from fiji.plugin.trackmate.detection import DetectorKeys from...
e648f03f26b6bdccb7c59e35391d2d84f8711f130eb4198d77c5f385c6a3d1bb
Python
8,472
222
from typing import Optional, Dict, List, Type, Any from .base import AtomicModule from ..loss import Loss, MissingValueLoss, ForceScaledLoss, MACEHuberLoss import pytorch_lightning as pl import torch import torch.nn.functional as F import logging log = logging.getLogger(__name__) class LitAtomicModule(pl.LightningM...