sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
61308b1c31f691d108cda200017e936f09b42e54a10633a08a3276283fcb33c3
Python
7,335
205
import genomepy from pybdm import BDM import pdb import os import numpy as np import pandas as pd import warnings warnings.filterwarnings("ignore") warnings.simplefilter("ignore") ''' Annotate off-target dataframe with physical features - GC content - Nucleotide BDM - NuPoP Affinity and Occupancy scores ...
75038d5b2a5bcdfbf31820ed769dccfcd25ac12709bccd838876f1d64fb0c3b8
Python
7,335
188
""" pygments.formatters.svg ~~~~~~~~~~~~~~~~~~~~~~~ Formatter for SVG output. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pip._vendor.pygments.formatter import Formatter from pip._vendor.pygments.token import Comment from pip...
328ff114203504a6e657ed959bfcafdafb87f7403d32d6ba714e38c58eaf8a41
Python
7,336
219
"""The midsagittal-plane sidecar cache.""" import json import os import pytest def _c(): from regtools.hemisphere import cache return cache def _plane(): from regtools.hemisphere.plane import MidsagittalPlane # A 3-D schema-2 plane always records the voxel frame its ml_axis inde...
429a61d89a522d339e8b9d378d67af1eb95c64654bbd22bff6612c4c31551fa3
Python
7,336
168
from typing import Dict, Union import io import pywt import numpy as np import matplotlib.pyplot as plt from ..base_transform import EEGTransform class CWTSpectrum(EEGTransform): r''' A transform method to convert EEG signals of each channel into spectrograms using wavelet transform. .. code-bl...
6be5c0218a86a1392a2e3ad4204e0587342b5ea678ffc400162fcad694cf17a9
Python
7,339
201
"""Test the full PREP pipeline.""" # Authors: The PyPREP developers # SPDX-License-Identifier: MIT import warnings from unittest import mock import numpy as np import pytest from pyprep.prep_pipeline import PrepPipeline from .conftest import make_random_mne_object @pytest.mark.usefixtures("raw", "montage") def t...
dce726c19dab39e4419be4b598d7243d5d96b1e729a2aef87aa7c80223f3ecdf
Python
7,341
228
from scipy.integrate import solve_ivp import matplotlib.pyplot as plt import numpy as np import math as m from mpl_toolkits.mplot3d import Axes3D import torch import torch.optim as optim import matplotlib.ticker as ticker from Rosenbrock import Rosenbrock_func from Quadratic import Quadratic_func from Ras...
b582e673fabba032f7671d49bfe194930b6d2168951875f55112d8f9607077cf
Python
7,343
201
#!/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...
48157d8b2e68128648cc6cfd0209a99f302d5301dbb8fee47779ac7755fae559
Python
7,344
189
import pandas as pd import subprocess import sys import shutil from tqdm import tqdm from pathlib import Path from argparse import ArgumentParser from functools import partial from multiprocessing import Pool from saturation_mutagenesis import renumber_pdb_residues from build_dataset_from_mutant_structures import bac...
ada549ea2ed0046025c627cc017b3fc9bca4b35637a349e99f0489124ab2acf0
Python
7,344
181
import pytest import numpy as np import pandas as pd import nibabel as nib from pyrelimri.masked_timeseries import (trlocked_events, extract_time_series, extract_postcue_trs_for_conditions) import warnings warnings.filterwarnings("ignore", message="The nilearn.glm module is experimental.", category=FutureWarning) from ...
dc17f3b997ef172b267acaad62ea6e8ebe8ea5de8825b23792997b965cfe6078
Python
7,344
262
from typing import Callable, Tuple from functools import partial import jax.numpy as jnp import jax from netket.utils.types import PyTree import netket.jax as nkjax from netket.stats import statistics as mpi_statistics, Stats import numpy as np import matplotlib.pyplot as plt from tre_tvmc.driver.utils import mpi_logm...
f834a17bdb4119b8934fabf483188bd603e17f505703c616d3588b20782d72b9
Python
7,344
154
""" This script summarizes the significant results for global efficiency and participation coefficients, organizing them and matching the results with the node coordinates for H7 """ import sys import numpy as np from scipy.io import loadmat import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as p...
0f3725c013f769a4324dc08781a73090858edc5eb0e49d1e4fa16ff75ed3fb22
Python
7,348
204
"""Unit tests for regtools.registration.core.transform_utils.halve_and_pad. Covers: - left / right / whole modes on 2D arrays (axis=1, the default) - pad size = round(0.06 * width) - output shape correctness - column selection (left keeps [0:mid], right keeps [mid:]) - zero-padding side (left pads right edge; r...
3c456b61aaf879d0afaa94e623c732c569fddcc49463d52b2803fee76f9c7341
Python
7,348
196
""" Introduction to the datasets Module =================================== Welcome to the guide on TorchEEG's ``datasets`` Module! This module provides you with various benchmark datasets for EEG-based emotion recognition, such as DEAP, DREAMER, SEED, MAHNOB, AMIGOS, and MPED. These datasets use a range of stimuli li...
34447627aac837470b9e35497f685dfae4d41cd4a51c95b49c90148313049cc0
Python
7,349
225
#!/usr/bin/env python # Copyright (c) 2018-2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides the ScenarioManager implementations. It must not be modified and is for reference only! """ from __future__...
051f6d1a80a2f39987f7bc2b7cd38c1e20558a2d12f7c18726edb82dcf86e162
Python
7,350
194
''' Description: Run MIOFlow model. Reference: [1] https://github.com/KrishnaswamyLab/MIOFlow/tree/main ''' from MIOFlow.utils import generate_steps, set_seeds, config_criterion from MIOFlow.models import make_model, Autoencoder from MIOFlow.plots import plot_comparision, plot_losses from MIOFlow.train import ...
c850df46ab59b8b88be8c6332588d655994356c6edaa6b38dafca323a8807164
Python
7,350
196
from typing import List, Union import numpy as np import schnetpack import torch from ase import Atoms from ase.calculators.calculator import Calculator, all_changes from schnetpack.units import convert_units import spainn from spainn.properties import SPAINN __all__ = ["NacCalculator"] class AtomsConverterError(E...
06798f7a9c2b7a4d4e6d7cdd259ed89803a3d3bc30e0a7b2e91ab9adb65749d4
Python
7,351
189
#! /usr/bin/python import argparse import os class DNAReference: def __init__(self, reffile): self._contignames = [] self._contigs = {} # contigname 2 contigseq with open(reffile, 'r') as rf: contigname = '' contigseq = '' for line in rf: ...
39f80fdad72077ee87c617ace1bee6c15ecef9d1f5ec2b6e1ce4124395ac444e
Python
7,351
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...
66fb05b11efa47cab09f0d6c55ab457c995bb8388b2b3e1cfbc0a95b2e199cc8
Python
7,351
175
#!/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 ...
95d59f3cf385710bc1bdfd8f60175a126fbcff50b33e02af658be27c873795f9
Python
7,352
187
""" Unit tests for regtools/registration/core/transform_utils.py Covers: - applyAffineTransform - applyDeformationField - affineTransformPointCloud """ import numpy as np import pytest # =========================================================================== # Fixtures # ===================...
7c909c906500a3673ecf5a1edcd850a78ab0127bddcdaba79def4d2535df4c1e
Python
7,353
231
import torch.nn as nn import torch.utils.model_zoo as model_zoo # -----------------------input size>=32--------------------------------- __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde...
a89bb3eb65e24943eb6b829d73f9399ee9c9a6df3912d8b24e01e541c3870de0
Python
7,353
194
"""Cross-platform process-tree termination + PID-file helpers (Qt-free). Why this exists --------------- The registration GUI launches a run in a **detached** terminal (``wt new-tab`` / ``cmd /c start``): the ``wt``/``cmd`` *launcher* the GUI holds a handle to exits immediately, while the real ``python pipeline....
157e9fefa21e64bd1e1c15899c54030f97507b216ad5ce5d5933301ee28f969e
Python
7,355
178
""" VGG16 with BN Difference from vgg16 in torchvision for higher resolution: 1. Layer config changes from [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M'] (torchvision) to [64, 64, 128, 128, 'M', 256, 256, 256, 512, 512, 512, 'M', 512, 512, 512] (acscon...
754c4ac55c679440a3ab3b8b4890a95b675994b2b698c1f03889a0ff9a1482d7
Python
7,355
191
""" Unit tests for regtools/stitching/launch_helpers.py Covers: - get_python_exe: pythonw.exe -> python.exe substitution - validate_mosaic_folder: no file / exactly one / multiple files - build_batch_script: key lines present in output - build_napari_preview_script: path and section number embedded correctly -...
cf4f6339a994983f25107aa5372ffe2d4d584aa79dd53b6342dc16beef5f13ba
Python
7,355
217
# 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...
47a9a6aa93c7b9a9d768d59b7cd09ceb2bcb51e67507bc3395dca064f649499a
Python
7,358
244
import numpy as np import matplotlib.pyplot as plt from utils.params import ParamsPack param_pack = ParamsPack() from math import cos, sin, atan2, asin, sqrt import cv2 def write_obj(obj_name, vertices, triangles): triangles = triangles.copy() # meshlab start with 1 if obj_name.split('.')[-1] != 'obj': ...
a7824254c131e209d81cd585687bf638a6dbf4cb3c46a9850c33aeb3e2404b67
Python
7,359
187
"""Out-of-core (dask, sharded) OME-Zarr writer for large TIFF channels. Streams the base level and builds the pyramid disk-to-disk so peak memory stays bounded regardless of channel size. See the design spec for the verified facts. """ import os import numpy as np import zarr def add_ngff04_top_level_m...
ab9d945743352d634578f6b361e8e7070d8f51b2e18320ba5868bb0b6b850cb6
Python
7,360
209
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 13 2019 @author: jmagraner """ # %% from autograd import grad from autograd.misc.optimizers import adam import autograd.numpy as np def fitmodel(params,target,specs): ### Define LDS as a recurrent neural network ### def LDSmo...
a8cb23534942481b2049aeea14c2a5ff548b8e64ba2af022e475c7bea420fcca
Python
7,362
201
import bct import networkx as nx import numpy as np from tqdm import tqdm from sklearn.utils import check_random_state def in_strength_preserving_rand_sa_dir(A, rewiring_iter = 10, nstage = 100, niter = 10000, temp = 1000, frac = 0.5, ...
afb10066c37be83f4a993302051d5178602b06a08518cb88187aa0b0f90153cd
Python
7,368
201
# -------------------------------------------------------- # Based on BEiT, timm, DINO and DeiT code bases # https://github.com/microsoft/unilm/tree/master/beit # https://github.com/rwightman/pytorch-image-models/tree/master/timm # https://github.com/facebookresearch/deit # https://github.com/facebookresearch/dino # --...
876067aa7519127fabc3450521eda5b35d06b9f013ca6f9074857332274a4e68
Python
7,369
195
# Node-group asset "Symmetry Dihedral" (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. import math from typing impo...
d0ae6a8aee3e75a817bef274e593acdf9ab81712158a67a375ebe4dda9fbe3ef
Python
7,369
185
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import numpy as np import warnings from sklearn.cluster import MiniBatchKMeans as KMeans from scipy.stats import zscore def _scaled_kmeans_init(X, n_clusters=100, n_local_trials=None): """Init n_clusters see...
9184a7bfd6b1e0347e413e67281f911d5a354c43866915893f51b1510c9f77fa
Python
7,370
175
import os os.environ['KMP_DUPLICATE_LIB_OK']='True' import numpy as np import torch import networkx as nx import GNN_core import argparse import random import torch.optim as optim import copy from sklearn.metrics import confusion_matrix, roc_curve, auc parser = argparse.ArgumentParser(description="Simulate a GNN with...
9a4eae6a94eac323ae4a0493543bd83c5b646d0b63001fdbc97031d27be83835
Python
7,370
207
"""Engbert & Kliegl 2003 microsaccade detector. The pipeline for a single eye trace: velocity ──┐ ├─► sigma ──► elliptic threshold ──► run-length grouping velocity ──┘ │ ▼ ...
c7fe3c38ebf76d83807061c7b7a8afe8a64419f8c580da9429372f18ce7d335f
Python
7,370
222
#!/usr/bin/env python """ Batch execution of scripts. Modifies scripts is a specified way, executes them, and modifies files that hold information about the results (catalogs). As an example of a possible usage existing scripts for segmentation and analysis of individual tomograms are first modified (to change para...
aa2b154323ff5acc78f56a57b7e50f1f05c4a8a153d4187bf62136fb237b871c
Python
7,372
138
# coding=utf-8 # Copyright 2020, Microsoft and the HuggingFace Inc. team. # # 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 require...
56101a8c17c9940d0fcf9b0aa3bded891fa2d81e163c85e2d57839bf281a819d
Python
7,373
193
from __future__ import division, print_function import os from typing import List import numpy as np import torch from PIL import Image from topaz.utils.data.loader import load_image def load_state_dict_from_pkg(pkg: str, path: str, map_location="cpu"): """ Load a torch state_dict from a packaged resource. ...
b1c12d3dbe734c6d27f2faf449ce69e72a82734d3f01557aee7b384a7a5e0da5
Python
7,373
218
""" Defines class Experiment that holds data form one experiment. This class is not meant to really hold data (Observations is the main data-holding class). It is only used for some special purposes. # Author: Vladan Lucic (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_literals fro...
1fbe4f9636f082096e81f3905874d21d21937cd0118dc090a34d08b30c5ebd29
Python
7,378
172
import torch from torch import nn from torch.nn import functional as F from torchdrug import core, layers, tasks, metrics from torchdrug.core import Registry as R from torchdrug.layers import functional @R.register("tasks.ContactPrediction") class ContactPrediction(tasks.Task, core.Configurable): """ Predict...
76233e1d0fec33d41e176dc909a4c5948855f609f556b0090068703b3063555d
Python
7,381
214
# 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...
a9a4fd6fbda4147fc81197ae57dd926edb495bf0aa483852a87702b3697406d5
Python
7,381
217
"""Image processing functions designed to work with OpenSRH datasets. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ from typing import Optional, List, Tuple, Dict, Callable from functools import partial import random import ti...
7c37df6a68abd476943130b6ce14d61352372a3772779b4ada801b79fbf29762
Python
7,383
155
import pandas as pd import numpy as np import rpy2.robjects as robjects import os fitdistPath=os.path.join(os.path.dirname(__file__), "fitdistrplus/fitdist.R") quantilePath=os.path.join(os.path.dirname(__file__), "fitdistrplus/quantile.R") # def iterateFitting(DBLmetricsDF): # ''' # Iterating over ranger of Seco...
d40a29bbe34642c9d89fc839e5d4e03d09f0bd3a5b6e26dab8a29840cc2c6a19
Python
7,384
235
# 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...
2fed9c30e9ac3eaa3de6e682b60dffbfb7bd599450fc2499d8ed0d0dda5986d2
Python
7,387
189
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import numpy as np import os, sys from qtpy import QtGui, QtCore from qtpy.QtWidgets import QMainWindow, QApplication, QSizePolicy, QDialog, QWidget, QScrollBar, QSlider, QComboBox, QGridLayout, QPushButton, QFra...
c26a4bf2c50519e566be61b112e6665117ece1466d11a718ccf0f9033890260d
Python
7,388
244
import math import numpy as np rad = math.pi / 180.0 R = 6378137.0 def spherical2Cart(lon, lat): clat=(90-lat)*rad lon=lon*rad x=math.cos(lon)*math.sin(clat) y=math.sin(lon)*math.sin(clat) z=math.cos(clat) return [x,y,z] def cart2Spherical(x,y,z): r=math.sqrt(x**2+y**2+z**2) clat=ma...
5ed4b50bc5a193706f7d2bc65139b9e2b5693784e125062c5f2134d45297c794
Python
7,389
246
import argparse, importlib, logging, os, subprocess from .. import __version__, __picture__ from ..logger import set_logger def parse_args(): parser = argparse.ArgumentParser( description="MiaoNet", formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument( "-v"...
81e74a0973f52d12a7b6ef465e52339c67a60916e322fcdc09c71e2fcdc8fc0a
Python
7,391
308
from __future__ import annotations from dataclasses import dataclass DEFAULT_MONTAGE_PADDING = 20 DEFAULT_FILL_ALPHA = 1.0 @dataclass class MappingConfig: """ Configuration for mapping the preferred morphology-state solution back to observed cells and source images. Canonical Mapping outputs -...
b4369d3453412b5425c4d8abe33ea67041c8cc049c3e7568a771824c3cdc25e8
Python
7,391
173
"""Select eyes-closed segments from the EEG LEMON data """ # Install dependencies import os import glob import mne import numpy as np from sys import argv from osl_dynamics.data import Data # Set hyperparameters if len(argv) != 2: print("Need to pass one argument: use of structurals (e.g., python script.py subje...
ec997c4e9d3dfe731a5cea652c2843c73dea19a07e956cca454d3c0a2a4b6960
Python
7,392
247
#!/usr/bin/python # encoding: utf-8 import random import os import torch from PIL import Image import numpy as np from core.utils import * import cv2 def scale_image_channel(im, c, v): cs = list(im.split()) cs[c] = cs[c].point(lambda i: i * v) out = Image.merge(im.mode, tuple(cs)) return out def dis...
d24b77a1ce126dccb6aed2433a909d0a40b40cd9dfba87ff060e81678a37a657
Python
7,394
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...
6acd4381ee1b56ea01ad1ac0bb3bc42677d2e17780815dd8298b43f4d355fe1b
Python
7,398
201
from __future__ import division, print_function import os import sys from typing import List, Tuple import numpy as np import pandas as pd import topaz.mrc as mrc import topaz.utils.star as star import torch from torch.nn.functional import conv2d, conv3d from topaz.utils.image import downsample def as_mask(shape:Tu...
51b314938758a1e0facb190f1d389c80414c2f7ef1e986605d075dd4b51ea3a4
Python
7,399
212
# 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...
8717e4b5323cff950bc7f3776b1e801f564c062371cc41a343d4802d0186f0c7
Python
7,399
221
from __future__ import annotations from typing import Any import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import is_color_like from SurvivalEVAL.evaluations.custom_types import NumericArrayLike def _validate_plot_indices( indices: int | list[int], size: int, input_name: str = ...
6506aeb05ef10443a01f9e33118aa12bb0da8055031ca02495e97bb81c793fa8
Python
7,403
158
""" AUTOMATIC TUNING OF WS AND AP PARAMETERS This file contains the algorithm for automatically tuning the size of the sliding window and the age power parameter. These parameters are tuned based on the output of Detector 1. """ import AnDePeD.ReRe.auto_ws_ap_criteria as criteria import numpy as np def init_auto_ws...
a5fd2cfe2d9e32c2213dd3da360844422551823842962f34b5f40db38915ba8d
Python
7,403
158
""" AUTOMATIC TUNING OF WS AND AP PARAMETERS This file contains the algorithm for automatically tuning the size of the sliding window and the age power parameter. These parameters are tuned based on the output of Detector 1. """ import AnDePeD.ReRe.auto_ws_ap_criteria as criteria import numpy as np def init_auto_ws...
d11472efb28615652b3030de3023068e2cd482157cb50766563bdbe489a13356
Python
7,404
216
import atexit import logging import os import random import shutil import ssl import string import sys import tempfile import time import urllib from functools import partial from typing import Optional import hashlib import json from importlib import import_module as _import_module from pathlib import Path _log = lo...
30f67a87058db4f524f4ce55a103cf0dd3474d54a06a5b510cb95259547d77fb
Python
7,405
289
import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.decomposition import PCA import seaborn as sns import colorcet as cc from correlation_analysis.regression import linreg CLUSTER_METHOD = 'agglomerative' FONTSZ = 25 def get_correlation( annotations: np.ndarray, coordinates...
331534e1f03459240204598c1fd81877f4b1a730750fa7f152650a254bb6ea0f
Python
7,405
194
# -*- coding: utf-8 -*- # # Syncopy data slicing methods # # Builtin/3rd party package imports import numpy as np # Local imports from syncopy.shared.errors import SPYInfo, SPYTypeError, SPYValueError __all__ = ["show"] def show(data, squeeze=True, **kwargs): """ Show (partial) contents of Syncopy object ...
1b01145fd0ab5b6449d65e374ff77e75fef206ca0dad90759caaf2e14009e923
Python
7,410
253
from typing import Callable, Tuple from functools import partial import jax.numpy as jnp import jax from netket.utils.types import PyTree import netket.jax as nkjax from netket.stats import statistics as mpi_statistics, Stats, total_size import numpy as np from tre_tvmc.utils import mpi_logmeanexp_jax def expect_2di...
bfd02738a547394095542a3b0f776ad055d28513d9509f0f9d0bbbea39638c09
Python
7,410
201
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 ParallelConvBlock(nn.Module): def __init__(self, inp, out): super().__init__() self.conv1 = nn.Conv3d(in...
ca1d118d20a2db28f82fd5dba815be1446a151af69d67f8455565b762c4aba7a
Python
7,412
172
import argparse import copy import numpy as np import os import pandas as pd from tabulate import tabulate import json import sys import random import hyperparameters_multilabel import torch from constants import * from config_train import config from src.dataloaders.rocf_dataloader import get_dataloader from src.mode...
2d907acdb1798df7a13ce4c9e278f630a40fc42c94f569ed484a7e9821078f4b
Python
7,413
221
""" version 1.1 author: Felix Plasser, Hans Georg Gallmetzer usage: Package for reading a molden input vibration file. This input is used for normal mode analysis by nma.py. Also a multiple xyz vibration file that can be read by jmol can be printed out. changes: xrange() changed to range() for compatabili...
c49c22854a5c9143bb973926aeeddc55e14140d94eb5bdf24bdf707da3026914
Python
7,416
237
import hydra from omegaconf import DictConfig import numpy as np import pandas as pd import os import logging import json import matplotlib.pyplot as plt from dataset import ProteinDataset from steps.clustering import apply_clustering, compute_score from steps.hypothesis_testing import test_hypotheses from steps.dim_r...
d2685b81220105324e6bf38a79676f5efb2ffcb2c76170c3f4e5f4b0035748a5
Python
7,416
231
#!/usr/bin/env python # Copyright (c) 2018-2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides the ScenarioManager implementation. It must not be modified and is for reference only! """ from __future__ ...
342f3348257485300a5ea1c37419c52cf33f3e2f6eb852c46e6fcf702fbbd82c
Python
7,417
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...
5d7c087e67a87db623b07620678e664bb734b80ea6ae35130d3a19f9f7da7466
Python
7,417
208
from ._base import EncoderMixin from timm.models.resnet import ResNet from timm.models.resnest import ResNestBottleneck import torch.nn as nn class ResNestEncoder(ResNet, EncoderMixin): def __init__(self, out_channels, depth=5, **kwargs): super().__init__(**kwargs) self._depth = depth self...
25da8c82d5d34221f95155cb2909e79abc4a624e1b29c0ebc0dbb34827b8e1df
Python
7,418
203
# # 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,...
839759c97623543dd2a29d9cbe070c9109ac4060dc7bc4eb0b1f3d55ffbe0be3
Python
7,419
169
import h5py import numpy as np import click import logging from lib.sequence import SeqClassificationDataLoader1D @click.command() @click.option('--ism', 'ism_file', required=True, type=click.Path(exists=True, readable=True), help='Test sequences') @click.option...
55ca0db380e19d8bd7ed03569af94da2385b5d7905d66a480b43e3d072b9d12f
Python
7,421
177
import torch import torch.nn as nn import torch.nn.functional as F class AdaptiveGraphStructureLearningModule(nn.Module): def __init__(self, num_nodes: int, sequence: int, embed_dim: int, gain: float, k_top: int, need_activation: bool, need_scale: bool, need_adj_return: bool, dropout: floa...
6007dfcaefdad780d057abaebed98d3d64aa2890eb2ef421d84b552bd354e048
Python
7,423
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...
a648f421273b77a3363510a44b6be7391d17dfe60fdda8b07fa1542426d117cf
Python
7,425
261
import numpy as np from sklearn.metrics import pairwise_distances import tslearn.metrics from tslearn.barycenters import ( euclidean_barycenter, dtw_barycenter_averaging, dtw_barycenter_averaging_subgradient, softdtw_barycenter, ) from hyppo.independence import ( MGC, Dcorr, HHG, Hsic, )...
a231b50a2bc6c9241f02517e3c3904d66d81b680e78f4dafaf06ab862d09158d
Python
7,428
171
import numpy as np import pandas as pd def find_nan(BPall_channel): # select one channel BP_all_df = pd.Series(BPall_channel) na_groups = BP_all_df.isnull().astype(int).groupby(BP_all_df.notnull().astype(int).cumsum()).sum() nan_cons_values = na_groups[na_groups>0] # na_groups = BP_all_df.notna(...
fdb980bcae38745ba845f2cacddaa42c2f658fb1e552564102aae1557b456513
Python
7,429
150
import unittest from unittest import mock import os import numpy as np import pandas as pd from sklearn.cluster import KMeans import sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src") from hornet.uml import create_pca_kmeans_clustering class TestCreatePcaKmeansClustering(unittest.TestCase)...
b163d32574603d681508c199c02049d7056eb3a54869e92506c775fa87b2f104
Python
7,433
233
import numpy as np import pandas as pd from abc import ABC, abstractmethod from ..utils import printv from ..distance import calculate_distance class DataSet(ABC): def __init__(self, label): self.label = label self.neurons = np.zeros((0,), dtype=np.int64) def __len__(self): return ...
bf00a03d078352b5d9046cd5594a9e877a75dd5e932a8b3186256fc632f93af9
Python
7,434
172
#! /usr/bin/env python3 import os import subprocess import logging import pickle import APT_interface import time import mmpose.utils from argparse import Namespace class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path)...
2350c733202065bf234fc0989dd5a5d9ac3674debbe69f8128f0ae261bdd86b6
Python
7,435
188
import functools import importlib.metadata import logging import os import pathlib import sys import zipfile import zipimport from typing import Iterator, List, Optional, Sequence, Set, Tuple from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._internal.metadata.base import BaseDistribu...
120c60dcfa0f604223481576744e0bc8f293d4861b9046ae7648938921f29926
Python
7,436
167
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 16 08:00:51 2020 @author: daltonm """ #%matplotlib notebook import numpy as np import pandas as pd import matplotlib.pyplot as plt import pickle import dill import os import glob import math import seaborn as sns from sklearn.decomposition import ...
5180336a035fd26a825671320187ac11dbdf62d5e63c0727aee55d6a840d6cc4
Python
7,436
172
#! /usr/bin/env python3 import os import subprocess import logging import pickle import APT_interface import time import mmpose.utils from argparse import Namespace class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path)...
cc2cf82150440bddafc77f2872167b6a720d38f388a75eea23f6b303a23669fc
Python
7,437
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...
b4541b745d5a4f235ed17b6f6a091a7dd6bc955dfbdf9d184c585c6dfc873b49
Python
7,438
203
import os import sys from PyQt5 import QtCore, QtGui, QtWidgets import about import apps import globals.global_style as gStyle import prog_panel FILE_PATH = os.path.split(os.path.realpath(__file__))[0] class EmittingStream(QtCore.QObject): textWritten = QtCore.pyqtSignal(str) def write(sel...
b31750a5e2d48472804b47fbec3c27480fadeb21810f051737b7943e6a5266de
Python
7,439
251
import abc import os from collections import deque import numpy as np from pupil_recording_interface.decorators import process from pupil_recording_interface.encoder import ( VideoEncoderFFMPEG, VideoEncoderAV, ) from pupil_recording_interface.externals.file_methods import PLData_Writer from pupil_recording_i...
bee35f405161d5c6293e34504fb8b202791971c98ed158b7f7cf41b3b1540c57
Python
7,439
238
import string from math import floor, log10 from codex.utils.parsing import tokenize, tokenize_and_fold_for_highlight # Replaces all newline/return/tab chars with plain whitespace, and string delimiters with back quotes. # This enables passing strings safely back and forth to jinja templates without urlencoding them...
8b67a8f628847ab5c30aa843aa912a1df35cb2719b8f95f6cdce125116c279dc
Python
7,441
173
# -*- coding: utf-8 -*- """This file implements the potential model Atomic predictions from the network are interpreted as atomic energies. This model is also capable of fitting and predicting forces and stresses. """ import numpy as np import tensorflow as tf from pinn import get_network from pinn.models.base import...
9135ae6cceb697d110d011cb7a3d1bf0677e812a94b8b0afb6f18666d28b7a78
Python
7,442
143
""" ARMC_JOIN_DEDUP_BIAS.py - written 2026-09-16. Reconciliation for D-04 / Step 8. WHY THIS FILE EXISTS. Two committed scripts build "arm C" / "branch C" - the probabilistic flip model that D-05 chose - and they disagree about how much of the brain it moves: 03-CODE/EFFECTOME_MATCHED_NULL.py ARM C ...
f12ebb147d4caab25fcc6fa4713fb4d8be627abb70c508a08eef15369a54f762
Python
7,442
244
# 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...
50e2c7649b90ce4ecf87f6a023abc7e87a9aba4fd447aca0b58e28223d60f756
Python
7,444
156
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 28 15:56:56 2024 @author: caroline """ import argparse from itertools import combinations import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import seaborn as sns import scipy.stats from scipy.stats import spearmanr ...
f991339b939edd883961911d8db96e0f06b307248ada6a72beb64987d04ec5d4
Python
7,444
236
import importlib.util import logging import os import sys from contextvars import Token from types import ModuleType from typing import Mapping from opentelemetry import trace from opentelemetry.context import ( Context, ) from opentelemetry.context import ( attach as attach_context, ) from opentelemetry.conte...
7379cd1730e11fcae98a5f06a2f60a8b62991af78e1a50e40720f6b11efa8bb0
Python
7,445
162
#%%%% #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 17 16:05:43 2022 @author: caroline This script draw x lists of n subjects with replacement and compute the difference between the correlation of prior weights in T1 and T2 and the correlation of likelihood weights in T1 and T2. Th...
5c37ce962828685bd20e62cc5cb432062fe469299e1a39ad5d86c9b67e93ac37
Python
7,446
193
import collections from itertools import repeat import warnings from typing import Any, Callable, List, Optional, Sequence, Tuple, Union import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from .block_utils import conv1x1, conv3x3, Block def _make_ntuple(x: Any, n: int) -> Tupl...
648b7b1af5a1c86da8632fbd7a085f6aac0ea62f35c13eb0c1e53788ff2e92c8
Python
7,447
196
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
efa7ce07bfa45aefead359a28eba48a6bce2d1450d0620d58a363cb91123d263
Python
7,449
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...
40220014ba0ce7f9cf3b6fa244b800d9330ff34afeb0ba34ae08e09c772944e4
Python
7,450
163
import os.path import random from collections import defaultdict, Counter import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from sklearn.metrics import confusion_matrix, classification_report from ord.utils import json_load sns.set_theme() from ord.evaluation.evaluate_functions import get_pai...
4f450eb4fd7d4fc007ff536f5241af9fcc6abf286abc9e5e1c6ee42eae12bed7
Python
7,450
181
from __future__ import annotations import pytest pytest.importorskip("tblite.ase") from copy import deepcopy import numpy as np from ase.build import bulk, molecule from numpy.testing import assert_array_equal from quacc import change_settings from quacc.recipes.tblite.core import freq_job, relax_job, static_job ...
4f0f5bb7c2165732f0974ee83d545121fc9576967d22ebcc7ddf8e81c75e4c28
Python
7,451
233
import nibabel as nb import numpy as np import pandas as pd import pytest from atlasreader import atlasreader EXAMPLE_COORDS = dict( affine=np.array([[1, 0, 0, -90], [0, 1, 0, -150], [0, 0, 1, -80], [0, 0, 0, 1]]), coords=[ dict(ijk=[0, 0, 0], xyz=np.array([[-90, -150, -80]])), dict( ...
54522a6011e2c8f6307ede4f4c34cd892272f40a9522b0e57a057750494f616d
Python
7,451
356
from __future__ import annotations import argparse from pathlib import Path from .config import PipelineConfig from .pipeline import run_pipeline from .config import PIPELINE_STAGES # ====================================================================== # PARSER # ==================================================...
e0acacdc8888a8a09da7ecdcad6b069d18e493d77b97a67ececa6e4982a074bd
Python
7,451
223
import h5py import click import numpy as np import seaborn as sns import matplotlib.pyplot as plt from basenji import plots from basenji import dna_io import pandas as pd @click.command() @click.option('--score', 'score_file', required=True, type=click.Path(exists=True, reada...
97560dd10715e1e8310a6bfed38754cf4fcb1728f271d263c7305b2c834fb718
Python
7,453
337
import math import torch import torch.nn as nn import torch.nn.functional as F import dgl import dgl.function as fn from dgl.backend import pytorch as F_dgl from dgl.nn.functional import edge_softmax class MLP(nn.Module): def __init__( self, input_dim, hidden_dim, output_dim, bias=True, act=F.relu, ):...
4ec78cdbf2f74739a57bbc0d132155835d46bd15332585db20055bcca0cdf6d5
Python
7,454
194
import pddl import timers import options NEGATIVE_SUFFIX = '-negative' def handle_axioms(operators, axioms, goals): axioms_by_atom = get_axioms_by_atom(axioms) axiom_literals = compute_necessary_axiom_literals(axioms_by_atom, operators, goals) if options.negative_axioms: # caelan: pretends all li...
c27e73b93cb365160805968400b01e7bbd9636571d3d310dc41c8f1367e27fe5
Python
7,454
172
import os import warnings import torch from torch import nn import esm from torchdrug import core, layers, utils, data from torchdrug.layers import functional from torchdrug.core import Registry as R @R.register("models.ESM") class EvolutionaryScaleModeling(nn.Module, core.Configurable): """ The protein lan...
95de28904f6170f7f07851445d5acfaa498defca009bbee646190e9be029f5ec
Python
7,458
189
from typing import Tuple import torch from einops import rearrange, repeat from einops.layers.torch import Rearrange from torch import nn class FeedForward(nn.Module): def __init__(self, in_channels: int, hid_channels: int): super().__init__() self.net = nn.Sequential( nn.LayerNorm(in...