sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
63196600dfdb34dd558181458a0b0d43ac8c023c8243f7efe8b7591b03d9417f | Python | 2,624 | 81 | import sys, math
from pybioshell.core.data.io import Pdb
from pybioshell.core.data.basic import Vec3
from pybioshell.std import vector_core_data_basic_Vec3
from pybioshell.core.calc.structural.transformations import *
from pybioshell.utils import LogManager
LogManager.INFO()
if len(sys.argv) < 2:
print("""
Cal... |
0e0b2508f7f839ac83036cfe75e9c18fa10caca133b51c83b5574f8b4c835ec1 | Python | 2,625 | 79 | import numpy as np
import os
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import scipy.io as sio
import torch
import re
def generate_param_for_main(args):
main = os.getcwd()
dict_fn = os.path.join(main, 'src/BSA_Phantoms/Additional_Data', 'dict_bsa.mat')
Reco_Net_name = os.path.join... |
2742002808cdf50acd7b487a6bc681bcc121cac99bdd3a6c1da738118ed929e7 | Python | 2,626 | 52 | from collections import deque
from pddlstream.language.constants import get_prefix, get_args
from pddlstream.language.stream import Stream, StreamInfo
from pddlstream.language.external import parse_lisp_list
from pddlstream.language.generator import from_test, universe_test
from pddlstream.language.conversion import l... |
a8e71cac43cbeda0dc723ad24577369e05e4063b4aa0d98a97801aadad9de1cf | Python | 2,626 | 91 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import os
import numpy as np
#filePath = os.getcwd()
#filePath = "/mnt/d/repositories/rodent-tracking/test_data/"
filePath = "~/repositories/sussex_neuro/rodent-tracking/test_data/"
#oneDirUp = os.path.dirname(filePath)
#filePath = oneDirUp... |
0bc324bf54dcc5082920593215c7e0c48d0d08b9c28dd29118b49dc1019dd87d | Python | 2,627 | 50 | import sys
import os
import subprocess
import argparse
######################
## PARSE ARGUMENTS ###
######################
parser = argparse.ArgumentParser(description='MicroKPNN')
parser.add_argument('--data_path', type=str, required=True, help='Path to data')
parser.add_argument('--metadata_path', type=str, requir... |
38a1bfa9efacede1639d19ddb5fd047a984cd4809458a4a217f4d655b141d9fd | Python | 2,627 | 63 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from common_setup import IssueConfig, IssueExperiment, is_test_run
BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"]
REVISIONS = ["issue535-base", "issue535-v7"]
CONFIGS = [
IssueConfig(
... |
66856ad0ed46ab94b3d35942901c30f3b5a7b06ef82c139cdef46178e6a716fd | Python | 2,627 | 86 | # 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... |
13841eb0d6f02980fa7022313206f57f2a2ddb1e41d8bb23f38d088a143bf639 | Python | 2,628 | 91 | import os, sys
import numpy as np
import nibabel as nib
import hcp_utils as hcp
import networkx as nx
dir_surf = r'/Users/weiwei/BaiduCloud/Work/Paris/HSV/Surfs'
slh = os.path.join(dir_surf, 'S1200.L.midthickness_MSMAll.32k_fs_LR.surf.gii')
srh = os.path.join(dir_surf, 'S1200.R.midthickness_MSMAll.32k_fs_LR.surf.gi... |
301c8355b3a70dfdff9d0f97696d5ade82f8a05074fb2c6e06408f7d38e08fe8 | Python | 2,628 | 75 | # 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... |
7773cb7e647d26e96c82d86f6a7ecb4615e7980a3c79e7090ea18ceb145d629c | Python | 2,628 | 62 | import torch
from torch import nn
from torchdrug import core, models, utils
from torchdrug.layers import functional
from torchdrug.core import Registry as R
@R.register("models.KBGAT")
@utils.copy_args(models.GraphAttentionNetwork)
class KnowledgeBaseGraphAttentionNetwork(models.GraphAttentionNetwork, core.Configura... |
b84f272a2755f1c46c55f3e99093e2eca62b245655ec183167bbda7b1d3155f7 | Python | 2,628 | 66 | import datasets
import lightning.pytorch as pl
from hicdiffusion_encoder_decoder_model import HiCDiffusionEncoderDecoder
from lightning.pytorch.callbacks import ModelSummary
import os
import shutil
from lightning.pytorch.loggers import WandbLogger
import time
import argparse
from lightning.pytorch.callbacks import Mode... |
49cd48525999bb9f82011487a81c2ebac275e7fa3df6ec770b2d263c3fc0fe25 | Python | 2,629 | 113 | from __future__ import annotations
import pytest
parsl = pytest.importorskip("parsl")
from quacc import flow, job, subflow
def test_parsl_decorators(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
@job
def add(a, b):
return a + b
@job
def mult(a, b):
return a * b
@jo... |
43b892495ee4f34719f53f3570555ebab4815e637ae9a7650081e6f8b8fc1357 | Python | 2,630 | 62 | import numpy as np
import nibabel as nib
import os
import pkg_resources
#import subprocess
#toolsdir = pkg_resources.resource_filename('ActflowToolbox.tools', '/')
#glasserfile2=toolsdir+'Q1-Q6_RelatedParcellation210.LR.CorticalAreas_dil_Colors.32k_fs_RL.dlabel.nii'
dependenciesdir = pkg_resources.resource_filename('A... |
7cf6f9c8c6934d134054be24028886845d8cc0056335614279f2cba38c0950b3 | Python | 2,630 | 47 | import unittest
from parameterized import parameterized
from HyDGL.enums.hydrogen_mode import HydrogenMode
from HyDGL.enums.sopa_resolution_mode import SopaResolutionMode
from HyDGL.enums.bond_order_type import BondOrderType
from HyDGL.graph_generator_settings import GraphGeneratorSettings
class TestGraphGeneratorSe... |
16eb223fc024d827e0b98f9f89a3aa7f1b7e13752ece9421beabc825fa156135 | Python | 2,631 | 90 | import numpy as np
from burst_space import BurstSpace
from help_funcs import load_exp_variables
# ----- #
# Dataset selection.
data = "dreyer2023" # "zhou2016", "2014004", "2014001", "munichmi", "cho2017", "weibo2014", "dreyer2023"
remove_fooof = False # True, False
# Mode.
mode = "local" # "local", "cluste... |
c79a28e38d8d12cc4c4637774952207988fc45b76c40f83ff0f1bda674584ca9 | Python | 2,631 | 87 | import pytest
from elasticai.creator.ir import (
AttributeMapping,
attribute,
)
def test_nested_attribute_map_is_immutable() -> None:
a = AttributeMapping(x=1, y=2)
b = AttributeMapping(a=a, b=(3, 4))
c = b.new_with(a=a.new_with(x=10))
assert a["y"] == 2
assert b["a"]["x"] == 1
assert... |
d57b6a834d6cd30efa8da77b937e9bc6244315cd0f66bbab01a68b47c0a397f1 | Python | 2,631 | 61 | import os
import torch
import logging
from torch.optim import lr_scheduler
from torchdrug.utils import comm
from torchdrug import core, utils, datasets, models, tasks
logger = logging.getLogger(__file__)
def build_ppi_solver(cfg, train_set, valid_set, test_set, use_solver=False):
task = core.Configu... |
f249711d2315b8d3a918a86ba0fe28b0c5e34d8ec66103883f5e37481ce77959 | Python | 2,631 | 64 | from feature_extractor import FeatureExtractor
from feature_extractor333 import FeatureExtractor
from models import vit_giant_patch14_224
import torch
import torch.nn as nn
import os
import numpy as np
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
ckpt_path = "E:/LLM/video_feature/Vi... |
82824f6735ee1f1e0efb85c512e082d50abcc230160c6bf7d6288a65139a70dd | Python | 2,632 | 82 | from typing import Tuple, Union
import numpy as np
import PIL.Image
import torch
import torchvision
import yacs.config
class CenterCrop:
def __init__(self, config: yacs.config.CfgNode):
self.transform = torchvision.transforms.CenterCrop(
config.dataset.image_size)
def __call__(self, data... |
cd6831e8614f6d6af7ef84195b8bb75ac0e94fe99ac4e5401039005b233abc19 | Python | 2,632 | 83 | import pytest
import numpy as np
@pytest.fixture(scope="session", autouse=True)
def set_seed():
np.random.seed(42) # noqa: NPY002
import logging
from ase.io import read
from pathlib import Path
from quacc import get_settings
from ts_workflow_examples.neb_ts_without_hessian.using_mace import neb_ts_no_hess_ir... |
e1580641b2b21a7fb116629cc567616d83ff2332ba844647526ce47ad0afb6c5 | Python | 2,632 | 36 | """posthoc_sff_pairs_continue_2026-09-29.py (POST HOC, descriptive). SFF_PAIRS (prereg 28e) hit its pre-registered cap of 4
steps while still improving (loss 2,684 = 4x the truth's, 89.7% correct; verdict ESCAPES). Same algorithm continued from its
end point: steepest descent over 95 single flips + 190 pairs among the ... |
a10d702296f335b58028719922988d8a2016d08b0d134ba123b5d44336814d9c | Python | 2,634 | 59 | import scanpy as sc
import numpy as np
import pandas as pd
def find_neighbouring_clusters(sample,barcode_grid,mclust_result,i_row,i_col):
neighbours_clusters = []
if barcode_grid[i_row,i_col] is None:
return neighbours_clusters
neighbours = [[i_row,i_col-2],[i_row,i_col+2],[i_row-1,i_col-1],
... |
34bb3193137ec8483308c589dfec0bdfa5524456da45d391c44825e4feb902a0 | Python | 2,636 | 59 | #!/usr/bin/env python
## this script creates dataframes from the upper triangle for control distance matrices (age, sex)
## and saves them to a new CSV file
## The dataframes contain the distances values for each pair of subjects.
import pandas as pd
from pathlib import Path
# Load the all pairs list
data_dir = Path(... |
5fb25bf416af419b4b5f23d9a578bd717c3b09083589fd0860c94ddca7d3207d | Python | 2,637 | 61 | # regtools/tests/test_orient_overlay.py
import numpy as np
import pytest
from regtools.registration.gui.orient_overlay import orient_image_and_points
def _img_with_marker(h, w, r, c):
a = np.zeros((h, w), np.float32)
a[r, c] = 1.0
return a
@pytest.mark.parametrize("angle", [0.0, 90.0, 180.... |
dadb47e7d4d03e7be18f1ae5f472aed7cb4a481a288c19a3a83e3b8d1bc783f8 | Python | 2,637 | 71 | import numpy as np
import scipy.sparse as sp
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from utils import to_sparse_tensor
class PolyGraphConvolution(nn.Module):
def __init__(self, adj_pow, in_features, out_features, rand_seed):
super().__init__()
self.in_feat... |
e57cea23ea23fc1229b306b98cd73e6ae84ae6de9fd9c9bdcc2db444e576deb9 | Python | 2,637 | 89 | # 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... |
13b7678984c5e959d19fd586e47ca889beb0b5bfd3349c21edb068f3cb62b567 | Python | 2,638 | 101 | import argparse
from pathlib import Path
def add_phosphorylation_arguments(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--mesh-folder",
type=Path,
default=Path.cwd().parent / "meshes-phosphorylation",
)
parser.add_argument(
"-o", "--outdir", type=Path, de... |
c1bf306b4a2815f59cf76ff624d7dd505f0e8227cc567a402f22c5efb70988c6 | Python | 2,638 | 85 | from datetime import datetime
from pytest import raises
from PyQt5.QtWidgets import QAction
from wonambi import Wonambi
from wonambi.widgets.traces import _convert_timestr_to_seconds
from wonambi.widgets.modal_widgets import SVGDialog
from wonambi.widgets.utils import export_graphics
from .test_scroll_data import fin... |
219a4885427af933e12898e28a77089197ca6662b151b6641a17d1b5d5bb8610 | Python | 2,639 | 66 | #!/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 ... |
1c68c7dd354543b2c408f41c46aeaf6bc0d61f6d05cc8843dee8b6d0cc4d0a63 | Python | 2,640 | 73 | """Launch an OME-Zarr conversion job in an external terminal with colored output.
Mirrors the registration GUI: writes the job JSON + a temp ``.bat`` (UTF-8 code
page, run the CLI, record exit code, delete the lock file, pause, self-delete)
and spawns Windows Terminal (or ``cmd``). The GUI polls the returned lock-... |
9953bd4787f47167cec13be7f1a15777aad86eb09f77c34e4cf887d100179ccd | Python | 2,641 | 210 | # 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... |
6ad2c3dee726cb3df44aa5ae1b5c678757b2cedeff4871631de19d4460060af9 | Python | 2,642 | 80 | # 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... |
94aeb7256c9c4bc8438be39750379a4bf413747065cce32a755442ef3bb5d4a8 | Python | 2,642 | 38 | """REST_DEPRESSION.py 2026-09-28. Pre-registration: 04-NOTES/PREREG-2026-09-28d-REST-DEPRESSION.md
AT_REST again (input A), with depressing ORN output synapses (f = 0.72, tau = 2.4 s; Kazama & Wilson 2009), each ORN
starting at its steady state. Does the laboratory prior become quiet, and does the published model still... |
fb316bda57fc9bb77df00c03006971ab71bd387f13f8c513a6ec4e65fec03886 | Python | 2,642 | 72 | """
This script computes the averaged-ROI ts for the movie data. It also performs
the scrubbing and saves the matrices.
@author: trianaa1
"""
import sys
import numpy as np
import pandas as pd
from scipy.io import savemat, loadmat
#from brainiak.isc import isc, compute_summary_statistic
sys.path.append('/m/cs/scra... |
cd49794cf25e2436f312a6f2ce6042af91fa743b287b0a936ef943499b2fa6f3 | Python | 2,644 | 94 | # 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... |
718776a60c002639028b47196b70b3373e7f193791c17324207c2729b9141332 | Python | 2,645 | 81 | """
Optuna example that demonstrates a pruner for CatBoost.
In this example, we optimize the validation accuracy of cancer detection using CatBoost.
We optimize both the choice of booster models and their hyperparameters. Throughout
training of models, a pruner observes intermediate results and stop unpromising trials... |
b4ebee910cd3400c0667d142a4c120a21e9164d07c48b36055124d1f457d80d1 | Python | 2,645 | 59 | # Function to interpolate based on PCHIP rather than MNE inbuilt linear option
import mne
import numpy as np
from scipy.interpolate import PchipInterpolator as pchip
import matplotlib.pyplot as plt
def PCHIP_interpolation(data, **kwargs):
# Check all necessary arguments sent in
required_kws = ["trigger_indic... |
c80836d8b4d140eed5bb32cf3ad1144f0a7a2f5e1f228304215bd2b56a13d4df | Python | 2,646 | 71 | #! /usr/bin/env python
from lab.parser import Parser
parser = Parser()
parser.add_pattern('actual_search_time', 'Actual search time: (.+)s \[.+s\]', required=False, type=float)
parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int)
parser.add_pattern('ms_construction_time... |
035565c2072455ed252662a30fd2fa9aaa963c50b5f2f948cec1851b4fb1c39b | Python | 2,647 | 88 | import os, glob, torch, shutil
import numpy as np, pandas as pd
from torchvision import transforms
from importlib_resources import files
import m6atm.preprocess.ReadClass as RC
import m6atm.train.ModelData as MD
def predict(args):
# args
data_dir = args.out if args.out else ''
tx_file = args.tx
... |
67d9c1befb0b3b3c467c640114564c5a5facbb2afaf9e1031be57d9b6b63b5bc | Python | 2,647 | 78 | from typing import Any
import torch
from elasticai.creator.arithmetic import (
FxpArithmetic,
)
class RoundToFixedPoint(torch.autograd.Function):
@staticmethod
def forward(ctx: Any, *args: Any, **kwargs: Any) -> torch.Tensor:
if len(args) != 2:
raise TypeError(
"apply... |
688dc731ec7923ca93de715e3b90aeb22d0e578e73580e3d26c8297f7539db59 | Python | 2,647 | 101 | from elasticai.creator import ir
from elasticai.creator.ir2vhdl import IrFactory, Shape
from elasticai.creator_plugins.grouped_filter import FilterParameters
from elasticai.creator_plugins.time_multiplexed_sequential.src import (
sequential,
)
from .high_level_network import network
_factory = IrFactory()
def t... |
94c4cb55e2bd5d0aad774fcce0db2f3f7c1235d73ea74d62e51ba1faba2831bb | Python | 2,647 | 59 | #!/usr/bin/env python
## this script creates dataframes from the full distance matrices for control matrices (age, sex)
## and saves them to a new CSV file
## The dataframes contain the distances values for each pair of subjects.
import pandas as pd
from pathlib import Path
# Load the all pairs list
data_dir = Path('... |
b9645b06ee1d9407529d77cdfb9d0b3fd46d9750416e70f1baf462221a96ce00 | Python | 2,647 | 27 | """posthoc_share_decomposition_2026-10-03.py — descriptive, written during the 3 Oct correctness audit. The report (Section 5)
split the published file's 65.2% excitatory share of antennal-lobe local-neuron output into "19.9 points from cells without a
call or a label, 13.0 from cells called serotonin, dopamine or octo... |
cbac9e32ffab3ceadd897a0caa51fe8b51fb1ee2408e51407eed24230763ebda | Python | 2,647 | 68 | import json
import unittest
from hed.tools.analysis.column_name_summary import ColumnNameSummary
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.columns1 = ["a", "b", "c"]
cls.columns2 = ["onset", "duration"]
cls.columns3 = ["a", "b", "c", "d", "e"]
cls.co... |
6c4b2f2ca841a508c81ffefa0bab0530837f20b874311de841f55d335ab08134 | Python | 2,648 | 90 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 7 16:50:50 2023
@author: felipe
"""
import os
import sys
sys.path.append(os.path.abspath('../'))
from multiprocessing import Lock
from model.KuramotoClassFor import Kuramoto
import concurrent.futures
import itertools
import gc
import numpy as np
... |
844c61bc08d2fe05c92935fe9bfd5a0b22340f50009258d5301e7e6917686d9c | Python | 2,648 | 77 | from BoundingBox import *
from utils import *
class BoundingBoxes:
def __init__(self):
self._boundingBoxes = []
def addBoundingBox(self, bb):
self._boundingBoxes.append(bb)
def removeBoundingBox(self, _boundingBox):
for d in self._boundingBoxes:
if BoundingBox.compare... |
c4f3dcb9f61457b3576a747f253c63b98c2a1a36ac5e993cc5510c7e90288fcd | Python | 2,648 | 70 | #!/usr/bin/env python
import sys
import re
from datetime import datetime,timedelta
import argparse
parser = argparse.ArgumentParser(description='summary vmstat log.')
parser.add_argument('log_file')
parser.add_argument('-s', '--start_time', help='start of effective time')
parser.add_argument('-e', '--end_time', help=... |
f4b8d16abee2b63e2c597c3c55fb6c4a577b32b717264cdb8a57f313fb567542 | Python | 2,648 | 82 | # 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... |
958468ffd9b418f7ee76142dd859ae13ffee953fd6517533ed33e591cdce6144 | Python | 2,649 | 90 | """Graph decoders."""
import manifolds
import torch.nn as nn
import torch.nn.functional as F
from layers.att_layers import GraphAttentionLayer
from layers.layers import GraphConvolution, Linear
import utils.math_utils as pmath
class Decoder(nn.Module):
"""
Decoder abstract class for node classification tasks.... |
a193488a6785b6f143905cfaab48d02fd91837e2d60138660cba78890becc2c4 | Python | 2,649 | 98 | # Node group "XPBD Finalise" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerate... |
2499ac87c952e3d0fc4ddc65a3126e81e13cefa6b40344c0512ec4cbc40fcc94 | Python | 2,650 | 75 | #!/bin/env python3
"""
Visualise the process to detect PDLs
"""
import ithildin as ith
import numpy as np
import matplotlib.pyplot as plt
import sys
from typing import Union, Dict, List
sd = ith.SimData.from_stem("results/pdl-detection/phase_68")
dt, dz, dy, dx = sd.deltas
Nt, Nz, Ny, Nx = sd.shape
t = sd.times
x, y =... |
929dff060836cdacb67d84b1c76d1985c23064a4dc0f7029247bc30ab146cacb | Python | 2,650 | 68 | # -*- coding: utf-8 -*-
import itertools
import nltk
from supar.models.const.crf.transform import Tree
from supar.models.dep.biaffine.transform import CoNLL
class TestCoNLL:
def istree_naive(self, sequence, proj=False, multiroot=True):
if proj and not CoNLL.isprojective(sequence):
return F... |
f6a7a80fc9557866d47528cdc2e67b83370322a51ae67eb9e3fb9ede6dc56547 | Python | 2,650 | 79 | from glob import glob
from itertools import chain
from os.path import exists
from pathlib import Path
import numpy as np
import torch
from elasticai.creator.arithmetic import FxpArithmetic
from elasticai.creator.file_generation import find_project_root
from elasticai.creator.file_generation.on_disk_path import OnDisk... |
dc0dac1331dcead5a03b2e7b264fa077031bc766529ea1b46e267170bb5dcc73 | Python | 2,651 | 68 | import os.path
import gzip
import re
from ckg.graphdb_builder import mapping as mp, builder_utils
def parser(databases_directory, drug_source, download=True):
config = builder_utils.get_config(config_name="siderConfig.yml", data_type='databases')
url = config['SIDER_url']
header = config['header']
ou... |
59d60ada8edda6e2ea1a5b443f250c84526a2f28a67bb2ea7da1a8c70e606e7f | Python | 2,652 | 81 | """Detect the host state the wizard needs: CUDA build, target interpreter,
Windows long-paths, existing venv. Stdlib only."""
import os
import re
import shutil
import subprocess
import sys
def cuda_wheel_tag(cuda_version):
"""Best PyTorch cu* wheel tag for a driver's CUDA version (None = CPU)."""
... |
80a6be82f71566e9cf816b5a11fb588a88fb890faf0cba5eb75f96ecbb2c9f81 | Python | 2,653 | 87 | import unittest
import torch
from torch_geometric.data import Batch, Data
from torcheeg.datasets.constants.emotion_recognition.deap import \
DEAP_GENERAL_REGION_LIST
from torcheeg.models import DGCNN, LGGNet
from torcheeg.models.pyg import GIN, RGNN
class TestGNN(unittest.TestCase):
def test_dgcnn(self):
... |
e15207d71f8853591f31390dfc9a472dec9d12e77d1d76f395d556c3fff3b5d4 | Python | 2,653 | 85 | """
Created on 25/05/2020
:author: Chinchien Lin
:summary: Copies the files contained in source field of the configuration file to destination field.
"""
import os
import sys
from shutil import copyfile
from src.commands.abstract_preprocessing_command import AbstractPreprocessingCommand
from src.utils.pa... |
e5d2799fd06af8c1f4bc6dd3812c03c114483909893f87a9c33e680129e58c97 | Python | 2,653 | 68 | import warnings
from os.path import join as path_join
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from network import networkDictFromDump
from theory.rates import solve, initial_rates_uniform
net_hash = '8757444d0e17c59775b273562693e60b'
sim_hash = 'b... |
c1c134ac86c0a45bdbd1a737070449331913a7f80323037069f0e14214db1f5e | Python | 2,654 | 82 | # 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... |
0200a96cbe64821cdae81e897d3a1f0d7301b99f53059bb93f5649554cff6d72 | Python | 2,655 | 42 | # -*- coding: utf-8 -*-
import argparse
from supar import VIConstituencyParser
from supar.cmds.run import init
def main():
parser = argparse.ArgumentParser(description='Create Constituency Parser using Variational Inference.')
parser.set_defaults(Parser=VIConstituencyParser)
subparsers = parser.add_subp... |
04d4ca1ad4c1f889a0d92620224a1bb0dca216cef11ff7e10cb147deef901c27 | Python | 2,655 | 57 | """code for defining a relationship between object detection data and one or more behaviors of interest"""
import logging
import cv2
import pandas as pd
logger = logging.getLogger(__name__)
class BehaviorRecognizer:
def __init__(self, config):
logger.debug('Beginning BehaviorRecognizer initialization')
... |
2c32f04761bd08eea70a0a8e7be151149a95603504c86b1b443024c04fb897dc | Python | 2,655 | 88 | import os
import csv
import pandas as pd
from typing import Dict
class MetaInfoIO:
r'''
Use with torcheeg.io.EEGSignalIO to store description information for EEG signals in the form of a table, so that the user can still analyze, insert, delete and modify the corresponding information after the generation i... |
9fc8e8f21b3067f3b654dc2985df4a98a9d029d2fbc0b3800a6ef0f987e3da8b | Python | 2,655 | 93 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : common_func.py
# Author : Yufeng Liu
# Date : 2022-12-20
# Description :
#
#===================... |
c00256025fbc5aa5b330031c756b050f7b710ad8b3a0b3fb5e613b70ea4a035b | Python | 2,655 | 87 | import numpy as np
import pytest
from ase import Atoms
from ase.build import bulk
from ase.calculators.emt import EMT
from ase.calculators.lj import LennardJones
from ase.io import read
from sella import Sella
def _read_sella_log(path):
lines = path.read_text().splitlines()
header = next(line for line in li... |
e87aed3bbdb3711f11917a54199d1f5a1b9631719ff9cb195566e94c53c5e9b4 | Python | 2,655 | 83 | # -*- coding: utf-8 -*-
"""
Created on Jun 2 2023
@author: Jonas A. Thiele
"""
### Get results of prediction models trained in the main sample
### (610 subjects of the HCP) with FC (links) between specific nodes (corresponding to intelligence theories),
### links between randomly chosen nodes, and randomly c... |
fb751741ec1b4f4c8c84c764cd15df5c6027b662c81fb42de1af4795ff08e7f6 | Python | 2,655 | 64 | from __future__ import annotations
import os
from .api import PlatformDirsABC
class MacOS(PlatformDirsABC):
"""
Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
<https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSys... |
5f201b2007108c07c6dfa4e23bcb799989f644aae4572df29b87f15d8dd74dcc | Python | 2,656 | 56 | """The plugin's own panel: configure the gated interface, select it, run its experiment, watch the gate."""
from collections import deque
from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWidget
from liquidaion_fly.plugin_api import PluginError
from liquidaion_fly.ui_plugins import Paramet... |
c8d6a16886a868fa63de577299c0398d4291a469ec1b4a9e584d23aa23a7120b | Python | 2,656 | 63 | import numpy as np
import nibabel as nib
import os
import pkg_resources
#import subprocess
#toolsdir = pkg_resources.resource_filename('ActflowToolbox.tools', '/')
#glasserfile2=toolsdir+'Q1-Q6_RelatedParcellation210.LR.CorticalAreas_dil_Colors.32k_fs_RL.dlabel.nii'
dependenciesdir = pkg_resources.resource_filename('A... |
dfa51277db1d6c489b5d4919ea07b941b78a002accb9d3e46d9df15aeab6d55b | Python | 2,657 | 64 | # regtools/registration/gui/batch_2d_run.py
"""Translate a BatchRow into a single-2D RegistrationOpts.
Pure (no Qt) so arg assembly is unit-testable. ``build_job_batch_lines`` (the
shared per-job .bat writer, also used by RegistrationTab._thread_register) now
lives in ``job_bat.py`` and is re-exported here for ba... |
73de31db3f271c6a3b54ed3176e3d4af12356dd38876bb291a845fc1417c57a1 | Python | 2,658 | 77 | import torch
import torch.nn as nn
from utils.utils import sequence_mask
import math
class PositionalEncoding(nn.Module):
def __init__(self, d_model, max_len=5000, dropout=0.1):
super(PositionalEncoding, self).__init__()
self.dropout = nn.Dropout(p=dropout)
pe = torch.zeros(max_len, d_mode... |
934622c60efb981972425eb7015d7ce477dfbef6f0ce3fbe4fbc988e503ae5d1 | Python | 2,658 | 81 | """Rotation alignment - port of rotation_alignment.m."""
from __future__ import annotations
from pathlib import Path
from typing import Tuple
import numpy as np
from imageio.v2 import imwrite
from scipy import ndimage as ndi
from scipy.spatial import ConvexHull
from skimage import transform
from .bb_al... |
cb5da3e7565f93847b343bcf4fa364f53144068a5d16aa2e4ebc74539598b61c | Python | 2,658 | 78 | # from .utils import load, save, isna, isnaor
from . import utils
from .preprocess import *
from .model import *
from .train import *
from .data import *
from .inference import inference_warpper
# from .nano import *
# from .nanoprep import *
import argparse
parse_dict = {
# 'preprocess': {
# 'help': 'pre... |
0d08e397f32b3e2b43fa725c64670206daef950bdd2d34055a9cebe33f7f6991 | Python | 2,659 | 75 | # 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... |
4b45c3896b60032fc3d9784aab4d78c963bd008d068954c1c5bf985d6fad84fe | Python | 2,659 | 84 | from copy import deepcopy
from typing import Dict, Union
import numpy as np
from torcheeg.transforms import EEGTransform
def get_swap_pair(location_dict):
location_values = list(location_dict.values())
eeg_width = np.array(location_values)[:, 1].max()
visited = [False for _ in location_values]
swap_... |
56776150053c161127aca82b409038d27c5d17a342558a1b440343ab54daed25 | Python | 2,659 | 83 | import itertools
import matplotlib.pyplot as plt
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.misc import flatten
from autograd.misc.optimizers import adam
from autograd.scipy.stats import norm
def init_random_params(scale, layer_sizes, rs=None):
"""Bui... |
64648d94505e4a524a64e97d6800861a64b06750ffd450192f639deb977acbfe | Python | 2,659 | 83 | import torch
from prosper_nn.utils import sensitivity_analysis
from prosper_nn.models.hcnn import HCNN
def test_sensitivity_analysis():
in_features = 10
out_features = 5
batchsize = 3
n_batches = 4
model = torch.nn.Linear(in_features=in_features, out_features=out_features)
data = torch.randn(n... |
8721d90d7e74bb0ad2412c78516148f0fe4d1f6b2c9ac25b74e8b847744f47f3 | Python | 2,659 | 48 | import os
# These are configuration parameters for use in the real-time pupillometry PsychoPy script and the associated Python simulation code.
# The goal of having this file is things that a user may wish to change, but likely
# will not have to. For example, information about the experimental setup, or the visual ... |
8e3f67b876aa9c66d3b06176abfaf7a6852fe6bfcfbd3fd1b42dbcb5a51f5880 | Python | 2,660 | 74 | """`_drop_small_components` is a bincount rewrite; pin it to the naive loop.
The original was
for label in range(1, all_labels.max() + 1):
if (all_labels == label).sum() < min_size:
edges[all_labels == label] = 0
i.e. TWO full-slice passes per connected component -- O(L*N) per slice, run ... |
ab3a80277bb352a69b13a5c34ff31d70aaf2bee0265208ac8a9a4dc2f1e4da5f | Python | 2,660 | 80 | import os
import sys
import time
from datetime import datetime
import logging
import numpy as np
import torch
import math
def get_timestamp():
return datetime.now().strftime('%y%m%d-%H%M%S')
def mkdir_and_rename(path):
if os.path.exists(path):
new_name = path + '_archived_' + get_timestamp()
p... |
bd5c6bc1ca358f0a32ab4f1cbc105147485e56c0f72ac1cebda0a863e63e4158 | Python | 2,660 | 96 | """MPI operations
-----------------
Gatherv implementation.
"""
import numpy as np
from mpi4py import MPI
COMM = MPI.COMM_WORLD
RANK = COMM.Get_rank()
def GathervRecordArray(data, op=MPI.COMM_WORLD.Gatherv, root=0):
"""
Simplifies `MPI:Gatherv` for structured/record ndarrays with mixed data types
(int... |
fa4082139f71e966f6e2932529a726ee3c3be50c22d67d625519ea057a3d53ab | Python | 2,660 | 96 | #!/usr/bin/env python3
"""
Here we plot the task performance by parsing the logfiles
onset - time in seconds
duration - duration of event
sample - the current volume
trial_type - codes for what is in the logfile
TRIAL_TYPE contains DOT_FLIP, KEYPRESS, TRIGGER and FINISH
This will show intervals where there are more ... |
2ce4cbaab1d24984a200c037ff972726c4dd18dc7ca920724ee9c23775870640 | Python | 2,661 | 89 | from __future__ import division
from functools import partial
import logging
import numpy as np
"""
Created on Mon Aug 20 20:30:31 2018
@author: Hannah Choi
"""
"""
This code contains functions needed for mapping CC clusters to FF/FB by
maximizing the global hierarchy score of the given cortico-cortical ... |
59a03f5befb36f92341b99ecf2d7368a758079c0a8da37cae5980f38d26337ba | Python | 2,662 | 82 | from typing import Dict, List, Union, Optional
from ..base_transform import LabelTransform
class Normalize(LabelTransform):
r'''
Normalize the label using min-max normalization or standardization.
For min-max normalization:
.. code-block:: python
from torcheeg import transforms
t =... |
9605656912bc3b08bd2ae510ca72e343a096603783d8b077fc8e644dc2bd78e3 | Python | 2,662 | 84 | # Node-group asset "Chain ID" (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_CHECKING
from... |
41b4b088c159d9e0e0ad4ec9b2ea0a277b3e520c342a92ea0b151174a7f04374 | Python | 2,663 | 86 | from abc import abstractmethod
from pathlib import Path
import numpy as np
import model.baseline as model
import utils.runner.metric as module_metric
from parse_config import ConfigParser
from utils.logger import TensorboardWriter, get_logger
class BaseFitsManager(object):
'''
Base class for all fits manage... |
e595f80848379e15ace008ab06cd56012313c4029a5ab6487ee2095ef4278a43 | Python | 2,663 | 122 | # 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... |
d720887aeca925079d3fc9936ade406cc96a1383e57128c0c196c85ee7f11e8a | Python | 2,664 | 56 | """Test digital down converter (DDC) functions."""
import numpy as np
import pytest
from scipy import signal
from console.utilities.ddc import filter_cic_fir_comp, filter_moving_average
@pytest.mark.parametrize("num_coils", [1, 2, 4])
@pytest.mark.parametrize("num_samples", [8000, 9511, 80640])
@pytest.mark.parametr... |
09ac50330a4985c62b6d751d678d813f84146c5839ba3c066f3a9e1c98673014 | Python | 2,665 | 87 | from importlib import import_module
from pertpy._jax import jax_import
from pertpy.tools._augur import Augur
from pertpy.tools._dialogue import Dialogue
from pertpy.tools._distances._distance_tests import DistanceTest
from pertpy.tools._distances._distances import Distance
from pertpy.tools._enrichment import Enrichme... |
944e59bce04d3777e746c365a7c4e18e579793f373084efdc885d48f43324e1e | Python | 2,665 | 88 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
REVS = ["issue481-base", "issue481-v1"]
SUITE = suites.suite_satisficing_with_ipc11()
CONFIGS = [
# Greedy (tests single and alternating open lists)
IssueConfig("eager_greedy_ff"... |
15fd52d7e285c560d6e405bb51c91e5d964e0b6c844270c70412077c71b37e80 | Python | 2,666 | 98 | """General utility functions that are re-used in different scripts."""
from os import path
from pathlib import Path
import json
import click
from mne.utils import logger
from mne import sys_info
# get path to current file
parent = Path(__file__).parent.resolve()
# ---------------------------------------------------... |
a0c76e6b0e902fe94a368de9df13983b42fc32de9e43324949b6c2c25aaa57ae | Python | 2,667 | 64 | import os.path
import zipfile
from ckg.graphdb_builder import builder_utils
from collections import defaultdict
###################
# CORUM #
###################
def parser(databases_directory, download=True):
entities = set()
relationships = defaultdict(set)
directory = os.path.join(databases_di... |
23b8f174681902a7fa352ee08ef82bf6adc5b3ec47922c1a6d362f0029ef51b9 | Python | 2,668 | 88 | """
https://github.com/MIPT-Oulu/Collagen/blob/master/collagen/modelzoo/segmentation/backbones.py
"""
import torch
import torch.nn.functional as F
from torch import nn
from torchvision.models import resnet18, resnet34, resnet50
from model_utils.modules import Module
class ResNetBackbone(Module):
"""
Exten... |
b55dde9589c428f81ad2bc3c4dcd38631b8f22080be299242b081227931f7403 | Python | 2,669 | 86 | # 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 applicable law or agreed to in writing, software
# distributed under th... |
eee9a895242870b976dccddcc5eb5521cca6a1d953721e32e18dc88a9e38926f | Python | 2,670 | 45 | #*******************************************************************
# Python Script for Extracting 2D Slices from 3D Fluorescence Images
# Date: December-2023
#*******************************************************************
# This script processes 3D fluorescence microscopy image stacks,
# extracting individual 2... |
907662420a586df573b0210001d3b93c20a394204b31e1af1b4e412865e7b3eb | Python | 2,671 | 64 | from importlib.util import find_spec
import numpy as np
import pytest
if find_spec("formulaic_contrasts") is None or find_spec("formulaic") is None:
pytestmark = pytest.mark.skip(reason="formulaic_contrasts and formulaic not available")
from pertpy.tools._differential_gene_expression import AVAILABLE_METHODS
@... |
a2028964c71ea87a1474c4df0bcaffbff83a0daf100a556ce827dd7ef206e9d9 | Python | 2,671 | 90 | # Node-group asset "Offset Index" (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_CHECKING
... |
f4d8f360cfaafe5838932c891037e20fb68a63e67ff2e7e832c2693083a6b58b | Python | 2,671 | 69 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from common_setup import IssueConfig, IssueExperiment, is_test_run
BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"]
REVISIONS = ["issue696-base", "issue696-v1"]
CONFIGS = [
IssueConfig(
... |
3483a9e46dfeb84481942ce7512b831ca81c6299cae29c032a5a3678a3459dfd | Python | 2,672 | 68 | # 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... |
3bad1eef6428b47c487b894b5d2b549ae5c732e98f9760b5043e53ed43e8e0f7 | Python | 2,672 | 99 | from __future__ import annotations
import pytest
redun = pytest.importorskip("redun")
from pathlib import Path
from quacc import flow, get_settings, job, redecorate, strip_decorator, subflow
from quacc.wflow_tools.customizers import customize_funcs
@pytest.fixture()
def scheduler():
return redun.Scheduler()
... |
05d83f3eb5255a4c00386fca297b55ab116ef2e0fbacd5e68f7fcc7e89532938 | Python | 2,673 | 81 | """NIfTI format loader (.nii, .nii.gz) for volume_io."""
from __future__ import annotations
import numpy as np
try:
import nibabel as nib
_HAS_NIBABEL = True
except ImportError:
_HAS_NIBABEL = False
from regtools.utils.io.volume_io import (
VolumeData,
_error_volume,
_FORMAT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.