sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a51e264e1ef7dfd54c6d78a98007e84b242161fac116363d04dfe291cefb8d92
Python
6,812
178
import torch.nn as nn from torchvision import models # from torchvision.models.utils import load_state_dict_from_url from torch.hub import load_state_dict_from_url from torchvision.models.resnet import BasicBlock, Bottleneck import copy __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', ...
ff64f0686451a47537fd9d717f313e9e1e45dc6b85fc656b82a2109f7b74f347
Python
6,812
167
# 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...
ff0af1c27a430cb9e98511836a3fac0726b44bfc567223548c5bee5ce4b5d6e4
Python
6,813
188
#! /usr/bin/env python # Time-stamp: <2021-03-23 22:02:10 christophe@pallier.org> # License: Creative Commons Attribution-ShareAlike CC BY-SA """ Implementation of Posner's endogeneous attention cueing task (see https://en.wikipedia.org/wiki/Posner_cueing_task) Note: This experiment is meant to be run on FullHD (1920...
3ca196772c45421aa9fc2a13a30923eea974245f0e67a5251a3d33b7fc9aca65
Python
6,814
201
# 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...
1d8ce1ddb0d46f61277e1b8601b1308576f78a49191818ef533faadd1a95d317
Python
6,815
189
import pygame import os from dataclasses import dataclass pygame.font.init() pygame.mixer.init() @dataclass class G: # Constants ASSETS_PATH = os.path.join(os.path.dirname(__file__), "assets") WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) YELLOW = (255, 255, 0) FPS = 60 H...
e7dff93904c929e123a0a4e11323f80a6a93c67a4d71fee2b17c739e16176a60
Python
6,818
217
import glob import os import re from enum import Enum from pathlib import Path import Calculation import matplotlib.pyplot as plt import pandas as pd import Dicts folder = '../../Experimente/' # possible operations: LSF, ESF, CT class Names(Enum): FDG_11 = 'FDG_11' FDG_12 = 'FDG_12' FDG_61 = 'FDG_61' ...
9077577f97e4a9a8cfac39dc3cebaece67059616053a279fc8fa9d67b7466a30
Python
6,819
167
# Publication: "Protein Docking Model Evaluation by Graph Neural Networks", Xiao Wang, Sean T Flannery and Daisuke Kihara, (2020) #GNN-Dove is a computational tool using graph neural network that can evaluate the quality of docking protein-complexes. #Copyright (C) 2020 Xiao Wang, Sean T Flannery, Daisuke Kihara, and...
af2fc402ed72592019e7636cfad0035f25727dca2ed0d4ff747a53510dd4c85d
Python
6,819
156
from typing import List, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from torch.utils.data import DataLoader from ..classifier import ClassifierTrainer class EQLoss(nn.Module): def __init__(self, class_frequency: List[int], ...
209760492227e8dc0416faf37205b60228d41a2e221155ebf0bbcaa0d2c0d33d
Python
6,820
183
# NQS class simulators import numpy as np import scipy as sp import scipy.stats as stats import pyclamp.dsp.discprob from pyclamp.qnp.qmod import * from pyclamp.dsp.optfunc import * from pyclamp.dsp.fpfunc import * def amp2wave(_A, si = 0.001, e = 0.05, T = [-2., 8.], ldc = [2., 1.], sn = None): nd = nDim(_A) A =...
5956c6aaa6caeecd5c549d645ed576c7b5f4b58cef066acb8ab2c4517a040f47
Python
6,820
162
from utils import * class BoundingBox: def __init__(self, imageName, classId, x, y, w, h, typeCoordinates=CoordinatesType.Absolute, imgSize=None, bbType=BBType.G...
9358b9914adf78e46510992c10afd4d1cb67f216ecedb5b1b9f7854a7bce4469
Python
6,821
167
from pydrake.geometry import (ConnectDrakeVisualizer, DispatchLoadMessage) from pydrake.lcm import DrakeLcm # Required else "ConnectDrakeVisualizer(): incompatible function arguments." from pydrake.systems.framework import DiagramBuilder from pydrake.systems.primitives import SignalLogger, Demultiplexer, LogOutput d...
367fb327afc13dfcea4bcdb623e97dc086f6fb1544d4a3a6fc69b938395b127e
Python
6,822
224
import cocotb import numpy as np import pytest from cocotb.clock import Clock from cocotb.triggers import ClockCycles, FallingEdge, ReadOnly, RisingEdge from cocotb.types import LogicArray from cocotb.utils import get_sim_time from elasticai.creator.arithmetic import FxpParams, int_converter from elasticai.creator.tes...
3b1a8a1de570e91c7fe5515e48e2324d1ff8c1e00e67454b91a75ff3556dbfd9
Python
6,822
140
from pddlstream.algorithms.common import add_facts, add_certified, is_instance_ready, UNKNOWN_EVALUATION from pddlstream.algorithms.algorithm import remove_blocked from pddlstream.language.constants import OptPlan from pddlstream.language.function import FunctionResult from pddlstream.language.stream import StreamResul...
3402d6f336496e010bdbf3f7b3836e5ea201ea47f7af31e22e8c57173286f374
Python
6,826
193
from curtsies import Input import co2 as CO2 import co2_controller import temp as Temp import temp_controller import adc as ADC import multiprocessing as mp import threading import i2c as I2C import logger import numpy as np import time import RPi.GPIO as GPIO def check_for_key_press(key_presses): with In...
34fc52af65db5246cea22e31166b09dd5e846565170866ebca36feaa2d6a82a0
Python
6,827
195
import torch import torch.nn as nn import torch.nn.functional as F from ..initializer import create_initializer class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_channels, out_channels, stride): super().__init__() self.conv1 = nn.Conv2d( in_channels, o...
d1cac5be231fb46b88cb30716eebb485592d3878f2cf1a641cd066136c8f3be2
Python
6,827
173
""" Prepare the input for PyOrg analysis package (Tutorial for unsigned membranes) Input: - STAR files for the particles - Surface models - Surface models for simulations - models resolution - Segmentations: + Segmentation paths ...
dbd5b2cdd5520d628af30d2ec6aa6ad63ade3b4b48ab2012325fde293f4f49a9
Python
6,827
204
# 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...
11e525c3eb0e27eb6d87c3acd46906101d4d68e399325332e8b4bc052e0b4b7c
Python
6,828
222
# 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...
1078dc22dce1d8b61b6dccacad762db69c0053c49bf08be13c68a077ec7df144
Python
6,829
206
# 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...
4db205c8103cdb98c8300e4bbef37dc707c816432a10006b079aed1ac8f39d3d
Python
6,829
154
import math import numpy from scipy import stats from OnlineDetectors.online_nab_detector import OnlineAnomalyDetector class RelativeEntropyDetector(OnlineAnomalyDetector): """ This detector is an implementation of online anomaly detection using Relative Entropy statistic with multiple hypotheses as des...
bab801958dea91715fd6066a2a2639e9133841d1d701c32e2b8443b80246984e
Python
6,829
200
""" Optuna example that optimizes multi-layer perceptrons using PyTorch with checkpoint. In this example, we optimize the validation accuracy of fastion product recognition using PyTorch and FashionMNIST. We optimize the neural network architecture as well as the optimizer configuration. As it is too time consuming to...
79ad6ee79fb925a37f6b05a371a1d6b156eb20c6edbf37141d0c159ce43740ef
Python
6,831
178
""" Unit tests for NIfTI creation helpers in regtools.nii_creation.pipeline. Covers: - create_nifti_image - _load_sections_from_multipage - create_nii_images """ import os import tempfile import shutil import numpy as np import nibabel as nib import pytest DATA_DIR = os.path.join(os.path.dirn...
dd983d4e39d8f3d82dcf1536038772c8d05ff64a390f75c1490f38f773bfbf19
Python
6,831
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...
d40dbd9f8ce2beee0854ae8556ae7f605d9206627f670745e97058aa95f65930
Python
6,833
196
from utils import load_dataset, load_snp, null_dist_score1, FilterLCC, load_score from sklearn.cluster import SpectralClustering import pickle from collections import defaultdict import multiprocessing from scipy.stats import norm import numpy as np def sig_score(gene): gene_clust = set(cluster_results[gene]) ...
b4286695ef2a641be7f6fd02e1cecbc1b2ad25f21878b225ed502d81a93b223a
Python
6,834
195
from utils import load_dataset, load_snp, null_dist_score1, FilterLCC, load_score from sklearn.cluster import SpectralClustering import pickle from collections import defaultdict import multiprocessing from scipy.stats import norm import numpy as np def sig_score(gene): gene_clust = set(cluster_results[gene]) ...
835a47cccdb6564e645b878a147a1e0bf970790d42eb222592770652e0d8f71e
Python
6,835
171
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Do stats on timecourses extracted for regions of interest ''' proj_name = 'MINDLAB2020_MEG-AuditoryPatternRecognition' wdir = '/projects/' + proj_name + '/scratch/working_memory/' scripts_dir = '/projects/' + proj_name + '/scripts/working_memory/' import sys sys.path...
9ec1d00d1bc0c193d4a490b67c22d8e8e8f8da303a064d5ba6fb0021185b32c9
Python
6,836
246
# 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...
5814a4a13316792e3b7c49362d109cf15c9fdb5901baeca1ee6cb1a891adee88
Python
6,837
191
import warnings warnings.filterwarnings('ignore') import pandas as pd from sklearn.utils import shuffle import numpy as np import matplotlib.pyplot as plt from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import chi2 from scipy.stats import pearsonr from sklearn.linear_model impo...
7cfd9e5b8eea59746d9bbbb115a732ce6211a178b1efc61a0484327fb8d3b07f
Python
6,838
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...
99ba1db486070df1836062b33d652bb9aee3541df80f2bd0d89af496c77aa0d7
Python
6,839
188
import os import yaml import glob import warnings def expand_config(config): ## accepts a human-generated config dictionary ## and adds in a bunch of entries for access later on config['predictions_dir'] = os.path.join(config['output_dir'], 'predictions') config['temp_dir'] = os.path.join(config['output_dir...
52b5fa3e2e426ad8184b97121ecdeeaadd53eabc6ba6a8efe0bf8cd45a4a07ba
Python
6,840
146
# Main script to carry out the Snakemake rules of TrAnnoScope from snakemake.utils import min_version import yaml import os import sys import argparse import subprocess import logging # Set minimum Snakemake version min_version('6.0') # Configure logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %...
e6ae71384a01bd9b35a9bef8834af2fb039e565c494b37934b9a47ee382526dc
Python
6,840
187
import io from collections import deque from uuid import uuid1 import bl_ext.blender_org.molecularnodes as mn # type: ignore import bpy import matplotlib import matplotlib.pyplot as plt import numpy as np from MDAnalysis.core.groups import AtomGroup from PIL import Image matplotlib.use("Agg") # Annotations are auto-...
c62013288cfbd68aa92517d347924eb88c6488aa8bbd00253346a8e3ad21c596
Python
6,842
226
import os from urllib.parse import urlparse import fsspec import numpy as np import pandas as pd import pandas._libs.json as ujson from flask import make_response from cirrocumulus.envir import CIRRO_DATASET_PROVIDERS try: dumps = ujson.dumps except AttributeError: dumps = ujson.ujson_dumps def add_dataset...
2b4c538005c8326c429d21a60bf2409a965ab5eba80ed60fcf94f1dcdc69f254
Python
6,843
181
#!/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 ...
a575a891f1482c74bcdadec965d7adcc8694f201e21d0fedf2a74c9d6ad5386b
Python
6,844
174
from unittest import TestCase from codex.data.structured_search_filters import parse_search_query from codex.utils.parsing import tokenize_and_fold_for_highlight from codex.utils.formatting import ( highlight_annotations, truncate, nanometer_to_flywire_coordinates, nanos_to_formatted_micros, displa...
dce1af50ec8b9740a7e69b9481f5bb25be7f539c7ab8e7f04f837607c9caa9a5
Python
6,844
189
# Copyright (c) OpenBII # Copyright (c) Lynxi Technologies Co., Ltd. All rights reserved. # Copyright (c) OpenMMLab. All rights reserved. import os, time import torch as pt import torch.nn as nn from torch import ops from torch.nn import Flatten import numpy from ..builder import BACKBONES from ..layers.lif import C...
23846b80bd8207e48a61a16ee1524bc6fb39eb06652a8297c373246ac161995b
Python
6,845
241
# 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...
4c0b6837f89cd8d80bb98d9647ed7889b96ae7dcd676f44b77b58cf1a2f715d4
Python
6,845
192
# part of this script was taken from https://github.com/jocicmarko/ultrasound-nerve-segmentation import argparse from glob import glob import numpy as np from PIL import Image from keras import backend as K from keras import losses from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau from kera...
e70839543e11042d6319aa186ea144015c23b0f1338fca27ce5eacf72a169c88
Python
6,845
207
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from ..initializer import create_initializer class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_channels, out_channels, stride): super().__init__() self.bn1 = nn.BatchNorm2d(in_channels) ...
6afe288973d74525f32816bb3488754f96a0b54a19d758f1b3781bdac709dcac
Python
6,847
158
import os from scipy.io import loadmat import numpy as np import pandas as pd import torch from sklearn.model_selection import train_test_split from datasets.SequenceDatasets import dataset from datasets.sequence_aug import * from tqdm import tqdm from itertools import islice #Digital data was collected...
c7925e53d5210d06c7c74e1de576ae9a68869cd1610bedc2b532ee8653eedf2d
Python
6,847
207
import numpy as np from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.validation import check_X_y, check_array, check_is_fitted from sklearn.utils.multiclass import unique_labels from sklearn.metrics import euclidean_distances from sklearn.linear_model import LogisticRegression from sklearn.svm ...
ef0728f9aa73f7095e99c52cebb6abfe1ce14f7c3d02118f4b739f2df36d5021
Python
6,847
183
# # 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,...
bd32b9ce176784a69efa9897664017b26c2b3e6d1490dac929c3618a051de58a
Python
6,848
195
#!/usr/bin/env python ''' LFP simulation script for 4x4 mm2 network model But the network is implemented with spatial connectivity, i.e., the neurons are assigned positions and distance-dependent connectivity in terms of cell-cell connectivity and transmission delays. Synopsis of the main simulation procedure: 1. Loa...
53b7cf4fd11dddd4379ad4a740eeec73b2ff2b51fc33aa3db5ab6a7110f31c16
Python
6,849
122
#------------------------------------------------------------------------------------------------------------------------ #Author: Brandon S Coventry # Date: 05/04/22 May the 4th be with you # Purpose: This easily conducts a heirarchical bayesian linear regression. The goal of this program is to be more "plug # and pl...
adf2ac563fa5a5dcf10e413aabe25e7c84945d63d2369ffe341e13c82f3c536b
Python
6,849
213
# # 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,...
eb840358baf98d837c4e48f05254021ffc01da3bc597c1d15559c398445ceed2
Python
6,849
145
import os import torch from torch import nn from torch_scatter import scatter_mean, scatter_add from torchdrug import core, layers, utils, data from torchdrug.layers import functional from torchdrug.core import Registry as R @R.register("models.Physicochemical") class Physicochemical(nn.Module, core.Configurable):...
201dded4dbda0ed74e1108801487262aaebdb8073c05efdd099d8c2eb0dc2095
Python
6,850
185
## # \file convert_nifti_to_dicom.py # \brief Script to convert a 3D NIfTI image to DICOM. # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date Mar 2018 # # NOTES (quite some candidates were tried to get a working solution): # # - nifti2dicom (https://packages.ubuntu.com/xenial/science/nifti2d...
ff26dfb4620b3b2219529f067f4c63b2ff3e036a5b01c0643c3779219ef090d6
Python
6,850
202
from json import dump, load from PyQt5.Qt import Qt from PyQt5.QtGui import QColor from PyQt5.QtWidgets import (QToolBar, QToolButton, ) from wonambi import Wonambi from .test_scroll_data import (channel_make_group, find_in_qt, ...
d0f4e2709d195e56640aa30c7471d43c374f1fb44ff2b82040e96d853d23a489
Python
6,851
226
#............................................................................... # # This file is part of the Doxyrest toolkit. # # Doxyrest is distributed under the MIT license. # For details see accompanying license.txt file, # the public copy of which is also available at: # http://tibbo.com/downloads/archive/d...
0e0d6e8de0ca31d85e8ebc2bfc204e47713241a924b25df5cd9c4bb50ea59c51
Python
6,852
175
import io import os import json import jinja2 from PIL import Image from rdkit.Chem import AllChem, Draw path = os.path.join(os.path.dirname(__file__), "template") def reaction(reactants, products, save_file=None, figure_size=(3, 3), atom_map=False): """ Visualize a chemical reaction. Parameters: ...
1474f30bce9a32741f550327707fc0528861faa6e30f08a68861a7283c701341
Python
6,852
170
"""Tests for validate_hed_tabular script.""" import io import json import os import tempfile import unittest from unittest.mock import patch import pandas as pd from hed.scripts.validate_hed_tabular import main class TestValidateHedTabular(unittest.TestCase): """Test validate_hed_tabular script functionality."...
4bccd586016152ae6de5b6b0fa36b843ff2b3a7aec319c7cf29da09a06f690af
Python
6,855
179
# Node-group asset "Build Elastic Network" (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_...
5baf73ea92c98a2c6ed6e78eafd9f0ca8a5742cbc7c53bfd4f69973ec20bfa4b
Python
6,855
175
from analyse import * import MDAnalysis from MDAnalysis import transformations import time import os import glob import sys import pandas as pd import numpy as np import mdtraj as md import itertools from mdtraj import element from argparse import ArgumentParser from scipy.optimize import least_squares import time par...
c71dd32bcce32ed3b32565b58365a2434da8e1ca2fd80dfe13f984efd409d663
Python
6,855
206
# 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...
782794fceb5c4bd1bf7b28cef361d1e332ddac3f4dedc5085bb6f59b29d11153
Python
6,856
194
"""Device interface class.""" import json from abc import ABC, abstractmethod from ctypes import _SimpleCData, byref, c_char_p, c_int32, create_string_buffer from logging import Logger try: import spcm_core as spcm except Exception as exc: # noqa: BLE001, spcm_core raises a bare Exception if the driver is missing...
3c65b9a3ca220b932580a9257086ae6e2d007a6c1ce3dbb4f3cdd2b92b11355f
Python
6,858
219
from __future__ import annotations from ase import Atoms from ase.build import bulk, molecule from quacc import Remove, change_settings from quacc.recipes.aims import _base, core from quacc.utils.kpts import kspacing_to_kpts def _record_calls(result): calls = [] def recorder(*args, **kwargs): calls...
4b7536c5b076d1b230804e23e4584418dcd3dee23c5d33a013f2a9826ba018f8
Python
6,858
165
from __future__ import print_function import numpy as np from examples.pybullet.utils.pybullet_tools.pr2_primitives import Conf, Trajectory, create_trajectory, Command from examples.pybullet.utils.pybullet_tools.pr2_utils import visible_base_generator, get_detection_cone from examples.pybullet.utils.pybullet_tools.ut...
fc6582c05d5f5195664fa69c6d8173dd23d799efc7a1db4b5c8f86ad4299129e
Python
6,859
200
"""Custodian handlers for VASP.""" from __future__ import annotations import os import shlex from typing import TYPE_CHECKING from custodian import Custodian from custodian.vasp.handlers import ( FrozenJobErrorHandler, IncorrectSmearingHandler, KspacingMetalHandler, LargeSigmaHandler, MeshSymmetr...
2b2ce78d62fa23e14121878a300b4a42685c1ffb5d2167bbc894408eb64dd977
Python
6,862
190
#!/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 """ import os import time import random import argparse import numpy as np from keras import backend as K from keras.optimizers import SGD from config import co...
12b0645bb60aa43e23766ce60f394777295c370668b307d973d7fa73ab9af70f
Python
6,863
206
# -*- coding: utf-8 -*- import numpy as np import torch import torchvision import torch.nn as nn import torch.backends.cudnn as cudnn import torch.utils.data as data from torch import optim from torchvision import datasets, transforms, models from torchvision.models import resnet18, resnet50, ResNet50_Weights, efficie...
fcce3c294d3b51451399e17bd18f68f9364082ce6e85bf08990de47f121388a5
Python
6,865
202
"""GUI wiring for the 5 advanced affine parameter fields -> --aff_* flags. Two layers, mirroring test_reg_effort_cli_args.py (pure) and test_parameters_tab_ants_overrides.py (Qt introspection + live widget). """ import inspect import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname...
246683469e4b155bf97962c7862e3d9ddf32aa99badcdf276606b73b4fe900f3
Python
6,867
200
import pytest from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath @pytest.fixture def saved_files(relu_layer, inputs): relu_layer.forward(inputs) relu_layer.eval() design = relu_layer.create_design("relu_0") destination = InMemoryPath("relu_0", parent=None) de...
da5ef014c33b9d48033b7269dc8afce93d4ae64aa4a2696c618c54633997ef9d
Python
6,868
236
import warnings import numpy as _np from autograd import builtins from autograd.extend import notrace_primitive, primitive if _np.lib.NumpyVersion(_np.__version__) >= "2.0.0": from numpy._core.einsumfunc import _parse_einsum_input else: from numpy.core.einsumfunc import _parse_einsum_input numpy_version = _...
72149d5b98e5ff19a6c5126b7581f94a4000d8ec508ae8d5075c9aa593d5f0e7
Python
6,871
66
"""Render actual recorded state arrays; no simulated or decorative activity.""" from __future__ import annotations import html import json from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np def render(results: Path) -> None: summary = json.loads((re...
b0dbc87b9ec6e4584827ec75b3f9a2503c7f8edc0f58c2f577118108c1fb4771
Python
6,871
153
# Importing necessary libraries for molecular processing, voxelization, rotation, and data preparation. import torch import rdkit from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import MolStandardize from moleculekit.util import uniformRandomRotation # For random 3D rotations from moleculekit.sma...
b95fe78bfd24a855add429d372dfc6898afa45f0793322ed1b0e11ba96d28cb8
Python
6,871
220
__author__ = "Zoe Wefers" __credits__ = ["Ryan Huang"] __version__ = "1.0.0" __maintainer__ = "Zoe Wefers" __email__ = "zoe.wefers@mail.mcgill.ca" """Purpose: Performs all the image cleaning, smoothing, processing etc to generate prints for every annoated cellular compartment and skeletons for every dendrite.""" impo...
ce21a905c20804a0a86e4a95a7133f9033752fdd23140bb6f912ca8c60a48da2
Python
6,874
122
# 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...
fad8926595724ebeb07d56909ee73c3e10106bac19e7f15ead90a88eed5e62e0
Python
6,874
199
import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader import numpy as np import random # write down train data path data_path = '../../data/dream/train_sequences.txt' # Globals. base2int = {'A': 0, 'C': 1, 'G': 2, 'T': 3, 'N': 4} one_hot_matrix = torch.t...
9a30b16f3542e812daa3e715ce61d966692d1ef54e2ca35b9f71ba7b8a723056
Python
6,878
157
from typing import Dict, List, Union import numpy as np from ..base_transform import EEGTransform class PickElectrode(EEGTransform): r''' Select parts of electrode signals based on a given electrode index list. .. code-block:: python from torcheeg import transforms from torcheeg.datase...
dba27ad199843afb0f9b69da6e074debdc05992becfcb6ac4cbb754884be35b7
Python
6,878
124
# 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...
14772069d6327ffb4d0d9e4ae50627bfae2bbed4a489a6688014602f807e224f
Python
6,879
226
import time import warnings from importlib.util import find_spec from pathlib import Path from typing import Any, Callable, Dict, List import hydra from omegaconf import DictConfig from pytorch_lightning import Callback from pytorch_lightning.loggers import Logger from pytorch_lightning.utilities import rank_zero_only...
11a240a58ddbba4488aac9268cfdc3d5a95be43cb2d945b1d786baf9dc6a3278
Python
6,880
215
# 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...
67a86476a4004e5ce4aae51a2927107ee8221efc5c8223d9966a60e80cf11f94
Python
6,880
170
# -*- coding:utf-8 -*- import torch from torch import nn from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler import pandas as pd import os from datetime import datetime from sklearn.metrics import matthews_corrcoef,confusion_matrix,...
87c6c0d2035c2ba4998f47bfd3f76ccf472595b96bb8cf07005ca83fb81a7e3b
Python
6,881
218
# Parameters import argparse # Create an ArgumentParser object parser = argparse.ArgumentParser(description='Feedforward neural networks for pseudobulk data') # Add parameters to the parser parser.add_argument('--inPath', type=str, help='Folder with the input data') parser.add_argument('--resultsPath', type=str, help...
45d636589305540dbbf073dee00f09dde244c529ee3b2597c6e98644c583551e
Python
6,882
176
import time import torch from helpers import list_of_distances, make_one_hot def _train_or_test(model, dataloader, optimizer=None, class_specific=True, use_l1_mask=True, coefs=None, log=print): ''' model: the multi-gpu model dataloader: optimizer: if None, will be test evaluation ...
c011589b5f34a9e6bd24ab7ffd4ce14653513617333c31436aa183db5b1bbaca
Python
6,882
217
""" pygments.sphinxext ~~~~~~~~~~~~~~~~~~ Sphinx extension to generate automatic documentation of lexers, formatters and filters. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys from docutils import nodes from docutils...
38528922a5b848d366a918aaaba7111e702f98f2736adb81cd59a7b66d0484e5
Python
6,883
178
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.animation as animation import time import ray import os from neuron_model_parallel import NeuronSim from elec_field import sparse_place_human from pulse_train import PulseTrain_Sinusoid...
04faaf250e4ba7e43a5529070658e27df8dd2c6d8b013b6e0494291bdfa29b56
Python
6,884
207
import numpy as np # from HypHC_master.utils.lca import hyp_lca from manifolds.poincare import PoincareBall import torch def norm(x, axis=None): return np.linalg.norm(x, axis=axis) #------------------------- #----- Poincaré Disk ----- #------------------------- # NOTE: POSSIBLE ISSUE WITH DIFFERENT WAYS TO SPECIF...
18b7a90a55a5aef6e6633ea540530d473c6dff9ca5a72aa19ea51aa34f763d9e
Python
6,886
161
"""Hover-feedback mixin for the CCF boundary editor. Carries the on-canvas hover behaviour: the scene mouse-move handler (``_on_scene_mouse_moved``) that updates the cursor coordinate readout and, when enabled, shows a region-info tooltip; the per-region cell-count chunk used in that tooltip (``_hover_cell_chunk`...
a5ec6a7faa3f47a5156388604e3688140edbddf6732b139a2ec17549de2238da
Python
6,886
212
# Node-group asset "Dihedral Chi Angle" (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...
4465135712548fb7fb08fbe9da3e37e2f78009983f54c6852b42715917c031f4
Python
6,889
249
""" Verifies that the magnitude and phase of the reflection coefficient of a total internal reflected (TIR) mode of a flat interface of two lossless materials given an incident planewave at oblique incidence computed using the mode-decomposition feature matches the Fresnel equations. ref: https://meep.readthedocs.io/e...
2ade7887ad0971c42f2af8ca4fa39e12f64228c81e320e64c5c7ac37b114db8f
Python
6,890
124
# 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...
8f68244a76354eba50c3aa64922c53fcdde4ab85c753f04e42c5c09cb51a2fce
Python
6,890
236
import numpy as np from sella.linalg import ApproximateHessian from sella.optimize.restricted_step import TrustRegion from sella.optimize.stepper import ( PartitionedRationalFunctionOptimization, QuasiNewton, RationalFunctionOptimization, ) class _StationaryQuadraticPES: dim = 3 def __init__(sel...
cffc89f243f1bb6fdee0d964e773085187a571c7b9c9c6889e2c273e34a3eedb
Python
6,890
181
"""Implementation of CLI view command.""" import matplotlib.pyplot as plt import matplotlib as mpl from cycler import cycler from treem.morph import Morph from treem.morph import DGram from treem.io import SWC from treem.utils.plot import plot_neuron from treem.utils.plot import plot_section from treem.utils.plot i...
d8ecdd688a6999b682adafbd8de2ffc325c120b023dc325843228f65802ca9c6
Python
6,894
157
from jax import random, numpy as jnp, jit from functools import partial from ngclearn.utils.optim import get_opt_init_fn, get_opt_step_fn from ngclearn import resolver, Component, Compartment from ngclearn.components.synapses import DenseSynapse from ngclearn.utils import tensorstats class CSDPSynapse(DenseSyna...
f9ae91c2c8bb7fe86ad1eacf0b126a24b219a448cb8c07e9bdb94de451509473
Python
6,894
178
# Implements black-box variational inference, where the variational # distribution is a mixture of Gaussians. # # This trick was written up by Alex Graves in this note: # http://arxiv.org/abs/1607.05690 import matplotlib.pyplot as plt import autograd.numpy as np import autograd.numpy.random as npr from autograd impor...
864133440c176b7faaf679ded3168dee8cee39e9ba778ed40e41d915f297793c
Python
6,895
178
# # Copyright Bradley Lowekamp # # 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.txt # # Unless required by applicable law or agreed ...
c5bfae611331cad30bec913516365cc249302051bc745af6f2e7aed9fd50e9cb
Python
6,895
188
""" Created on Thu Mar 11 16:07:12 2021 @author: Haotian Teng """ import os import toml import torch import itertools import numpy as np from typing import Union,Dict from torch.utils.data.dataloader import DataLoader from xron.xron_model import CRNN, REVCNN, CONFIG,DECODER_CONFIG,MM class Trainer(object): def _...
4c270223c77822de971d28f930031802a89e8d0e63550da0329161de73b780f0
Python
6,896
172
"""Tests for the 2D match_fixed_resolution option. When ON (the 2D default) the moving image's longest side is capped at the template's, with its µm pitch scaled to match. Crucially, uploaded cell points must project correctly through that resize (they ride the existing moving_load_scale x point_scale composition...
aaa3ad476114d0e0d0e1a63fcc93cc2e824e4e7d4ebf4cfede598683791b857c
Python
6,896
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...
2d3e29855809e36b197df63af1bfdd2aaaa9027aaab112bc6ef443b61d8ef9e0
Python
6,897
184
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 tqdm import tqdm from dataset import TCGA_Program_Dataset from datasets_manager import TCGA_Balanced_Datasets_Manager, TCGA_Datase...
775a43e9c32119a4cd7df0960c99126d7d33700ef09b7cf6243f58ff779ed2f8
Python
6,897
161
# 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...
b077080e0e45367596d6b297365fd9428ccab95fc7798ca6b9a0f15c39ca6136
Python
6,898
318
from __future__ import annotations import pytest prefect = pytest.importorskip("prefect") import time import psutil from quacc import change_settings, flow, job, subflow n_cpus = psutil.cpu_count() or 1 def test_patch(): @job def task1(val: float) -> dict: return {"input": val, "result": val * 1...
d82e3c2e98a3e53f90429b9249823a7be50967e478ae407f43a70921d412441d
Python
6,901
135
import os import sys code_path = os.path.split(os.path.split(os.getcwd())[0])[0] sys.path.append(code_path) import numpy as np import argparse from setting import * from utils import * from loader import * from feature_selection_sklearn import * # Arguments argParser = argparse.ArgumentParser() argParser.add_argument...
7c6558f73b2cf4c012c03493e026b71f1197981ea16c4ba71e838444de6b198c
Python
6,903
152
import torch from torch.utils.data import Dataset, random_split, DataLoader from typing import Any, List, Type from pytorch_lightning import LightningDataModule # local imports from ..colors import Color, RandomRed, RandomBlue, Grey from ..shapes import Pixel, Orientation, Rectangle from ..textures import Texture from ...
77609d2e2b01a726f3e92a79ad10035c396f0d09e434de01edf508296f3ec2ea
Python
6,904
161
from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F def _temporal_same_padding(kernel_size: int) -> Tuple[int, int, int, int]: r'''Compute temporal SAME padding for stride-one convolutions.''' total_padding = kernel_size - 1 left_padding = total_padding // 2 re...
62110e90f97fdb2b292a0c651cda83c584bf496852068b6480bdf79911883b57
Python
6,906
212
# Defines different color classes used to generate artificial training stimuli. import torch from torch import Tensor class Color: "Base class" def __init__(self): self.color = self.colorval() def colorval(self) -> Tensor: raise NotImplementedError def fill_tensor(self, height, wi...
883eb9df6418aa7066ea1003ba52a3ad5f25f24149fbd7c4568a072471f784c8
Python
6,906
240
import re import sys from contextlib import suppress from typing import Iterable, NamedTuple, Optional from .color import Color from .style import Style from .text import Text re_ansi = re.compile( r""" (?:\x1b\](.*?)\x1b\\)| (?:\x1b([(@-Z\\-_]|\[[0-?]*[ -/]*[@-~])) """, re.VERBOSE, ) class _AnsiToken(Named...
1df1fee8cccfa62d9ab54e538b8285bfe70253e20c21c636bec6e56211647882
Python
6,907
169
# This file is for network initialization # If you do not have a connection file # you can fisrt construct the connection randomly via construct_connection # then load the connection and generate a network via init_network # Else # you can load the connection and generate a network via init_network directly ...
3f1580b950d9aadc21a7220c81d64bd204504523b51814afd35453f779709307
Python
6,907
190
# 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...