sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
74cba00866e666ae1e4362de975f86d8b4ebcd654fdcef60c95b6c13a715672e | Python | 5,265 | 144 | import os, sys
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import pytest
pytest.importorskip("PySide6")
from PySide6.QtWidgets import QApplication
imp... |
24ef8b7fa6488d535538c09150b990d0f4925de918976e3d1603723bb08678aa | Python | 5,267 | 90 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
d652cabc72bdd29c65736ad51d79e7e9163ba37347561c567e39017dd3102016 | Python | 5,267 | 141 | # Calculating Uncertainties in Experimental pKas
# Mehtap Isik, 2018/01/26
#
# Usage: python calc_pKa_value_statistics.py
import pandas as pd
import numpy as np
from scipy import stats
import math
def reduce_to_first_significant_digit(quantity, uncertainty):
first_significant_digit = math.floor(math.log10(abs(unc... |
4db991548f3410992fea0888348d6c8b1f49a864edc4cb3c02f1be6a1eedc337 | Python | 5,268 | 142 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.avgpooling1dflatten.design import (
AVGPooling1dFlatten as AVGPooling1dFlattenDesign,
)
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_... |
96639fb2595b1bf22c294ecae031c168e8b4967e3a488920fe9509c4ceed905d | Python | 5,268 | 139 | # Node-group asset "Curve Offset 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.
from typing import TYPE_... |
6baca93632fd66b1104fa0142e731b3c833dc1eff02478828b13c30562a8954a | Python | 5,270 | 168 | # ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# custom_cell_magics: kql
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: transformer
# language: python
# name: p... |
94ef499feecfb2ea9f3f20760fc81c109b5adf1a7a262dcb0394861db12972c5 | Python | 5,270 | 188 | # -*- coding: utf-8 -*-
#
# Syncopy plotting backend
#
# 3rd party imports
import numpy as np
from syncopy.plotting.config import pltConfig, rc_props, foreground
from syncopy import __plt__
from syncopy.plotting import _helpers
if __plt__:
import matplotlib
import matplotlib.pyplot as ppl
# for the legends... |
1a97b1704dbd2e863831a6703d44dc50165a0dd72c8eac8bc591739e4f076ebe | Python | 5,271 | 188 | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import hashlib
import os
from textwrap import dedent
from ..cache import BaseCache, SeparateBodyBaseCache
from ..controller import CacheController
try:
FileNotFoundError
except NameError:
# py2.X
FileNotFoundError = (IOErr... |
2d9fda618bd37ca91dd87b70503f70d0793843fc0da547ebde3e097054462b2d | Python | 5,272 | 116 | # coding=utf-8
# Copyright 2021 Google AI and The HuggingFace Inc. team. All rights reserved.
#
# 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.... |
3e46d58751a16a390edcf9b343779d43246648360738e075901d4b432de93246 | Python | 5,273 | 97 | # https://www.sciencedirect.com/science/article/abs/pii/S1053811906009724?casa_token=e7yJdJbDUVcAAAAA:qx191fq92G3ro5NwvZ6QebNUgp9aqIuDGi0-gGTXgiC7O_gC70YbLUbQA6UOXGuANBr_gv90FZ4
STANDARD_1020_CHANNEL_LOCATION_DICT = {
'FP1': [-0.0294367, 0.08391710000000001, -0.0069900000000000006],
'FPZ': [0.000112299999999999... |
8af92ea3a109cb76ae6e33a01b1151ea9303172aa2b7b99147c0c203ee0299e0 | Python | 5,273 | 109 | import os
import time
from glob import glob
from pandas import read_csv, DataFrame
from itertools import product
from nilearn.glm import compute_fixed_effects
def fixed_effect(subject: str, session: str, task_type: str,
contrast_list: list, firstlvl_indir: str, fixedeffect_outdir: str,
... |
220a5b61a4a95481d8cec2cea323445bc9939cea9d4d543d42278484cd37927b | Python | 5,274 | 103 | #!/usr/bin/env python3
import argparse
import os
import subprocess
from glob import glob
import pandas as pd
__version__ = "1.0.1"
def run(command, env={}):
merged_env = os.environ.copy()
merged_env.update(env)
process = subprocess.Popen(command, stdout=subprocess.PIPE,
std... |
24e758dbb1b65981371576d62c6f242a2c1965fa9e702c834c4c87f756f57c54 | Python | 5,274 | 140 | #
# 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,... |
e61d5be0b84590a559bd91fc0e90ae1910e11369976dc0706a1aa37458814d0e | Python | 5,274 | 157 | """
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free software: yo... |
dc9a5d21745ba30087f225f0663751659cb84a5c1c5eab47c537c4a300459404 | Python | 5,275 | 143 | #
# 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,... |
f342f726f99193f4b96e82749f6dedb1a242fc384cfd02045e7017cf316ecbe7 | Python | 5,275 | 138 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Figure 2 of paper Functional subnetworks
@author: felipe
"""
import sys
import os
sys.path.append(os.path.abspath('../../'))
import analysis.frequency as frequency
import analysis.synchronization as synchronization
import numpy as np
import scipy.io as sio
import sci... |
132201e8b977cb841b1e2f8de17c206c6d41e23f15c34d92213bca2c3afcbe9d | Python | 5,276 | 123 | # -*- coding: utf-8 -*-
"""
VGG-Net for CIFAR-10.
Introduction
----------------
VGG is a convolutional neural network model proposed by K. Simonyan and A. Zisserman
from the University of Oxford in the paper 鈥淰ery Deep Convolutional Networks for
Large-Scale Image Recognition鈥? .
Download Pre-trained Model
-----------... |
7d7da4e6f02b34d409dd641e4b9abcc42489c5bd0498248c773342b429342b4a | Python | 5,276 | 153 | # 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... |
d09e2e219ba61be767827fb0731525956ee5e612b0bc156ad77d071c67c549be | Python | 5,276 | 90 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
ca7e288909b523eefb6c10ce887ef0410dde417c871cc2d58a32bd28239160e1 | Python | 5,277 | 119 | #%%
import torch.nn as nn
import torch
from types import SimpleNamespace
# from coral_pytorch.layers import CoralLayer
# from src.models.components.resnetblock import ResNetBlock
# from src.models.components.preactresnetblock import PreActResNetBlock
from src.models.components.sfcnblock import SFCNBlock
# from sfcnbloc... |
f15cd8dbd6ef79a669c27a6310bccc2e09820d72355dc36e685662986068626d | Python | 5,277 | 186 | """
Useful functions that can modify or execute many files (scripts) together.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from builtins import str
from past.builtins import basestring
__version__ = "$Revision$"
import os
import sys
import imp
imp... |
78dbded364a92288e7af07ac50708d58d522e91813a3c1eb110ef07b805649fe | Python | 5,278 | 90 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
99cf9b65c4500ec73904b282e2e90e708f621e36a544dd0e0237189f341da989 | Python | 5,278 | 162 | # 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... |
99807ba347c5eeb255e332b339f5f57cd65c11ca30c66f22397fce9b442dea90 | Python | 5,279 | 137 | '''
Created on 6 July 2018
@author: Miguel Molina Romero, Techical University of Munich
@contact: miguel.molina@tum.de
@license: LPGL
'''
import unittest
from dry.dry import Dry
from keras.models import Sequential
import os
import shutil
testingdir = "dry/data/test"
bval1s = "dry/data/one-shell/test_ok.bvals"
dwis1s ... |
c10953b4b0dc1f0ae09f4a5d2a9c4d57ed92f48240619d3f3d233ce71207ae20 | Python | 5,279 | 238 | """Quacc CLI module."""
from __future__ import annotations
from typing import TYPE_CHECKING
from rich import print as rich_print
from typer import Exit, Option, Typer
from quacc import get_settings
from quacc.settings import QuaccSettings, _type_handler
if TYPE_CHECKING:
from pathlib import Path
from typin... |
e52dbd5a9d928b896933b650846c02c74af5e4cd44ed9f8187cee50e468e978d | Python | 5,279 | 121 | """Train the classifier (mask -> positive / negative).
python -m src.train_cls --data-dir data --epochs 300
"""
import argparse
import json
from datetime import datetime
from pathlib import Path
import albumentations as A
import numpy as np
import torch
from albumentations.pytorch import ToTensorV2
from torch.uti... |
00561ef176c97c4ff35d0f619fbe1b40131bf31e55e10f627c13357796eb0836 | Python | 5,280 | 165 | # 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... |
01ae6129ed457dd99bc6af985e501a248c3c1dc897155e061cebdcd69a01abdd | Python | 5,281 | 90 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
5bc4292e52a4229a277af4f44d8844423d5efeba2ff2dae524676e70590952ea | Python | 5,281 | 136 | #!/usr/bin/env python
import pickle
import numpy as np
import syncopy as spy
import matplotlib.pyplot as plt
from scipy.signal import savgol_filter
plt.rcParams['pdf.fonttype'] = 42
# parameters
cohppcGC = 1 # 1: coh 2:ppc 3:GC
saveFig = 1 # 0:not savefigs 1: save figs
freq_range = [1, 100] # freque... |
61d40c75abf0164bd73847d3458592fc690423b2e9fa1169a3aa71b2cddb1360 | Python | 5,281 | 158 | # pylint: disable=invalid-name, missing-function-docstring, missing-class-docstring, unused-argument, too-few-public-methods, no-member, too-many-arguments, line-too-long, too-many-instance-attributes, too-many-locals
""" FBNetGen model module from https://github.com/Wayfear/BrainNetworkTransformer"""
from copy import... |
fd52f8199cbcd8729e6d114e7d0dd1c0feae0fa62d3b5448f0ba8f3c895fbb3a | Python | 5,281 | 174 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 16:11:11 2020
@author: au571303
"""
from random import shuffle
from psychopy import prefs
prefs.hardware['audioLib'] = ['sounddevice']
#prefs.hardware['audioLib'] = ['pyo']
from psychopy import visual, core, sound, event, gui, logging
import os
import numpy as np
from ... |
c102eee8602f19e42c55ddb75c25781f2fa5e91091d0674e14446b6e21a6011d | Python | 5,283 | 165 | #!/usr/bin/env python3
# coding: utf-8
import sys
from functools import partial
from pathlib import Path
import numpy as np
import petsc4py
import yaml
from mpi4py import MPI
from petsc4py import PETSc
from astrovascpy.bloodflow import generate_endfeet, simulate_ou_process
# from astrovascpy.io import load_graph_fr... |
1651c0ae401acb288c4f3fcbe1ccbe9af45a9f9caa3f01effcbe22e130d65918 | Python | 5,284 | 150 | # 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... |
ce51d7403ee52d50f0492b4ecb30ebf9df42ed87fa1ff2d3e3936fb1ba773559 | Python | 5,284 | 139 | from model.TwoResNet.dataset import DataModule
from argparse import ArgumentParser
import yaml
from model.TwoResNet.supervisor import Supervisor as TwoResNetSupervisor
from pytorch_lightning.callbacks import RichModelSummary, RichProgressBar, ModelCheckpoint, LearningRateMonitor
from pytorch_lightning.loggers impor... |
6dc1da0c77160a4f36e1b15b67b62700275129469c77657731c60c60e926fc3d | Python | 5,285 | 109 | # script to generate tables of full information about significantly associated loci and genes
import os
import re
import xlsxwriter
# file paths and directories
dir_GEA = '/home/siyuan/jobs/suzukii_WGS/EAA/bayescenv/chtc/split_jobs/test_para_p/merge_jobs/results'
dir_snp_gene='/home/siyuan/jobs/suzukii_WGS/EAA/downst... |
77247b2ef291120ee6fec9d5a3e33de36f6f1323caf4f9fa233672907e231ef0 | Python | 5,289 | 167 | #! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
from six.moves import xrange
__all__ = [
'discount_episode_rewards',
'cross_entropy_reward_loss',
'log_weight',
'choice_action_by_probs',
]
def discount_episode_rewards(rewards=None, gamma=0.99, mode=0):
"""Tak... |
5bcddf97106d64e38ebfc735c884d2c64060709e6ec0370bd3e03ffb6f05a79f | Python | 5,290 | 146 | """Build a bilaterally-symmetric Allen CCFv3 annotation from the installed one.
The stock CCFv3 annotation is only ~96 % identical to its own left-right mirror
(the residual ~4 % is build/registration jitter near the midline), and both
hemispheres reuse the SAME structure IDs. This derives a perfectly symmetric
l... |
6379befb8e1c276a334819c0056f545482311e6bdb8c3f8d53fba8408566cf73 | Python | 5,290 | 86 | """REAL_SIGN_SCAN.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29d-REAL-SIGN-SCAN.md
Seki et al. 2017 real receptor input -> AL cut-out -> PN responses compared with the real PNs. Reference = laboratory prior
at type level; each of the 95 LN types flipped in turn. Which signs does the real recording confirm... |
8acb797c55fc2d88834f93fc565241f2b2c74740c9c623eb55e68a85d991830b | Python | 5,290 | 136 | '''
Description:
Compare model predictions with UMAP embeddings.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import numpy as np
from plotting import *
from plotting import _removeAllBorders
mdoel_name_dict = {
"latent_ODE_OT_pretrain": "scNODE",
"scNODE": "scNODE",
"PRESCIENT": "PRESCIENT",
... |
4465708103e7e712a22115b7a26512a34fc2befea56cf5bf370586dcc2bea240 | Python | 5,291 | 129 | '''
creates a generic dataloader for non-temporal learning
'''
# IMPORTS
from typing import Any, Callable, Optional, Sequence, Union
import torch
import torchvision.transforms as T
from torchvision.datasets import ImageFolder
from pl_bolts.datamodules.vision_datamodule import VisionDataModule
class ImageFolderDataMo... |
6a50ad6f05e138502614667a050fb0093485a11009db3fb2b087fbfff31327f9 | Python | 5,292 | 192 | import contextlib
import re
from dataclasses import dataclass
from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union
from .specifiers import Specifier
@dataclass
class Token:
name: str
text: str
position: int
class ParserSyntaxError(Exception):
"""The provided source text could not be ... |
6b09e12ebac82e16d1de10e0874999bfb109ea1a59aea59acc7aaa6579f19458 | Python | 5,293 | 151 | """
Script for computing statistics comparing pairs of membrane slices
VERY IMPORTANT: all cloud of points will be compressed to a 2D Euclidean space
Input: - Path to the membrane slices pickles which form the pairs
- Parameters for setting the statistical analysis
Output: - Plot graphs ... |
c2b311dbcef008da66e7e5a29f961cfe2ebacb2251dfd184a75823842574b523 | Python | 5,293 | 144 | import sys
import json
import os
import glob
from os.path import join as fullfile
import numpy as np
def overlap_ratio(rect1, rect2):
'''
Compute overlap ratio between two rects
- rect: 1d array of [x,y,w,h] or
2d array of N x [x,y,w,h]
'''
if rect1.ndim==1:
rect1 = rect1[None... |
36fb63c655d7e2656a54b4892f5189bc1abe8b16c40d850ce4e2e7f68cd7003e | Python | 5,294 | 139 | from unittest import TestCase
from codex.service.motif_search import MotifSearchQuery, EdgeConstraints
from tests import _TEST_NEURON_DATA_FACTORY
class TestMotifSearchQuery(TestCase):
def test_add_node(self):
msq = MotifSearchQuery(_TEST_NEURON_DATA_FACTORY)
msq.add_node("a", "")
with s... |
c76a19248bff341003507909b80b724647184e699cdff6f9e65c58161205d181 | Python | 5,295 | 139 | import torch.nn.functional as F
import torch
import numpy as np
from utils.misc_utils import per_image_standardization
def xent_loss(output, readout, target, masks, reduction='mean'):
loss = F.cross_entropy(readout, target, reduction=reduction)
return loss
def bxent_loss(output, readout, target, mask... |
e7bc6ef9594394e86b2dbbf8314211be7d57bca983a9856c1791e013ca648e45 | Python | 5,295 | 123 | # -*- coding: utf-8 -*-
"""
VGG-Net for CIFAR-10.
Introduction
----------------
VGG is a convolutional neural network model proposed by K. Simonyan and A. Zisserman
from the University of Oxford in the paper 鈥淰ery Deep Convolutional Networks for
Large-Scale Image Recognition鈥? .
Download Pre-trained Model
-----------... |
58d3c509677890f0bbadf92e23a14e79c66ca76e626014633cf02335dafc76ac | Python | 5,296 | 171 | '''MobilenetV2 in PyTorch.
See the paper "MobileNetV2: Inverted Residuals and Linear Bottlenecks" for more details.
'''
import torch
import math
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def conv_bn(inp, oup, stride):
return nn.Sequential(
nn.Conv3d(inp, ... |
59c541ec95591a194852b969b3309ed5c2a678dd1fc473721ac50104f9668be0 | Python | 5,296 | 142 | import sys
import os
out_dir_path = sys.argv[1]
models = ["sigmap", "uncalled", "TINYX011"]
use_cases = ["covid", "viral", "sepsis_chm13", "sepsis_hg38"]
execution_times = []
for model in models:
execution_times.append([])
for use_case in use_cases:
execution_times[-1].append(0.0)
for idx, model in... |
c882631e136613d7c23eff2e6016250a3ef0ac026a67f5b30a2083f3c4b65611 | Python | 5,296 | 123 | # -*- coding: utf-8 -*-
"""
VGG-Net for CIFAR-10.
Introduction
----------------
VGG is a convolutional neural network model proposed by K. Simonyan and A. Zisserman
from the University of Oxford in the paper 鈥淰ery Deep Convolutional Networks for
Large-Scale Image Recognition鈥? .
Download Pre-trained Model
-----------... |
80f3d517c4b554b23b3a8c4b185524bb8c2e7329547946ba17cd9fdb2e5b2775 | Python | 5,299 | 155 | # USAGE
# python train_mask_detector.py --dataset dataset
# import the necessary packages
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.layers import AveragePooling2D
from tensorflow.keras.layers import Dropout
from tenso... |
9da14b07b51a1597ae229efac006851e5001b7bb81da04d9105ccb28aebcacc1 | Python | 5,300 | 104 | #!/bin/usr/python3
# Use example: python generate_ROI_results.py GIFNiftyNet.ctbl df_subids_filenames_densenet121_32ep.csv test_output_roi_results
## Import libraries
import os
import argparse
import nibabel as nib
from nibabel.affines import apply_affine
import matplotlib.pyplot as plt
import seaborn as sns
import... |
daa30907633f8b9de0d0b99e61f0f9577490f5fc771527025dd1544b4df07e25 | Python | 5,300 | 194 | import collections
import functools
import itertools
import operator
# from jaraco.collections 3.5.1
class DictStack(list, collections.abc.Mapping):
"""
A stack of dictionaries that behaves as a view on those dictionaries,
giving preference to the last.
>>> stack = DictStack([dict(a=1, c=2), dict(b=2... |
7c70a3b6b354bd940d1ffe1e1ea6d1114ee18128fdf4ae8607d98c723833c93e | Python | 5,301 | 61 | """FIG_LAW.py 2026-10-02. Report figure F18 (one inequality): a set of sign changes breaks the antennal lobe iff it lifts
s_Unu — the excitatory share of the local neurons' synapses onto uniglomerular PNs, each weighted by its neuron's baseline
rate — to 0.456. (a) many wrong signs: when random orders break, against ... |
256dc3064018a37f99d89ba0796be305154ca3bb7a0ba3aaab3a8ca2841b35a7 | Python | 5,302 | 151 | from typing import Tuple
from sklearn.neighbors import NearestNeighbors
from skimage import transform
import numpy as np
from scipy import signal
def extract_control_points(
referencePoints: np.ndarray, movingPoints: np.ndarray,
gridSpacing: float=0.5) -> Tuple[np.ndarray, np.ndarray]:
"""
If ... |
949a1f204ea65ab886c43f9512fe5a249828d8a09aaecd5f48af3b9aaf7e15c5 | Python | 5,302 | 174 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
9e87506266812620a7d53378861dbb1b3afe2eb8f7deb7c6c4cc3be429177029 | Python | 5,302 | 154 | # 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... |
be7aa4fba4c6f8505f8fda11d3b12f7055baaff543bd8f2eab09c94fded03fe2 | Python | 5,303 | 178 | import torch
import numpy as np
import torch.distributed as dist
import segm.utils.torch as ptu
import os
import pickle as pkl
from pathlib import Path
import tempfile
import shutil
from mmseg.core import mean_iou
"""
ImageNet classifcation accuracy
"""
def accuracy(output, target, topk=(1,)):
"""
https://g... |
d5275bb1f47e46f3699907680979888d0903381868da73126e5470ceb7f6424f | Python | 5,303 | 243 | from __future__ import annotations
import pickle
from functools import partial
import pytest
ray = pytest.importorskip("ray")
from quacc import flow, job, subflow
from quacc.wflow_tools.decorators import (
RayFuture,
_ray_getitem,
_resolve_ray_subflow_result,
_resolve_ray_value,
_unwrap_ray_futu... |
62b369f0b3c84dbf3ed72ca3314f4dd6102df27c1ef56f3b7a1dfdde5ea6cf78 | Python | 5,304 | 161 | # -*- coding: utf-8 -*-
#
# Test cfg structure to replay frontend calls
#
import pytest
import numpy as np
import inspect
import tempfile
import os
import dask.distributed as dd
# Local imports
import syncopy as spy
from syncopy import synthdata
from syncopy.shared.tools import StructDict
availableFrontend_cfgs = ... |
8fd1f9a835656a33badc8fc838fe20bf071bf4eea819910ebd537f0bbe51e4b6 | Python | 5,304 | 181 | # 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... |
3c8d417a4d8be582f27add2ed14a9cabe85de2f5616d6f66fc1d39306b1c5c5a | Python | 5,306 | 151 | import sys
posit = "no"
bs = "no"
ex = "yes"
dele_type = ["#ifdef FLEXIBLE","[ exclusions ]","[ virtual_sitesn ]"]
wrl = "yes"
m3_to_m2 = {"#ifndef FLEXIBLE": " ", "#endif": " ", "; Side chain bonds": "; Sidechain bonds", "; BBB angles": "; Backbone angles", "; BBS angles regular martini": "; Backbone-sidechain ang... |
f71c2298d5e56e985a958901a219878eedf54587f55baab98e44d2391064ee1c | Python | 5,308 | 100 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
22189942c5dd5b88f8ecb92213a5099feada78b210703f0be4795abcd003e667 | Python | 5,310 | 129 | import os
import numpy as np
from merlin.data import dataorganization
def test_dataorganization_get_channels(simple_merfish_data):
assert np.array_equal(
simple_merfish_data.get_data_organization().get_data_channels(),
np.arange(18))
def test_dataorganization_get_channel_name(simple_mer... |
25554bdb055b0ae42cfa911bacb3795a28ef4444afe5ef51e4cceeb055a751c4 | Python | 5,310 | 109 | from typing import Tuple
import torch
import torch.nn as nn
class MTCNN(nn.Module):
r'''
Multi-Task Convolutional Neural Network (MT-CNN). For more details, please refer to the following information.
- Paper: Rudakov E, Laurent L, Cousin V, et al. Multi-Task CNN model for emotion recognition from EEG Br... |
426b7d8fca7025d2b3e1158ee8cb2a3abe7cfed9147e02e383069fd1712f58b4 | Python | 5,310 | 161 | from collections.abc import Iterable, Sequence
import pytest
from elasticai.creator import ir
from elasticai.creator.ir2vhdl import Shape, factory
from elasticai.creator_plugins.combinatorial.clocked_combinatorial import (
clocked_combinatorial,
)
def test_valid_path_assignments_are_present(code):
code = [l... |
8fcd4542310adbf457e5ddd141b0c92a60fc4ba3df4ef2f62c6e4732f975f417 | Python | 5,310 | 165 | # 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... |
6f2cee1fa79f66e11a46eb8255c895dc5035e003949073a8f4a4126ac9594a83 | Python | 5,311 | 130 | """CLI script to validate and convert HED schema files across formats (XML, MediaWiki, TSV, JSON)."""
import argparse
from hed.errors import HedFileError, get_printable_issue_string
from hed.schema.hed_schema_io import from_dataframes, load_schema
from hed.schema.schema_io import load_dataframes, save_dataframes
from... |
ffb1e47abec5000b835f14c3578afe83287598f0a4ff384207203b9731a0493c | Python | 5,312 | 173 | import torch
import torch.nn as nn
import logging
import numpy as np
import os
import json
import argparse
class AverageMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, n=1)... |
74d2359a48befd926f3f151b13190fde5b7f20af86df5a8688e5d34376a05ab3 | Python | 5,313 | 147 | # 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... |
e3756abda99903c188920594b0452df7b345d1bc03412d805966d9ac5982c846 | Python | 5,313 | 89 | # 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... |
147b082351b88791fd55397b598d0813776c3c7f1096fe16986e9580cd4c799e | Python | 5,314 | 130 | #!/bin/usr/python3
# Use example: python predict_medicalnet_subids.py /home/melanie/sMRI_ASD/data/train4/BIDS_data_brain/test2_algo_train1_preprocessed/ /home/melanie/sMRI_ASD/data/Test2_algo_train1.csv /home/melanie/sMRI_ASD/net2/MedicalNet/good_exps/train1_models_lr_1e-3_resnet50_new_preproc_from_10ep/model_42_epoch... |
7ce343d33048c417a1ae3af317271d9b569afe0735e4dd3b7a3222813c46a37b | Python | 5,314 | 143 | #================================================================================
#= Import
#================================================================================
import os
import time
tic = time.perf_counter()
from os.path import join
import sys
import zipfile
import matplotlib
import matplotlib.pyplot as p... |
b081e0bee063e6ac8c652b57fdb32ae1b7d685f3c998ec711e7d5e27dfb81bce | Python | 5,314 | 169 | import numpy as np
import matplotlib.pyplot as plt
import sys
from matplotlib.cm import get_cmap
import matplotlib
def read_data(patient, resolution, file="pressure_average.dat"):
with open(f"patients/{patient}/results{resolution}/{file}", 'r') as infile:
lines = infile.readlines()
legends = lines[... |
fb2b82ca5110365532690e1e983555a2de6170b5ad05a576fe3db9851b1c1247 | Python | 5,314 | 109 | import bbknn
import scanpy as sc
import anndata as ad
import pandas as pd
import numpy as np
from time import time
sc.settings.verbosity = 3 # verbosity: errors (0), warnings (1), info (2), hints (3)
sc.logging.print_header()
sc.settings.set_figure_params(dpi=80)
import harmonypy as hm
import scib... |
30ffa82ce607f82cb28e759321e14766cd574c3283ce751f51fcc50099b77819 | Python | 5,315 | 238 | """Quacc CLI module."""
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
from rich import print as rich_print
from typer import Exit, Option, Typer
from quacc import get_settings
from quacc.settings import QuaccSettings, _type_handler
app = Typer()
if TYPE_CHECKING:
from pathlib i... |
33519697085654e6ea240071d4bbdb46e47697a6b5be7e8f4e62a4838c49d7a7 | Python | 5,315 | 144 | # Node-group asset "Selected 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... |
385c1ce0b1f693a6699998c75317f826e963a07cff3c85b2fd937016fa26f347 | Python | 5,315 | 174 | """Plot community detection performance vs mixing rate (mu) for LFR benchmarks."""
import sys
import textwrap
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import color_palette as cp
# -------------------------------------------------------------------------
# Parameters: from Snakemake o... |
2773ccea0419a8336301e0514fb2e7ca7fab9173eca3db1d2371ffa0f479aa9a | Python | 5,319 | 128 | #
# 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,... |
b077a04afb6cc44e8c7d91e4f4526d39a110848944def1641f0eba2b35b99b9b | Python | 5,319 | 166 | # 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... |
c3a6696e2ffdedfdced12999b08660671a7857f9b39b265faece17c684ea77dc | Python | 5,319 | 168 | # Infra verification runner for the v1 managed-weights OCI pipeline.
# Validates weight files on disk against weights.lock at setup; run()
# returns a per-weight status summary.
import hashlib
import json
import sys
from pathlib import Path
from typing import Any
from cog import BaseRunner
LOCK_PATH = Path("/src/wei... |
c9731ae6ae7e196d644a85666b4d8c3e2a2796d8012b9d60adae5931c1b7654b | Python | 5,320 | 163 | #!/usr/bin/env python
"""
Validates a BIDS sidecar against a specified schema version.
This script validates HED in a BIDS JSON sidecar file
against a specified HED schema version.
"""
import argparse
import os
import sys
from hed.errors import ErrorHandler
from hed.models import Sidecar
from hed.schema import load_... |
ea6e79f8d952e22e89697bab23f488004b3a14be956f50532ffc2877244043b6 | Python | 5,323 | 165 | from dataclasses import dataclass
import torch
from torch.nn.parameter import Parameter
from elasticai.creator.base_modules.lstm_cell import LSTMCell, MathOperations
from elasticai.creator.base_modules.math_operations_torch import TorchMathOperations
from tests.tensor_test_case import TensorTestCase
def tensor(x: l... |
f8dd4ccb83a6528586f4df827d96ed23c966f19aca76a8c78c0a5b510bc54ddb | Python | 5,323 | 158 | #!/usr/bin/env python
# Copyright (c) 2018-2019 Intel Labs.
# authors: German Ros (german.ros@intel.com), Felipe Codevilla (felipe.alcm@gmail.com)
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Module to manipulate the routes, by making then m... |
03f8d4f0b11b81d1e505a73ef9cd91150805382e028403a1032661198b0e272b | Python | 5,324 | 161 | class FilterParameters:
"""
Represents all necessary parameters to implement a (grouped) 1d filter
without padding.
args:
input_size: Denotes the spatial input size of the filter, consequently we assume `kernel_size <= input_size`.
However, in some cases `input_size` might not be kno... |
8c421a9a77dca3201c109b74cdebd4b07c02a4190934cf833d7ff07beabf0a43 | Python | 5,324 | 144 | import torch
import numpy as np
from collections import defaultdict
from numpy import *
class Logger(object):
""" Adapted from https://github.com/snap-stanford/ogb/ """
def __init__(self, runs, info=None):
self.info = info
self.results = [[] for _ in range(runs)]
def add_result(self, run, ... |
98bea60be14bc42b18f1b22337d92044d1c8585aed35cfd5d484a9bb757708ca | Python | 5,325 | 139 | from collections import namedtuple
from unittest import TestCase
import torch
from elasticai.creator_plugins.lutron_filter.tensor_conversion import (
lutron_to_torch1d,
torch1d_input_tensor_to_grouped_strings,
torch1d_to_lutron,
)
class ConvertingTorchToLutron1dTensorFormatTest(TestCase):
"""
Tor... |
df3e773cb5072908fb346f2f4351dba0d869b63972c83c4743292a380d564c01 | Python | 5,325 | 135 | # 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... |
26cd9a1626b4c98e47b7e0b8f19e27b385300dd139f95ed8bf1c7178d561e146 | Python | 5,327 | 115 | """Mount points for the data-driven report sections.
The render layer (``report_render.js``) fills these by id. Python's job is to
emit the empty containers in the right order with the right headings; every
number inside them comes from the ``report-data`` payload at load time.
Splitting it this way keeps one s... |
60aeb81f907aac797a4542221dd4551e9a26ec3301c3fab13cfad4c3e10498d4 | Python | 5,327 | 96 | """Metric definitions for the report's ``?`` help.
Every metric the report shows carries three things a reader needs: what it
measures, which direction is good, and what a bad value IMPLIES. The third is
the one usually missing - a number with no consequence attached teaches nobody
whether to trust the run.
Ke... |
9837ac58df1aac9827cd6f3b167785c50127d28e37d2caf967643046a4a11d4d | Python | 5,328 | 99 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from lab.reports import Attribute, geometric_mean
from downward.reports.absolute import AbsoluteReport
from downward.reports.compare import ComparativeReport
from common_setup import IssueCo... |
ef26a6a2e743869869f8f9382a9f668eb84d48eec73608f2666fbaf05ee969c1 | Python | 5,331 | 131 | from sklearn.neighbors import KNeighborsRegressor
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from sklearn.dummy import DummyRegressor, DummyClassifier
from xgboost import XGBClassifier
import torch
import torch.nn as nn
from tqdm import tqdm
from mnp.models.parents import ClassicalModel
... |
2a88fa73711c37c6ba2611e2f375f2b9af1e4649a96066327b421903ed96a41a | Python | 5,332 | 182 | """Graph embedding pipeline.
Loads a network, selects a model from the registry, computes embeddings
on the largest connected component, and saves the result.
"""
import logging
import sys
# Re-exec with the correct Python environment if embcom is not available.
try:
import embcom as _embcom_check # noqa: F401
... |
740351023d4d9e17a66dfc2a7da87e1f6396417e4f0edcb4de5b732d30b6616d | Python | 5,332 | 143 | from common.tracetype import *
def duplicate(df, label, opts):
numcopies = len(opts)
dflen = len(df)
dfnew = df.loc[df.index.repeat(numcopies)]
dfnew = dfnew.reset_index(drop=True)
dfnew[label] = pd.concat([pd.Series(opts)] * dflen, ignore_index=True)
return dfnew
def DataFrameFromDict(data)... |
fdf13e919f8554d8edce59fdef0055a57b991ef187b489197741628af126cd07 | Python | 5,332 | 211 | #
# 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,... |
52589df0dd9c857b376114f0660e3a1e98d52d04c9c3d2763f2c9e51b1e163b2 | Python | 5,333 | 153 | #!/usr/bin/env python3
"""
Populate the "Closing PR" custom Text field on FelixKrueger Project #1 for one
PR + the issue(s) it closes.
Usage:
python3 scripts/link_closing_pr.py <PR_NUMBER>
Or from a GitHub Actions workflow, with the merged PR's number as env var.
Authentication: requires `GH_TOKEN` env var with ... |
5968ffb6776a8c5d995538c9d339b815e88cb4b83f61f95c38b84091197c28bb | Python | 5,333 | 114 | import torch
import torch.nn.functional as F
from glbSettings import *
import numpy as np
img2mse = lambda x, y : torch.mean((x - y) ** 2)
mse2psnr = lambda x : -10. * torch.log(x) / torch.log(torch.Tensor([10.]).to(DEVICE))
def get_block(pts, model, embedder, post=torch.relu, chunk=32*1024, model... |
6efad07c3e4c94ef84edbc30be5484ff4abc640575f70334e13d4c8fa201989f | Python | 5,333 | 177 | # 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... |
e3a65fefb89a0aa2c41e834c25bb453b0527314c54390dfaf46410b63bab7143 | Python | 5,333 | 133 | import os
import sys
import numpy as np
import argparse
import pandas as pd
from typing import List, Tuple
from pathlib import Path
class DNASequenceAnalyzer:
"""Analyzes DNA sequences to predict if they are lysogenic or lytic."""
VALID_NUCLEOTIDES = set("ACTG")
KMER_SIZE = 6
STEP_SIZE = 1
SEQUENC... |
e9f307620daf4ca7f5b917501d3b5fafde1e28b6b5da205761e7d9d1a3486bde | Python | 5,333 | 180 | # 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... |
71b8baeb864d14ad8ce372df6191eb8774c01365650cd11de5dce7b784c0b0f6 | Python | 5,334 | 134 | import os
import pickle as pkl
import sys
import time
# from datetime import time
import networkx as nx
import numpy as np
from tqdm import tqdm
from utils.data_utils import load_data_lp
def hyperbolicity_sample(G, num_samples=50000): ## uh oh don't fuck with this, go back and add og copy
curr_time = time.time()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.