sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d7d64d2611efa254a2d09187cdd88c3068c6dfeb08d826bdd749bfba710b2092
Python
4,428
75
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm import common_setup def main(revisions=None): SUITE = suites.suite_optimal_with_ipc11() B_CONFIGS = { 'rl-b50k': ['--search', 'astar(merge_and_shrink(merge_strategy=merge_linear(variable...
5d3978c971d05e175caa8735fbcf6915c20df9c2266e7b33fd7436515a9b73e4
Python
4,429
85
import numpy as np import pytest ants = pytest.importorskip("ants") from regtools.registration.core.registration.two_stage import compose_two_stage, run_ants_intensity_split def _blob(shift=0): a = np.zeros((32, 32, 32), dtype="float32") a[8 + shift : 20 + shift, 8:20, 8:20] = 1.0 return ants.f...
e642cea2af9e4fb4dabe01359bfe55f3f1a237f5935f2d79d4b8e7fad3d9c4cb
Python
4,431
102
"""Patches that are applied at runtime to the virtual environment.""" from __future__ import annotations import os import sys from contextlib import suppress VIRTUALENV_PATCH_FILE = os.path.join(__file__) def patch_dist(dist): """ Distutils allows user to configure some arguments via a configu...
f59f28b4e98cfadcb19f24e876f5e579cb4feb49706a18c68834eb6ebc4f4938
Python
4,431
149
import inspect from functools import partial from typing import ( Any, Callable, Iterable, List, Optional, Tuple, Type, TypeVar, Union, overload, ) T = TypeVar("T") Result = Iterable[Union[Any, Tuple[Any], Tuple[str, Any], Tuple[str, Any, Any]]] RichReprResult = Result class...
00ecd22b48303e0e126cf94518ee313f830ba4e923eb1db7c6b007796003bb73
Python
4,433
124
from timm.models import ByoModelCfg, ByoBlockCfg, ByobNet from ._base import EncoderMixin import torch.nn as nn class GERNetEncoder(ByobNet, EncoderMixin): def __init__(self, out_channels, depth=5, **kwargs): super().__init__(**kwargs) self._depth = depth self._out_channels = out_channels...
58267f3b0fe4a9ea0ad4e453d47addb4e566f45953e33817acb1ca9bfb8af124
Python
4,433
70
import argparse from train import main parser = argparse.ArgumentParser(description='Train prototypical networks') # data args default_dataset = 'geometry' default_split = 'sable-meyer' parser.add_argument('--data.dataset', type=str, default=default_dataset, metavar='DS', help="data set name (def...
722d37717cd6a4d993efd09f9015f7e00fb9976f128d03591698c076b4f65af3
Python
4,434
115
from typing import Any, Optional, Dict import numpy as np from models.model import Model from models.kan_layers import KAN import torch import torch.nn as nn from torch.nn import init import torch.optim as optim class MLP_KAN_Net(nn.Module): """ Baseline network """ @staticmethod def weight_ini...
8ec4567057d1cf9f5e029d0db7cfc2ec080328fa400fc4e5e368ed36c4e8dbfa
Python
4,434
98
from typing import Tuple import torch import torch.nn as nn class FBCCNN(nn.Module): r''' Frequency Band Correlation Convolutional Neural Network (FBCCNN). For more details, please refer to the following information. - Paper: Pan B, Zheng W. Emotion Recognition Based on EEG Using Generative Adversarial ...
ddbfe14f8ad077624f7f1e1632a1df525ab85d7b5b4c6e1f59f188272bad9e8a
Python
4,434
131
# Node-group asset "Is Side Chain" (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...
6add1ea4f6a2219f33f652fba628342cdc6a3eef05a1c5ee3a444728cd79c884
Python
4,435
120
#!/usr/bin/env python # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Basic CARLA Autonomous Driving training scenario """ import py_trees from srunner.scenarioconfigs.route_scenario_configuration import RouteConfiguration from srunner.scenar...
9943bd0051848f86d8ab28e67f0b7037ea2c890b085f82219bf81361c8c4e4f8
Python
4,435
158
# 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...
a2e5e9b9dfa3792f313f24cfb1727e9b7e0d3ef2b9a2ce39a2d03375257f2091
Python
4,435
146
import sys import textwrap from typing import List, Optional, Sequence # Shim to wrap setup.py invocation with setuptools # Note that __file__ is handled via two {!r} *and* %r, to ensure that paths on # Windows are correctly handled (it should be "C:\\Users" not "C:\Users"). _SETUPTOOLS_SHIM = textwrap.dedent( """...
4758494ebee95f6a099f296f2f8810a4e981334836237367b9928b921506c9b6
Python
4,436
121
"""Tests for validate_hed_sidecar script.""" import io import json import os import tempfile import unittest from unittest.mock import patch from hed.scripts.validate_hed_sidecar import main class TestValidateHedSidecar(unittest.TestCase): """Test validate_hed_sidecar script functionality.""" def setUp(sel...
d25837c1881b182a807e6cd46e1d9611f4aa25658028912c0b5a5886506f415f
Python
4,437
106
import os import numpy as np import pandas as pd from datetime import datetime import filenames import read_files import write_files import scaling import vmd import AnDePeD.ReRe_main_functions as andeped_func import anomaly_detection_metrics import nab_custom_windows as nabwindows import main_config as conf import o...
f1387e759105a72179b38036ce1fcae31dd98bdc170e06f4247a29f2659fa94e
Python
4,438
102
#!/usr/bin/env python import os import sys com=sys.argv if '-n' not in com or '-r' not in com or '-1' not in com or "-2" not in com: print ("USAGE: python TAURUS-MH -n <sample name> -r <genome_folder> -1 <G to A converted mate> -2 <C to T converted mate> -Trim1 <Trim off first Xbp of reads> -Trim2 <Trim off last Xbp ...
12f29aa6af1f4f29c01a9f022614b6891a63715abcd8b5a0380c9fb43c0ca705
Python
4,439
124
#!/usr/bin/env/python import argparse from datetime import datetime import random import numpy as np # from task import * import os import time from utils import * from params import * import sys # from manifold import * # from gnn import RiemannianGNN import pickle import train_inductive def set_up_fold(args): # ...
27f601d10c87fde6048fd1247d2545c509f89484ad6726390b83b7b6fd8a9c80
Python
4,439
112
__author__ = 'martinez' import matplotlib matplotlib.use('Agg') import pyseg as ps import numpy as np from unittest import TestCase from pyseg.spatial.sparse import UniStat, PlotUni, gen_sin_points, gen_rand_in_mask # ### Test variables # Global RES = 0.684 # nm/pixel # Mask MASK_R = 2000 # nm SIZE = (200, 100, 100...
6a479c423b28ec365f0781617dab3bcf8acf5fb836ca4d6789a65cfcbaa83d8c
Python
4,439
134
#!/usr/bin/python # GK September 2023 # Scripts for running methyl decoupling DNNs # # note in methyl_decoup_funcs model paths need to be set # requires nmrpipe to be installed to work import os from fidnet.methyl import methyl_decoup_funcs def write_initial(input, outfile, com_file, min_1H, max_1H, p0): with ...
996096744ce4a036c3802366fcdaf5597ddc68fc35333bec9104e94d0f7dbf91
Python
4,439
108
"""Figure taxonomy / grouping in the registration report.""" import base64 import os import struct import zlib from regtools.registration.report.figures import ( _classify_figure, _collect_figures, _render_figures, ) def _tiny_png_bytes(): def chunk(tag, data): return struct....
9c60df85b6730212a8d66c479118dc84b5dcdd399435f1a6a6df4863f4ddf879
Python
4,439
123
# imports from pathlib import Path import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from simulation import Simulation from tqdm import tqdm # set plotting style plt.style.use(['default', 'biophysics.mplstyle']) # define the kymograph function def kymo_plot(sim: Simulation, save_file: Path):...
a2493e2b15fdefff2d20cc19c0e1d6244ade5d14ebf5694d17454a509a7f4881
Python
4,440
133
import pandas as pd import numpy as np from sklearn.base import BaseEstimator class RandomResampler(BaseEstimator): def __init__(self, up_target=None, up_ratio_thres=None, down_target=None, down_ratio_thres=None, seed=0): self.up_target = up_target self.up_ratio_thres = up_ratio_thres sel...
22d2ed69ce8411a56ef737a6b79652252b3e105b7a5172a2573d3cf88cadd90e
Python
4,441
133
# A simple torch style logger # (C) Wei YANG 2017 from __future__ import absolute_import import matplotlib.pyplot as plt import os import sys import numpy as np __all__ = ['Logger', 'LoggerMonitor', 'savefig'] def savefig(fname, dpi=None): dpi = 150 if dpi == None else dpi plt.savefig(fname, dpi=dpi) def p...
27ac09e7a2282b6f74b67d71898a615d57a268f403951a4985b62769bdef1851
Python
4,441
118
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
3515676510334e914731e4a271b757a58c1eb3cd294f609726dd6c0411a87979
Python
4,442
105
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port from elasticai.creator.vhdl.design.design import Design from elasticai.c...
65b3d6992367f68c95df40f8505c5e9caa24278d5c6f095ec39a1456faf80456
Python
4,442
133
# A simple torch style logger # (C) Wei YANG 2017 from __future__ import absolute_import import matplotlib.pyplot as plt import os import sys import numpy as np __all__ = ['Logger', 'LoggerMonitor', 'savefig'] def savefig(fname, dpi=None): dpi = 150 if dpi == None else dpi plt.savefig(fname, dpi=dpi) def p...
4ee122c2a4a637c4f1271ec0e73184771c9a0ed16a8fb93c4315d8c8c919fb4c
Python
4,443
142
# 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...
be09e4706d387536db378a2b837077f9a0283f748ea5a46d1afa4766117d9348
Python
4,443
135
"""Save embeddings script. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ import os import logging from shutil import copy2 from functools import partial from typing import List, Union, Dict, Any import gzip import yaml import ...
29385c3c7ec8263d6469f7b3101c8aacb45c7b5c2ad4dc3c291f4f1235c56971
Python
4,444
120
# 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...
24e3d3d9e940abe9cc144d36891f8aa51d96ddea7c2459f618070469813498eb
Python
4,445
101
import os import pandas as pd import numpy as np from ckg.graphdb_builder import builder_utils def parser(projectId): data = {} config = builder_utils.get_config(config_name="wes.yml", data_type='experiments') directory = '../../../data/experiments/PROJECTID/wes/' if 'directory' in config: dire...
7489395744dbc6dfc21bd1c25a6efd1834a70bd7df4b6794ab2f0483adc6d005
Python
4,445
128
# Copyright (c) 2022, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
1450c91e5a8e94d2149bbe4494d4a8cd7fd818092e8204a9c0a72419497e7ed8
Python
4,446
126
import torch import random import time import numpy as np import torch.nn as nn import torch.nn.functional as F from tqdm import tqdm from utils import gram_schmidt,compute_bpc from data import get_dataloader from model_Customadc_noise import PTB_LSTM EPOCHS=20 DATA_PATH='dataset' BATCH_SIZE=8 SLICE_LENGTH=128 NUM_W...
7b496245eb9014da503a96739d01273fd232683d5ce384f8fe048b171b39f21d
Python
4,446
126
import numpy as np from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.nn.integer.ram.design import Ram from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p...
afaa2604c55b5f5b6af92b106986d0e7789b8d18ec3fff2a0bcc2cf39620e355
Python
4,448
115
import numpy as np import pandas as pd from tests.mock_data import MockTrainingData from cuppa.components.prob_overriders import SexProbFilter, FusionProbOverrider from cuppa.classifier.cuppa_classifier import CuppaClassifier class TestFusionProbOverrider: def test_sample_with_two_target_fusions_has_increased_t...
19606f4ce902fb8f653ec8383d74f87ee231d3ebd002984218376c827d984d68
Python
4,449
108
from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST, HEMISPHERE_REGION_LIST) from ..standard_1005 import STANDARD_1005_CHANNEL_LOCATION_DICT from ..utils import (format_adj_matrix_from_adj_list, format_adj_matrix_from_standard, format_...
2570fc7957d4cb1e47f268a5ac65f34e92da3cc5c939f3177188dd94dde3cf0e
Python
4,449
144
""" Bilateral Filter for GraphMCF Input: - GraphMCF (pickle file) Output: - Bilateral filtering stored in a vertex property """ __author__ = 'Antonio Martinez-Sanchez' # ################ Package import import sys import time import getopt from globals import * from factory import unpickle_obj from g...
90a56d191cbbee66cde7ca5fc1cc70fecf60f59069250fdae07ab975a85f9daf
Python
4,449
133
import os import random from PIL import Image import numpy as np import torch import torch.nn as nn from torch.utils.data import Dataset import shutil from tqdm import tqdm adj_maxval, adj_minval = 0.388, -0.239 lab_maxval, lab_minval = 11.31, -11.31 def get_data_from_folder_path(fp, path_label_dict, data_num, data_...
a91397d007b130f5ed7f30b62238ab7b7925e58129089d8586a3c74f14b38f0b
Python
4,449
120
"""Performance regression tripwires for the CCF Boundary Editor. These tests fail when a hot path gets dramatically slower - i.e. they're loose ceilings, not benchmarks. Tight benchmarks belong in pytest-benchmark; what we want here is "if the next person to edit ``_apply_alignment_to_ccf`` makes it 10× slower, C...
bffd4362153712869af43ecc302c82b09e933f35dfdcb4fc86c3a75f7de574e3
Python
4,449
152
# Node-group asset "Set Nucleic 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_C...
d1c330ada279a9c01258824bd858bec569b60e7b88ac2701b6bdadb8f7cf2459
Python
4,449
123
"""Per-region metrics are bincount reductions; pin them to the naive definition. `per_region_ncc` / `per_region_log_jacobian` used one boolean mask per region: ``for r in region_ids: mask = ann == r``. That is O(R * N) - with ~700 CCF structures over a 77M-voxel 25um atlas it is ~700 full passes over the volume, ...
00d1685e99c2ddabf843e3749d13ee9613feba26b134bd33dd622895f24f4e40
Python
4,450
111
# -*- coding: utf-8 -*- """Helper functions to save/load datasets into tfrecords""" def write_tfrecord(fname, dataset, log_every=100, pre_fn=None): """Helper function to convert dataset object into tfrecord file. fname must end with .yml or .yaml. The data will be written in a .tfr file with the same suf...
6cff6fc8c3f8dcdbc20abbf3897f500b87fd3b09e4f28e26b1a84a82764ba1f7
Python
4,450
78
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm import common_setup def main(revisions=None, combinations=None): LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() B_CONFIGS = { 'rl-b50k': ['--search', 'astar(mer...
f03bd3ff14aee4a82289ba13ad33d6bf42ff087bc7a6000e592b56aaa783cd5a
Python
4,450
172
# Node-group asset "Menu Residue Name" (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_CHEC...
dbe121c16e51d3d618a83231b2e22e330503fb8d18ea1f7bd317be3c795af90b
Python
4,451
141
# Node-group asset "Field Remap" (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 f...
66c2ac8a742a8743224c60852fceb759497812b4e3415ef852cbff596ddd0860
Python
4,452
110
""" This script converts DICOM files to NIFTI and organizes the files in pseudo-BIDS format. Requirements: - DICOM files organized and labeled as #_sequence (e.g. 5_EPI). No subfolders! See step0_organize_mrifiles.sh for inspiration - dcm2niix installed in a folder that can be acc...
fc9d78a87e49a284388cd7bb9f879c2ce61eb1563a6dc322bd56997ac80bf09b
Python
4,452
111
import numpy as np from pddlstream.utils import find_unique, flatten from pddlstream.algorithms.constraints import PlanConstraints, WILD as X from perception_tools.common import create_name from learn_tools.collectors.common import INFEASIBLE, get_contained_beads, stabilize, fill_with_beads, \ InitialRanges, crea...
5d994c59287651ab23a91e545525b2d9f2066dfda62d75c97601574577a140ef
Python
4,453
112
import numpy as np from skfeature.utility.construct_W import construct_W def trace_ratio(X, y, n_selected_features, **kwargs): """ This function implements the trace ratio criterion for feature selection Input ----- X: {numpy array}, shape (n_samples, n_features) input data y: {numpy ...
beaa07e7e5da3376876995c3d16b381c79746d68a8ed6b8f71321c38d6f5ed19
Python
4,453
125
from collections import deque from typing import Generator, Optional import cv2 import torch from torch import Tensor from torch.nn import Module from torchvision import transforms import random def resize(vid, size, interpolation='bilinear'): # NOTE: using bilinear interpolation because we don't wor...
fcc5fbbba6153b32ebe6ea9fe6917857de87155234a584f49b794af91bd95411
Python
4,453
154
import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestRegressor from sklearn.datasets import make_regression from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score import os import random import pickle fr...
651ea9d08b70a78ce5ec7ae223ed0c6372be9f60085bf13ed2ac4b82d456a1e3
Python
4,454
164
""" Adapted from 2020 Ross Wightman https://github.com/rwightman/pytorch-image-models """ import torch import torch.nn as nn from einops import rearrange from pathlib import Path import torch.nn.functional as F from timm.models.layers import DropPath class FeedForward(nn.Module): def __init__(self, dim, hidden...
75203d5dccd94a53d48261c67371ec01d54bd4e499d7aad00fcd66e25452933d
Python
4,454
125
"""""" import logging from pupil_recording_interface.decorators import process from pupil_recording_interface.process.calibration import Calibration import numpy as np logger = logging.getLogger(__name__) @process("validation", optional=("resolution",)) class Validation(Calibration): """ Validation during runti...
c56e2d2868816c8e19d91160a8637a87d27cec1b2196e13eecb6376be8566f20
Python
4,454
117
"""Space-flash pristine-overlay tests for the CCF Boundary Editor. Holding Space swaps the canvas overlay between modified (default) and pristine annotation. Releasing restores the modified view. Faster than dragging the existing compare-mode divider for quick boundary inspection. The flag is ``_peek_pristine`...
988a485dc9e2b59f7f7aa63664beb25d148a8dc029581520a63b2a50f254eb81
Python
4,455
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...
cbddadf9449ac72611d1869989adae3319cd0db36c43c5166a35551d2a516428
Python
4,455
114
"""Per-region categorical-fill color override tests. The viewer exposes a right-click menu action "Override colour..." that persists a per-region hex color in ``ViewerSettings.region_color_overrides`` (keyed by stringified region ID). The LUT-build path consults the overrides dict before falling back to the atla...
99793d885ec01c98267b0728add93c5d8c6c575bb335137a8dd1692c03e68571
Python
4,456
153
import numpy as np import numba from ...utils import model_utils as mu def timeIntegration(params): """ setting up parameters for time integration :param params: Parameter dictionary of the model :type params: dict :return: Integrated activity of the model :rtype: (numpy.ndarray, ) ...
1a3188cddd6c6474ca9f53433eb4c06c4060e84856599f523605dc11b0cc8a50
Python
4,457
119
import argparse import logging logging.basicConfig(level=logging.DEBUG, format="%(asctime)s [%(levelname)-5s] %(message)s", datefmt="%H:%M:%S") import numpy as np import pandas as pd pd.set_option('display.max_columns', 100) pd.set_option('display.width', 300) class HlaAlleleFreqNormaliser: SAMPLE_SIZE_CAP = 10...
48c3e8b96c1afda184e4cbc446c24a438b6db915a95e9f151a26aa709bbf1f39
Python
4,458
130
# -*- coding: utf-8 -*- from typing import Iterable, Union import torch from supar.config import Config from supar.models.dep.biaffine.parser import BiaffineDependencyParser from supar.models.dep.crf.model import CRFDependencyModel from supar.structs import DependencyCRF, MatrixTree from supar.utils.fn import ispunct...
54d0369e11b6252841c7567ea3cd9b6f0410471957185c1e093d9a121949de7f
Python
4,458
125
"""Compare data length of the LEMON and CamCAN datasets """ # Set up dependencies import os import pickle import numpy as np from sys import argv from osl_dynamics import data # Define custom functions def measure_data_length(dataset, sampling_frequency=None): """Get the length of each data in a given dataset. ...
d2a7fe18411b5fc7c1a3e7c541faedec191a2964fd8689c793ca708e3b07a5a0
Python
4,458
125
""" Script for comparing two classifications Input: - The STAR files with the classification to compare Output: - Table with the similitude (number of shared particle / number of particles per class) among classes """ __author__ = 'Antonio Martinez-Sanchez' ###### Global variables import pyseg as p...
c08f1e704679815855f3ddb4974fe951cb65997ba1ef37fe50e86c3c662347ca
Python
4,459
128
# Manuel A. Morales (mmoraleq@bidmc.harvard.edu) # Beth Israel Deaconess Medical Center # Harvard Medical School import torch.nn as nn import torch.nn.functional as F import torch from torchvision.models import vgg19 import math import numpy as np image_In = 64 #"Image size of high resolution image." scale_factor =...
d8b5ecaf641f3b7eb8977ca248c34cbacb7b91c4d6e5d85a13ec082f205572a3
Python
4,459
118
import os import numpy as np import torch from rdkit import Chem from rdkit.Chem import Draw from rdkit.Chem.Draw import SimilarityMaps import matplotlib.pyplot as plt from .nn_utils import index_select_ND def shorten_filename(filename, limit = 254): if len(filename) <= limit: return filename else: ...
f37ff77e8e1602c18a94496cf40d989434f82b3480b72a5d305ac927ff7d1005
Python
4,459
143
# 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...
ef2c5b7acfbe5174bc8adcc8d8f493fb6cfa1a8e0662aacdad2e7801676f30e4
Python
4,460
119
"""Processing worker for RxData objects using a persistent process pool.""" import logging import multiprocessing import signal from concurrent.futures import Future, ProcessPoolExecutor, wait from console.interfaces.rx_data import RxData log = logging.getLogger("RxProc") # 'spawn' is the only safe start method on ...
f53204ab5c2562469c53fe28091f0c3b39c83da90149fe4a221343ae5944078a
Python
4,460
119
from classification_models import get_submodules_from_kwargs def slice_tensor(x, start, stop, axis): if axis == 3: return x[:, :, :, start:stop] elif axis == 1: return x[:, start:stop, :, :] else: raise ValueError("Slice axis should be in (1, 3), got {}.".format(axis)) def GroupC...
1e8e26cb2e7b412d6c63c301bcea65d36737fb4a29c1cb301d67703be3f991ba
Python
4,461
136
""" Contains class Affine3D for preforming affine transformation (general linear transformation followed by translation) on points (vectors) in 3D. # Author: Vladan Lucic (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_literals from __future__ import absolute_import from past.builtins...
ab347615a50f474fc0e42da696080eb7e5ccafa965ffc500a4fb538d4897b3ce
Python
4,462
140
import warnings warnings.filterwarnings("ignore",category=DeprecationWarning) import numpy as np import tensorflow as tf import os import random from glob import glob import shutil if(len(glob("save_model"))): shutil.rmtree("save_model") os.mkdir("save_model") if(len(glob("training_loss"))): shutil...
4f7448463c63aeceffc84d63c1095f840c91d537e18353180ee2f2686411e7fc
Python
4,463
129
# 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...
56cd8d6fc163d7e20703a53c386fb3be5076b81fb4e0fcb18f10aa6845db690e
Python
4,463
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...
a16ecb40f477688c2e3d370a8bd65ba1fd7742139861dd0bfffb65d0fb80c4d4
Python
4,463
153
#!/usr/bin/env python # This scripts computes the distance between neurons from a raster. # Uses multiprocessing for parallel processing # Make sure current directory is added in the PATH variable import h5py import numpy as np import os import time import sys from functools import partial from itertools import combin...
f4eb6ff71abfcdcf5bd009147ef7fe697d4f52cb43c7e799d5203bbb31ffd324
Python
4,463
139
"""Auxiliary plotting routines for the radiation pattern of a dipole.""" import math from typing import Tuple import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable import numpy as np NUM_POLAR = 30 NUM_AZIMUTH = 50 def plot_radiation_pattern_3D(dipole_pol: str, radial_flux: np.nd...
5518651f6435ec0088169ab5da94cb9420281ca94914b3b630b3409ebb2a3567
Python
4,464
147
from __future__ import division, print_function import os import sys from typing import Union import numpy as np import topaz.mrc as mrc import torch from PIL import Image from topaz.utils.data.loader import load_image def crop_image(arr:Union[np.ndarray,torch.Tensor], xmin:int, xmax:int, ymin:int, ymax:int, ...
ba62bd13b1cb8da065149ea8b68d852f97418aa2b91a114e717f9e2ab556fcfe
Python
4,464
108
#!/usr/bin/env python # coding: utf-8 import argparse import pandas as pd import random import numpy as np from keras import models, layers, regularizers from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler from sklearn.metrics import confusion_matrix # Set up argument parser par...
0f6ef6d75486f07707cf51fea64a2776226beee43493d9161e911403668fc885
Python
4,465
113
""" Introduction to the model_selection Module ============================================= Welcome to the guide on TorchEEG's ``model_selection`` Module! This module provides you with a rich array of dataset-splitting strategies. In EEG-based emotion recognition, the division of training and test sets may differ ba...
ad051b93cb333f7d3b7b2ee7407186eca3ce6c56270fc45201d4d437e21791ad
Python
4,465
158
#!/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 access to the CARLA game time and contains a py_trees timeout behavior using the CARLA game time """ import...
0fb59900cfe0e3696caa2760de3f8516b45765545793541a6554c7bc01675acc
Python
4,466
112
"""Per-dataset configuration. The .mat files in this repo carry no timestamps, no stimulus-onset markers, and no sampling-rate metadata. All of that has to be supplied externally. """ from __future__ import annotations from dataclasses import dataclass from typing import Literal SigmaMethod = Literal["engbert2003",...
3f117d65c17e68be145f3672953e641ab80078cf8ecfd2e7f8b1ac1f3be34add
Python
4,466
108
from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST, HEMISPHERE_REGION_LIST) from ..standard_1005 import STANDARD_1005_CHANNEL_LOCATION_DICT from ..utils import (format_adj_matrix_from_adj_list, format_adj_matrix_from_standard, format_...
39dcdbb2490b1e702588354daf9550c35569ff9e99b756c193e4f8ef4c915fc6
Python
4,467
112
#!/usr/bin/env python import yaml import argparse import sys import subprocess import os from pprint import pprint from time import gmtime, strftime import numpy as np if __name__ == '__main__': parser = argparse.ArgumentParser(description='') parser.add_argument('--config', type=str, default=None) parser...
981a998646391745c783b3cf36637a5f67783f45bfe0c477d8fc8ce2188f39a3
Python
4,467
121
# 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...
e07c81ebece9f3e6f73999e538dd8fe00bc3b4ee343d1f985fb31d4fcf9826d9
Python
4,467
130
from __future__ import print_function from random import random from time import time from .utils import INF, argmin, elapsed_time class OptimalNode(object): def __init__(self, config, parent=None, d=0, path=[], iteration=None): self.config = config self.parent = parent self.children = ...
77b1d0c927e8e25016422e7938ff77611a75660fb8dbf40154872b20ac219b27
Python
4,468
126
""" Iterative removal of line noise and harmonics. Authors: James Bonaiuto <james.bonaiuto@isc.cnrs.fr> Maciej Szul <maciej.szul@isc.cnrs.fr> """ import numpy as np import matplotlib.pylab as plt import copy from mne.time_frequency import psd_array_multitaper from meegkit.dss import dss_line def nan_basi...
95fe9b09cc3379ddf0402ce67e9470613d71cc21a2eb93b474f7628994a4bb7b
Python
4,468
105
""" This script is used to resquiggle the reads that have different tandem repeat number than the reference. """ import os import toml import argparse import numpy as np from functools import partial from tqdm import tqdm from multiprocessing import Pool from multiprocessing import Queue from xron.nrhmm.kmer2seq import...
b5e62157941b0aa91e19f2d4c06e9301be13794c5b545c685ce08e5c4e1ceaef
Python
4,468
114
import numpy as np import mdtraj as md import pandas as pd from mdtraj import element from argparse import ArgumentParser import logging import time import string import gc parser = ArgumentParser() parser.add_argument('--proteins',nargs='+',required=True) parser.add_argument('--numbers',nargs='+',required=True) parse...
5273e915b03650c94100f18a47c3606979d58e1088c47fdda437d9493061eba8
Python
4,470
137
# Node-group asset "Select Res ID Range" (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_CH...
2565f1a3efa857fb9f244b24cb30eb45006232a0470aa108d01115160317a317
Python
4,471
115
import argparse import numpy as np def main(): parser = argparse.ArgumentParser() parser.add_argument('--vocab_file', default='vocab.txt', type=str) parser.add_argument('--vectors_file', default='vectors.csv', type=str) args = parser.parse_args() with open(args.vocab_file, 'r') as f: words...
ba44040071e0f81c8e6569660dec9df0aaedd0c4d41fc50ade82b70687983376
Python
4,472
137
import numpy as np import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Merge from keras.layers import Conv1D, MaxPooling1D, AveragePooling1D from keras import backend as K from random import shuffle, choice from keras.preprocessing import sequence from matplotlib import py...
cf910493e645bf22e19a756a0924c15d30c749e5903cc11e82f976fc4f0bb7a3
Python
4,473
134
# Node-group asset "Boolean Run Trim" (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_CHECK...
fe5281d625706efec91cfdc756ee953d2b4ea34bba478d9da5ad8d82ff65a2f8
Python
4,473
118
import torch import torch.nn.functional as F from sklearn.metrics import confusion_matrix @torch.no_grad() def evaluate(model, dataset, split_idx, eval_func, criterion, args, result=None): device = torch.device("cuda:" + str(args.device)) if torch.cuda.is_available() else torch.device("cpu") if result is not N...
b0264b7ce1b2fd7db76e21d3e08ae15edfb75bd8b13f8ace581a730b67752ff6
Python
4,475
101
import os import pandas as pd import pytorch_lightning as pl from statistics import mean from typing import Any, Callable, List import torch from torchmetrics import Accuracy # local imports from shapelearningtheory.networks import make_resnet50, make_vit_b_16, \ make_vgg_19, \ make_mlp_small, make_convnet_smal...
d38a3eba4e8e265e48c3cb11386370e3d9ebe80eafec01533792a6a01063c631
Python
4,477
109
#!/usr/bin/env python # coding: utf-8 import argparse import pandas as pd import random import numpy as np from keras import models, layers, regularizers from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler from sklearn.metrics import confusion_matrix import matplotlib.pyplot as p...
71887d301d4c908c433e68a794fbc919de3f8b81fea54e2a0b0285588ec3957b
Python
4,478
134
from typing import List, Union import numpy as np from rdkit import Chem from rdkit.Chem import AllChem class MolMatrices: """ A :class:`MolMatrices` represents the atomic matrices of a single molecule. A MolMatrices computes the following attributes: * :code:`n_atoms`: The number of atoms in the mo...
19f1ded471b1c94660c233805c346fcd311d0b2d0b1fddb7a750c8ead079bec1
Python
4,479
133
import logging from concurrent.futures import Future from pupil_recording_interface.base import BaseConfigurable from pupil_recording_interface.decorators import process from pupil_recording_interface.utils import DroppingThreadPoolExecutor logger = logging.getLogger(__name__) class BaseProcess(BaseConfigurable): ...
9c238b77544265f01ce1fa55d791d27ff8cba2543b0581453cf0112b1562665b
Python
4,479
105
"""Optional torch/CUDA backend for the compute-heavy numeric metrics. FSC and NGF are FFT / gradient kernels over the whole volume - exactly what a GPU does well. ``metrics.py`` routes to these when CUDA is available and falls back to the identical NumPy path on ANY failure (no CUDA, out-of-memory, a torch quirk)...
9de5cc5902cdee9db467065bdf0153313f11f9dccdd7d48c49578c32bbbbe7db
Python
4,479
99
import torch.nn as nn from types import SimpleNamespace from coral_pytorch.layers import CoralLayer from src.models.components.resnetblock import ResNetBlock from src.models.components.preactresnetblock import PreActResNetBlock resnet_blocks_by_name = { "ResNetBlock": ResNetBlock, "PreActResNetBlock": PreActRe...
1c7d43c80dece1bd523e62480173929c66e6f13337967e7e29d9d55bc56457ee
Python
4,480
117
""" Script for ploting alignment confidence over scales Input: - A list of workpsaces with the column alignement computation - A paired list with the alignment distance used Output: - Plottings """ import time import numpy as np from matplotlib import pyplot as plt, rcParams try: impor...
4e010863422c55642e03294de2c9b2f73a7df288be9808df6a5394fce6894a18
Python
4,480
146
"""Plot performance Medication OFF vs ON.""" from __future__ import annotations import csv from enum import Enum from pathlib import Path import numpy as np import pandas as pd import pte_decode import scipy.stats from matplotlib import pyplot as plt import motor_intention.plotting_settings import motor_intention.pr...
f6982fae9022d9780fe7dd8b144ffa0e7f470c8e162852a91f55d0d923c1e28c
Python
4,481
146
import sys import os def extract_stats(gd_file_name, test_file_name, usecase): print("ref: " + gd_file_name) print("test: " + test_file_name) gd_file = open(gd_file_name) test_file = open(test_file_name) seq_dict = {} result_dict = {} for line in gd_file: if not line.startswith("...
1eadf2f17e5d3db4edc3df24d5d463f597f5d4652b2ca19609004c67f7217223
Python
4,482
115
# # 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,...
907b19b453216d974f7a3b1f41d3ca6566e1cd4eda91479c0cd85c001d1dc570
Python
4,482
131
############################################################################### # This code generates the Supplementary Figure 2 of the paper "Longitudinal # # single-subject neuroimaging study reveals effects of daily environmental, # # physiological and lifestyle factors on functional brain connectivity" # ...
d8a4714f3563b3d1c91ab73d7ef766982b0732c707a5107f2730e119d785d936
Python
4,482
125
from typing import Optional import torch from torch import Tensor import torch.nn as nn from cl_3d.models.components.distributed import sync_ddp_if_available class GatherLayer(torch.autograd.Function): """ Gather tensors from all process, supporting backward propagation. From https://github.com/Spijker...
dd8d7dea6bd40bf91c671938e31379f4e160862e32fa28462ca33b137f60803a
Python
4,482
96
""" MOABB ===== This script shows how to use rCCA from PyntBCI for decoding c-VEP trials from real (not synthetic) EEG data, obtained from the Thielen et al. (2015) c-VEP dataset [1]_ via MOABB (Mother of All BCI Benchmarks) [2]_. Cross-validation is performed with a few lines of standard scikit-learn code, since `rCCA...
6a33e1b3be2df5a4fa7d96f780d99fba1f3d6941f802eccdacd7fd410b7ba741
Python
4,483
105
from hmp.models import EventModel, EliminativeMethod, CumulativeMethod from hmp import basedata, projectors, patterndata, visu from hmp.crossvalidation import LOOCV import copy import pytest import numpy as np from test_io import init_data def example_simple_func(data, n_events, channel_pars=None, time_pars=None, ver...