sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
56be247bf3a1456fa25da826ee33ea6922bbf949fa8214fbc9aea099a98d2dac | Python | 3,854 | 108 | import requests
import xml.etree.ElementTree as ET
import json
def fetch_clinvar_variant_ids():
# Define the base URL for ESearch
esearch_url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi"
# Define the query parameters for ESearch
esearch_params = {
"db": "clinvar",
"te... |
e10aadce2ccb17029104639b041a08a12cac28d255919dd1730dc1e536f580cb | Python | 3,854 | 111 | """
This script converts NeSys .xyz files with coordinates specified
in the local coordinate system for the pontine nuclei defined by
Leergaard et al. 2000 to Waxholm Space coordinates for the rat brain
(in voxels).
"""
# pylint: disable=C0103
import os
# import random
# random.seed()
# - - - - - - - - - - ... |
74fbbb962157d4668d575eae48bb9d773170847023c705b1ec5c7bb8b008f65b | Python | 3,855 | 85 | 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,
# "PreActResNetBloc... |
8e4bb716280d9622851e67d78658539bbca80150fdc7e0574614f27f07673853 | Python | 3,856 | 102 | import warnings
warnings.simplefilter(action='ignore', category=FutureWarning) # Ignore all FutureWarning warnings that might flood the console log
warnings.simplefilter(action='ignore', category=DeprecationWarning) # Ignore all DeprecationWarning warnings that might flood the console log
import numpy as np
impor... |
b614ae0ea1b6ece706112f5076bd7b88ae9e7f085cff62fee825514bc6668ca8 | Python | 3,856 | 121 | from cloudvolume import CloudVolume
import numpy as np
roi6 = CloudVolume("gs://neuroglancer/pinky100_v0/son_of_alignment_v8/roi_eroded", mip=6, cdn_cache=False)
dst6 = roi6
def get_xy_slice(cv):
o = cv.voxel_offset
s = cv.shape
return slice(o[0], o[0]+s[0]), slice(o[1], o[1]+s[1])
def scale_slice(sl, dst_mip=5, ... |
34cc4adc488a72cbeb0bf0e7f0741bd4d29f601147bac3eacee76729f14fdd1c | Python | 3,857 | 100 | # 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
#
# http://w... |
37571f030f2980cc3eedb7093425aea515fb1efc4de276588eeac62723c4805a | Python | 3,857 | 154 | import numpy as np
from moabb.datasets import (
Zhou2016,
BNCI2014004,
BNCI2014001,
MunichMI,
Weibo2014,
Cho2017,
)
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.pipeline import make_pipeline
from mne.decoding import CSP
from help_funcs import load_e... |
612dde82e8a329f9d29c993366a305ceb1a257a57ad92024d2efd5ca28ca47d7 | Python | 3,858 | 134 |
import time
startTime = time.time()
# coding: utf-8
"""
Load the data from .mat
"""
import h5py
import numpy as np
import matplotlib.pyplot as plt
import scipy.io
social_data_path = 'data/'
hot = 'dpsp_hot_masked.mat'
social = 'dpsp_rej_masked.mat'
f1 = h5py.File(social_data_path+hot,'r')
hot_data = np.array(f1["r... |
a8aa59a31ec9f0d01a3e60ece42fda9e2c1f3c3c73be992b08aa9fc27746f3b9 | Python | 3,858 | 110 | import sys
from typing import List, Optional, Tuple
from pip._vendor.packaging.tags import Tag
from pip._internal.utils.compatibility_tags import get_supported, version_info_to_nodot
from pip._internal.utils.misc import normalize_version_info
class TargetPython:
"""
Encapsulates the properties of a Python ... |
944f8d26024e7f1f0635cc35aa1952d547fa2262569a9234298c5b7186d24187 | Python | 3,859 | 46 | """posthoc_realfly_review_checks_2026-09-29.py (POST HOC, descriptive; answers the 'realfly' review of 29 Sept).
(1) all measures on the SAME 493 pairs that have a receptor value; (2) partial correlation model~real controlling for each
pair's own receptor response (does the model explain PN variance beyond its input?);... |
c2bfc8c60feafeb5ca116bd897d8810e24500896da727f9fe39029a18b21434e | Python | 3,860 | 113 | # Node-group asset "Backbone Vectors" (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... |
e61bee898b90b4cec6a3b3c1cec231144c6e9ab1ccb0ce3ad604dc3355eb48cc | Python | 3,860 | 118 | # Node group "Edge Detection" (ShaderNodeTree), 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 regenerated... |
5efcb900ab092a0f26a5f8bcebdefae3c4fcf4c77f2e93697d13cd64979bfbc6 | Python | 3,861 | 125 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.cnn import ConvModule
from torch import nn
from torch.nn import functional as F
from .separable_conv_module import DepthwiseSeparableConvModule
class ASPPPooling(nn.Sequential):
def __init__(self, in_channels, out_channels, conv_cfg, norm_cf... |
a5b80967bf86d44d7bef66ee404acf4e0bcc581cc479eaba6158d840f76a62dd | Python | 3,861 | 94 | """Average the model's performance across all holdout recordings"""
# Imports
import numpy as np
from pathlib import Path
from src.model import ModelSpikeSorter
from src.utils import random_seed, confusion_stats
from src import data, plot
import torch
# Constants and setup
DATA_PATHS = Path(r"/data/MEAprojects/DLSpik... |
489d8358790547f743ff9f7650587eeb6a56e69ee53af1f37ecce9d5e463b896 | Python | 3,863 | 123 | """Core recipes for GULP."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import job
from quacc.recipes.gulp._base import run_and_summarize
if TYPE_CHECKING:
from ase.atoms import Atoms
from quacc.types import Filenames, RunSchema, SourceDirectory
@job
def static_job(
... |
61ee3bd4396ff337d741ef6301eb9321cb26f866e06f7898245c43bcfc9066a2 | Python | 3,863 | 105 | """
This script creates the visualizations for the supplementary analysis
To understand the thresholding, read https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Randomise/UserGuide
"""
import numpy as np
import glob
import math
import string
import nibabel as nib
from nilearn.plotting import plot_stat_map
import matplotlib.pyp... |
b0bc6ea0ba869269e0b8c6c6ab28bd3f5eff74700919de8f9b16ac4478f7bc10 | Python | 3,863 | 140 | # Node-group asset "Color AO" (ShaderNodeTree), 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, Liter... |
3d81bf9784bc6b0fb93867a6879db4b2b283ba1082635bad011ecfae3eeb66f8 | Python | 3,864 | 120 | # Node-group asset "Transform Local Axis" (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... |
4bf2e77f011d36717df0cc7d048f1f0dc03a229920bd3b1a7c5ebde1fe37dfc0 | Python | 3,864 | 126 | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides the base class for all autonomous agents
"""
from __future__ import print_function
from enum import Enum
import carla
from srunner.scenariomanager.time... |
774e2c5a3da2644668603c4fb4aeb93c1eb6c7881cf71ed7c665e69a2083a9cf | Python | 3,864 | 101 | # from options.opt import opt
import torch
import random
import numpy as np
import scanpy as sc
from scipy import sparse
import torch.utils.data as data
class customDataloader(data.Dataset):
def __init__(self, opt):
self.opt = opt
train = sc.read(self.opt.read_path)
train = train[~((train.o... |
88c162ec9ecd8cc6ce7c035ba6c824a1d5522c082413bb719aa3ef1c96630897 | Python | 3,864 | 103 | """
Script that saves Hagmann connectomes from the .mat file and saves them on txt easiliy readable matrices.
Then, it runs the MSP algorithm and saves into a csv the file.
Normalization of Hagmann:
Structural connectivity between pairs of regions was measured in terms of fiber density,
defined as the number of stre... |
b23f6e02c65549c88cad4f6f0087371000907b4668ebf68a5235f0cc323723b2 | Python | 3,864 | 111 | import os
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import cell
FILE_PATH = os.path.split(os.path.realpath(__file__))[0]
class CrossbarCells(QtWidgets.QWidget):
def __init__(self, colorbarRuler, WLCount=32, BLCount=128):
super(CrossbarCells, self).__init__()
self.__BLCo... |
e923de925dead6bc54828720cc82b00252745bc78d26157547e8288b2574c051 | Python | 3,864 | 87 | ## Dependences
import torch
import os
from absl import flags, app
## User Defined Modules
from train_multi_4D import train_multi_4D
from train_multi_3D import train_multi_3D
from glbSettings import *
## Config Settings
# general
flags.DEFINE_enum('action', 'TRAIN_4D', ['TRAIN_3D','TRAIN_4D'], 'Actio... |
271945622c73cf8eab9e3bc760e92c2a2a7b7c0d1ee36125fe49a866371268a3 | Python | 3,866 | 96 | import os
import re
from copy import copy
from typing import List, Tuple
import pandas as pd
from torcheeg.datasets.module.base_dataset import BaseDataset
class LeaveOneSubjectOut:
r'''
A tool class for leave-one-subject-out cross-validations, to divide the training set and the test set, commonly used to stu... |
2c7360b00cc0af56e1f8dade93a4a420ca33ccdda27c2439d3f8c3d9568bc569 | Python | 3,867 | 102 | #
# 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,... |
0699cd54797d0361f8892f94f3bea8a13b53fd292f74b8f0806e96025d2b9519 | Python | 3,868 | 138 | # -*- coding: utf-8 -*-
#
# Backend methods/functions for
# trivial down- and rational (p/q) resampling
#
# Builtin/3rd party package imports
import fractions
import scipy.signal as sci_sig
# Syncopy imports
from syncopy.preproc import firws
def resample(data, orig_fs, new_fs, lpfreq=None, order=None):
"""
... |
02c89e6b9846fd4cfb514deafdad2617c0f02e0a97b1f30f0d5bef4c54875c70 | Python | 3,869 | 83 | # Publication: "Protein Docking Model Evaluation by Graph Neural Networks", Xiao Wang, Sean T Flannery and Daisuke Kihara, (2020)
#GNN-Dove is a computational tool using graph neural network that can evaluate the quality of docking protein-complexes.
#Copyright (C) 2020 Xiao Wang, Sean T Flannery, Daisuke Kihara, and... |
61bac94d78429b6984c204c8529e4eef128f7a30d186ef1a5014f0a46995a493 | Python | 3,869 | 137 | import cPickle
from matplotlib import pyplot as plt
from math import log
import numpy as np
from collections import deque
from statsmodels.nonparametric.smoothers_lowess import lowess
from common import *
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Arial']
p =... |
411eba6a368e6d378bbba9a1a8e139452a210a2c6894da4bca04f72b06099d42 | Python | 3,870 | 111 | import numpy as np
import unittest
import pyntbci
class TestDeBruijnSequence(unittest.TestCase):
def test_code_shape(self):
k = 2
n = 6
code = pyntbci.stimulus.make_de_bruijn_sequence(k=k, n=n)
self.assertEqual(code.shape[0], 1)
self.assertEqual(code.shape[1], k**n)
d... |
814116d400ab0dc2bf32aeff46217761494a03ef5ef93abd01c42ceca03e8259 | Python | 3,870 | 125 | import os
import sys
from itertools import product, starmap
import distutils.command.install_lib as orig
class install_lib(orig.install_lib):
"""Don't add compiled flags to filenames of non-Python files"""
def run(self):
self.build()
outfiles = self.install()
if outfiles is not None:
... |
a1379b63eeb76d391986241d470784825a3425833ce55586a3687bb66c69e314 | Python | 3,870 | 123 | import math
import os
import shutil
import numpy as np
import pandas as pd
from rocf_scoring.data_preprocessing.preprocess import preprocess
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
class File:
"""
A image file, used to match predicted labels with original images
defined ... |
da6c37ad9a6ca2a4099d267fbbb8476085344f92b663b1f74cc974ba0eb0ce91 | Python | 3,870 | 130 | # Node-group asset "Residue Dihedral Angle" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE... |
e94d392629671900c463a6205fd173431389862cd333a8180462946dab5f3460 | Python | 3,870 | 91 | """
Copyright (C) 2020 Intel Corporation
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 wri... |
7c05aadbcd30610a68a65a2cf4f4740c9f434b93cb60f9a0e81a625b67d48092 | Python | 3,872 | 95 | from typing import Dict, Union, List
from ..base_transform import EEGTransform
class BaselineRemoval(EEGTransform):
r'''
A transform method to subtract the baseline signal (the signal recorded before the emotional stimulus), the nosie signal is removed from the emotional signal unrelated to the emotional sti... |
b4a9126ff1c84b1095ed2c1aeb460621ec9ad2c1a7ebe30fe86c7bf85105a2dd | Python | 3,873 | 135 | """Calculate features using py_neuromodulation."""
from __future__ import annotations
import pathlib
import time
from pathlib import Path
from typing import Annotated, Literal
import mne_bids
import numpy as np
import pte.filetools
import pte_neuromodulation as nm
from joblib import Parallel, delayed
from pytask impo... |
8ae5283a41901af06827a05ae9021a93c44b9c57330e5d6eef111d74715031c9 | Python | 3,874 | 94 | from typing import Optional, Union
from segmentation_models_pytorch.encoders import get_encoder
from segmentation_models_pytorch.base import (
SegmentationModel,
SegmentationHead,
ClassificationHead,
)
from .decoder import PANDecoder
class PAN(SegmentationModel):
"""Implementation of PAN_ (Pyramid At... |
71073ddacd1a0d6969a9d8221bdc5d26990cba32b271d0b5edfdeee2af179f27 | Python | 3,875 | 105 | # -*- coding: utf-8 -*-
from collections import defaultdict
from matplotlib import ticker
from downward.reports.scatter import ScatterPlotReport
from downward.reports.plot import PlotReport, Matplotlib, MatplotlibPlot
# TODO: handle outliers
# TODO: this is mostly copied from ScatterMatplotlib (scatter.py)
class ... |
979242474d7a6ecec13672c00cd6b4d0625e954baecaed847c3069cc2ffc5ac2 | Python | 3,876 | 113 | import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import ttest_rel
CM = 1/2.54
RT_COLOR = "#ffd343"
OTHER_COLOR1 = "#426eff"
OTHER_COLOR2 = ["#7542ff", "#42ccff"]
MARKERS = ["o", "*", 'v', '^']
PATCH_ALL = np.asarray([210, 328, 63, 39])
OFFLINE_FN = np.asarray([12,6,10,5])
OFFLINE_FP = n... |
167000925bfc3069bfa9bd948a50d0812ea5d1c52db620852948f1d339f65cd0 | Python | 3,879 | 131 | """Module containing bug report helper(s)."""
import json
import platform
import ssl
import sys
from pip._vendor import idna
from pip._vendor import urllib3
from . import __version__ as requests_version
charset_normalizer = None
try:
from pip._vendor import chardet
except ImportError:
chardet = None
try:
... |
64042a8e512de1bc729dc280f6deb5f1466eebc7e1871ebf6ca19504740e50ff | Python | 3,879 | 96 | import sys
sys.path.insert(0, "/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/quality_check")
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as md
import matplotlib.transforms as mtransforms
import matplotlib
import quality_utils as qu
... |
75ba68059415ee5fcf97334362c73db2731749d419e34c4469c5506a63960861 | Python | 3,879 | 109 | import os
from os.path import join as pjoin
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from skimage import io
from sklearn.metrics.pairwise import cosine_similarity
from dimension_encoding.utils import vcorrcoef
class TopObjectsProfile:
"""
Find and plot top objects for only one re... |
8b13549c8ae399ccaaffd639203a6568be8c02a7458255ef368af90e7b4c9af0 | Python | 3,879 | 137 | from __future__ import annotations
import pytest
parsl = pytest.importorskip("parsl")
import os
from pathlib import Path
from ase.build import bulk
from quacc import flow, job
from quacc.recipes.emt.core import relax_job # skipcq: PYL-C0412
from quacc.recipes.emt.slabs import bulk_to_slabs_flow # skipcq: PYL-C04... |
aec93906a80b5cd50550a381c3d4296b52074d9ba73de1f4618d6d5cecf183d9 | Python | 3,879 | 107 |
'''MIT License
Copyright (c) 2020 Duncan Forster
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, publis... |
0617441f1a2da9f14ce9d10a588c2f5a77ebfebd82d612af7c214b4080b798ea | Python | 3,880 | 120 | import sys
sys.path.append('../../4K_HETU/app')
import arrayexp
import numpy as np
# import arrayparams
import time
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
sns.set_style('ticks')
matplotlib.rcParams['font.family'] = 'sans-serif'
matplotlib.rcParams['font.sans-seri... |
d3ed95d9229f8093202acc7be4f1aada124eb14869979b4392dbdd038a239f5c | Python | 3,881 | 114 | """Datasets and the train/val/test split.
Replaces the published notebook's `filenames.pth` + `test_1ch.csv` pair, which
hardcoded absolute paths into a dataset that is not distributed. Point
`--data-dir` at any directory laid out as:
data/
images/ strip photos (RGB, any format PIL reads)
mas... |
297c85a8735a42e2b3a51f70ee3b47db01b81f0629f47a8d61df209a7e800b7f | Python | 3,882 | 112 | import numpy as np
from config import MODEL_PATH, DATA_DIR, LABEL_FORMAT, DEST_PATH, DATA_AUGMENTATION
from model import CNN
from cv2 import imread, imwrite
import cv2
from preprocess import preprocess, preprocess_basic
from augmenter import simulate_augment
# adapt such that it works for all formats ('one-per-item', ... |
e6844ef4eddd336bc6ba1d1b170e0739595eb6bcabcf91c732698f5b026b1fd5 | Python | 3,882 | 132 | """
Package containing all pip commands
"""
import importlib
from collections import namedtuple
from typing import Any, Dict, Optional
from pip._internal.cli.base_command import Command
CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary")
# This dictionary does a bunch of heavy lifting for he... |
6ae1263627803171d83f84c94f3d40b911a51ad4a9fc423c2fe736c5a7dc4791 | Python | 3,883 | 87 | #!/usr/bin/env python
# TODO: Rewrite this using poses
# If these imports fail, check that you ran setup_ik.py
# Instructions are in the comments of that file
# Remember to move the .so files into this folder
try:
from .ikLeft import leftIK, leftFK
from .ikRight import rightIK, rightFK
except ImportError:
... |
a32e3e3c6511061b7ef995bb3f2fbb0bebcaeb2c8e5d8c2fb200860250a1ecb1 | Python | 3,883 | 111 | from typing import Optional, List
import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from ._functional import soft_jaccard_score, to_tensor
from .constants import BINARY_MODE, MULTICLASS_MODE, MULTILABEL_MODE
__all__ = ["JaccardLoss"]
class JaccardLoss(_Loss):
def __init__(
... |
c52f0fc383a4653a3c6f563da20bf33c6ef8a3cbdae23a8b017e967bedf755d3 | Python | 3,883 | 113 | # 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... |
104e5a4bfaeeb3962e66429187242b39f256adc24bc89f65b8bb7fd1aab6e794 | Python | 3,884 | 126 | #
# 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,... |
d1de1082c1e6f6989057e7d14c0d2aaa20637185e5195039f956c1513cc5c543 | Python | 3,885 | 120 | """Base jobs for Q-Chem."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc.calculators.qchem import QChem
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from quacc.utils.dicts import recursive_dict_merge
if TYPE_CHECKING:
from typing import Any
... |
388a8ef6da9a758f243381f08457f543ad9f508a7bbfc283ad3468f3258ccfb6 | Python | 3,886 | 113 | import logging
from optparse import Values
from typing import List
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal.cli.req_command import SessionCommandMixin, warn_if_run_as_root
from pip._internal... |
b9d16d144309959f45bc07fd355ace1a2ea85d100f0f1063031a7f3b0df7c553 | Python | 3,886 | 120 | """
Gather several STAR files with into one updating the class number
Input: - A STAR file with the list STAR files to gather
Output: - A a new STAR file where the class number take into account the different input files
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global variables
##########... |
d3529f076cea7b7be40edb8d5229c93b147e06d03724e7569c0bd81f3ed1d1ad | Python | 3,886 | 118 | # 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... |
388248934d4c61559e21ff75a38f8a97bcf50349cc1752a101d352a68a37de91 | Python | 3,887 | 120 | """Interactive template-atlas exclusion-mask editor (brush + polygon).
2D only. Paints out part of the template atlas in the 2D registration GUI,
replacing the painted region's template intensity with a user-set fill value
(default 0) and zeroing its annotation, so a section missing tissue registers
accurately.
... |
b3f0de6f126bcd434f0a5beb9ff615f4998e726ffa3f20a962be759e7dc6b16d | Python | 3,888 | 141 | # Node-group asset "Lattice Grid" (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
... |
d2b63d84d7c832d7964cfba369ca769dbf76cfa62dba2f341d5d782a420d8d20 | Python | 3,888 | 107 | # -*- coding: utf-8 -*-
from typing import Dict, Iterable, Set, Union
import torch
from supar.config import Config
from supar.models.const.crf.parser import CRFConstituencyParser
from supar.models.const.crf.transform import Tree
from supar.models.const.vi.model import VIConstituencyModel
from supar.utils.logging impo... |
811a34ffb8c6de829e11a84a6604561289ee64cb599af1c7bff5ea4fabf4dfc3 | Python | 3,890 | 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... |
ce0a6e05f68a0c2227977375ddbf2ab322e11f7adb00add4c93574798a269c6c | Python | 3,890 | 102 | """
Cog SDK BaseModel definition.
This module provides the BaseModel class that users can subclass to define
structured output types. BaseModel automatically converts subclasses into
dataclasses.
"""
from dataclasses import dataclass, is_dataclass
class BaseModel:
"""
Base class for structured output types.... |
290664304adf51220533da6fcb6222175957375c7e1ef7444b569044469c139a | Python | 3,891 | 113 | # 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... |
65960ed55de625ca30af8efeafab5dc4a9418dc660008c8085620ccd92212636 | Python | 3,891 | 135 | from contextlib import ExitStack
import cocotb as ctb
import pytest
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge
from cocotb.types import LogicArray, Range
from elasticai.creator.file_generation.resource_utils import get_file_from_package
from elasticai.creator.testing import eai_testbench
f... |
4e3103934b7be12b4faf0ac07d7070913cf55f72be4717b832c37f352bcf3076 | Python | 3,892 | 150 | # -*- coding: utf-8 -*-
"""
"""
import os
import pandas as pd
import re
import shutil
from nipype import logging
from nipype.utils.filemanip import fname_presuffix, split_filename
from nipype import logging, LooseVersion
from nipype.utils.filemanip import fname_presuffix, check_depends
from nipype.interfaces.io im... |
8d00a7886695eecc3b779e4efdfe03a062632e12ac5d5b949054db0d8919b938 | Python | 3,893 | 95 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import gradcheck
from dcn.modules.deform_conv import DeformConv, _DeformConv, DeformConvPack
from dcn.modules.deform_con... |
9161cfadc695f50a1c883b8190b48b9e8cae2ce4ff3a85a6a9882b5b95e3f681 | Python | 3,893 | 101 | """Toast notification tests."""
import pytest
@pytest.fixture
def qapp():
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QApplication([])
yield app
@pytest.fixture(autouse=True)
def _confirm_yes(monkeypatch):
"""Override the conftest default (``QMessageB... |
598a915e90b3918f4bcd29d7d5f67841e0e9fc48d30c47d3cd8968651aef183f | Python | 3,894 | 106 | #
# 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,... |
e8dfe2853de2b1afceda424a583c91592bca5ef11e1c756ae3fd354dbd84bcd6 | Python | 3,894 | 124 | import time
import logging
from collections import defaultdict
import numpy as np
import torch
from torchdrug import core
from torchdrug.utils import pretty
logger = logging.getLogger(__name__)
class Meter(object):
"""
Meter for recording metrics and training progress.
Parameters:
log_interval... |
05634d4215c22336aaa26038ddfcd67c6b4082b737f7213836a70906bbfac285 | Python | 3,895 | 114 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
89267c3f1b4ca9cc3a0d7954f9bff611bb0fafa763be4647a723bd45b7773bc5 | Python | 3,895 | 135 | import os
import toml
import glob
import shutil
import logging
from ase.io import read
from ase.atoms import Atoms
from quacc import get_settings
from quacc import strip_decorator
from typing import List, Dict, Any
from quacc.recipes.newtonnet.ts import ts_job, irc_job, neb_job
def neb_ts_no_hess_irc_newtonnet(
... |
9f2521d4aa3ed836ecec7f79050b470bdee21d918e2ebcd2b9d60f4600f10edd | Python | 3,895 | 126 | from numba import njit
@njit
def define_parameters():
"""Create a Python dictionary and return all model's parameters."""
p = {}
### Physical Constants ###
p['T'] = 303.16 # K
p['F'] = 96500 # C/mole
p['R'] = 8.314 # J/(mole * K)
... |
d33930d120bd429cbde0206ad4f4e311ec903520712930b7b63e473c8b5b424f | Python | 3,895 | 126 | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides the base class for all autonomous agents
"""
from __future__ import print_function
from enum import Enum
import carla
from srunner.scenariomanager.time... |
278e21586f714d6b05b06892be5850b4138a29b67997630f491c7fe4fec920a7 | Python | 3,896 | 108 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.animation as animation
import time
import ray
import os
from neuron_model_parallel import NeuronSim
import math
from helper import fibonacci_sphere
### Plot Pyr Neurons
cell_id_pyr_lst... |
4876a94178441ff04886314ec1cf39be59e05165f07a53ade0325743574fadf0 | Python | 3,896 | 93 | #!/usr/bin/env python
# Purpose: Create a .csv file of Nx17 dice coefficients to assess similarity between MSHBM parcs
# Input: ind_parcellation output from Kong2019 pipeline
# Output: 1 Nx17 .csv file with dice coefficients
#
# Note: Users may need to run 'which python' and paste the correct path following the shebang... |
5132833c69ef611e67fc7de17ba38653978b5b7afb2a725ed83fe696652b33cf | Python | 3,896 | 123 |
import torch
import torch.nn as nn
import os
import joblib
import matplotlib.pyplot as plt
from tqdm import tqdm
import time
from data_utils.datasets5b import get_google_dataloaders ##for N(0,5)
from models.LSTM_WandADCnoise import LSTM_ClassificationAdcNoise
from utils.utils import init_exp,test_on_datalo... |
d3daa8cdd8b0c296fe029d91dbd2cd3b65b219c23e29edaafffebd56510b6e97 | Python | 3,896 | 103 | """
Code taken from ---
Supervised Contrastive Learning: https://arxiv.org/pdf/2004.11362.pdf.
It also supports the unsupervised contrastive loss in SimCLR
"""
from __future__ import print_function
import torch
import torch.nn as nn
class SupConLoss(nn.Module):
def __init__(self, temperature=0.05, contrast_mode... |
fb0261c4df661298bc408ce9e74c1150a1955e1584eb6c2f167cb562b055e750 | Python | 3,896 | 128 | from .basic_euclidean import point_to_trajectory, eucl_dist_traj, eucl_dist
from .basic_spherical import point_to_path, great_circle_distance, great_circle_distance_traj
######################
# Euclidean Geometry #
######################
def e_directed_hausdorff(t1, t2, mdist, l_t1, l_t2, t2_dist):
"""
Usag... |
f49fba0dcca934d0473dceb3501845e6144b247f869f2dc3f093cc4bce54a3d1 | Python | 3,897 | 102 | """
Pure-Python helpers for the cell_counting_legacy GUI subprocess/script building.
Owns:
- ``get_python_exe()`` - resolves python.exe from the running interpreter
- ``build_napari_cell_preview_script()``- napari subprocess script for a single-section
c... |
0fa1d08237ac8bdc3eb7bac04c704eda0ee12c53cdbbf9c2000d978ffee45ca3 | Python | 3,899 | 72 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
parser.add_argumen... |
b4a62fd7ec5cfe5d050b9b4a78a73bf543d4a555e9cd94a73c22dd7579364928 | Python | 3,899 | 131 | from maldi_nn.utils.data import *
import sys
from importlib.resources import files
import h5torch
import json
import os
import pandas as pd
import numpy as np
from maldi_nn.spectrum import *
import shutil
def RKI_raw_to_h5torch(RKI_ROOT, outfile):
data_path = files("maldi_nn.utils").joinpath("RKI_split.json")
... |
befa980a7a687e2230c5c162993adcf3ac24ab080c4e0b4aa7e5fb871c02b047 | Python | 3,900 | 84 | from typing import Dict, List, Union
import numpy as np
from ..base_transform import EEGTransform
class PickElectrode(EEGTransform):
r'''
Select parts of electrode signals based on a given electrode index list.
.. code-block:: python
transform = PickElectrode(PickElectrode.to_index_list(
... |
e723790201f1edb0f24b7f831e058f752b576e7afd5611e12ec4eb0f1bddac5f | Python | 3,900 | 94 | import torch
from prosper_nn.models.hcnn import HCNN
import pytest
class TestHcnn:
@pytest.mark.parametrize(
"n_state_neurons, n_features_Y, past_horizon, forecast_horizon, batchsize, sparsity, teacher_forcing, backward_full_Y, ptf_in_backward",
[
(10, 4, 5, 2, 1, 0, 1, True, True),
(1, 1,... |
0021b0291284c557fda63ad1f87efc7f927af961157d91dc9f1a3fc6e9b212ba | Python | 3,901 | 104 | """Synthetic fixtures test mechanics only; they are never research results."""
import json
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from scipy import sparse
from liquidaion_fly.connectome import load_graph, largest_scc
from liquidaion_fly.reservoir import Dynamics, Reservoir, random... |
935dfb57e71202406a64e44e1ae8e9acee2d20d88951a370cd9e5616cd735f0c | Python | 3,901 | 95 | import numpy as np
import matplotlib.pyplot as plt
class PulseTrain_Sinusoid:
def amp_train(self, amp, freq, total_time, sampling_rate=1e6):
self.sampling_rate = sampling_rate
total_samples = total_time * sampling_rate * 1e-3 ## total time in ms
time_array = np.linspace(0, t... |
ce9f64f8425a7f3ac7e1c7b0e933fc7f7b90faf71e10747614d1dbeba0cd919a | Python | 3,901 | 138 | import numpy as np
import threading
import time
import RPi.GPIO as GPIO
class Temp_Controller:
def __init__(self,is_values,ought_values):
self.is_values = is_values
self.ought_values = ought_values
self.inkugo = False # This is set for the polystyrene inkugo only
if self.inkugo:
self.kp ... |
6526005e69ef4e66aec57e9e4a3fbe27935d6aed5925b2f9aa50d60af97375f6 | Python | 3,902 | 101 | from typing import TYPE_CHECKING
import bpy
import numpy as np
from bpy.app.handlers import persistent
from PIL import Image
from .annotations.utils import render_annotations
from .scene.compositor import annotations_image
if TYPE_CHECKING:
from .session import MNSession
# this update function requires a self an... |
67406e4356efbe4d3643202d4ded84c0d0690edf1378eb0cbf292b402456ffb0 | Python | 3,902 | 145 | import numpy as np
from ...utils.collections import dotdict
def loadDefaultParams(seed=None):
"""
Load default parameters for the thalamic mass model due to Costa et al.
Subscript t (_t) referes to thalamocortical relay population (TCR), while
sucscript r (_r) referes to the thalamic reticular nuclei... |
a5e8e9cd0ddc1cd6b44f9317a66adccb31875bbeb861eb7a92f58997a51b0982 | Python | 3,902 | 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... |
bbe7f7bf7da725e4f6952c2a8d205c76bc8ff52dd5746d51c878e291665a1456 | Python | 3,902 | 127 | """Core recipes for DFTB+"""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import Remove, job
from quacc.recipes.dftb._base import run_and_summarize
if TYPE_CHECKING:
from typing import Any, Literal
from ase.atoms import Atoms
from quacc.types import CopyFiles, RunSche... |
048d865e0f791e3fdf0e88fb4ce3146153e1b1f931f5d31fd05fdb55ec245470 | Python | 3,903 | 111 | # -*- coding: utf-8 -*-
## Code for DREAM COMPETITION
import pandas as pd
import tensorflow as tf
import numpy as np
import pickle
import datetime
import tensorflow_addons as tfa
from tensorflow.keras.optimizers import Adam
from tqdm import tqdm
from model import *
# setup TPU
resolver = tf.distribute.cluster_reso... |
d723b6ba743c2f3d1962ea1c1f17655f94a72132e5f4cca4d00807fe6ee62606 | Python | 3,903 | 87 | from typing import Tuple
import torch
import torch.nn as nn
class CCNN(nn.Module):
r'''
Continuous Convolutional Neural Network (CCNN). For more details, please refer to the following information.
- Paper: Yang Y, Wu Q, Fu Y, et al. Continuous convolutional neural network with 3D input for EEG-based emo... |
febafe8acbfda6da4fa0d80244bf9ffeecc5c1be2012f4f3636425cf2061cc2f | Python | 3,903 | 125 | # 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... |
57f9c2e8433952faebcb3f247db9b035b1be7e27c56585080b749ecad97f95d9 | Python | 3,904 | 120 | from __future__ import print_function, division
from typing import List
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from topaz.model.utils import insize_from_outsize
class BasicConv(nn.Module):
'''A generic convolutional neural network scaffold.'''
def __init__(sel... |
2690c86b44620971561de6b8e2f9e12f1a77492e532b6bbb15d754cedd1468a5 | Python | 3,905 | 152 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 21 09:51:43 2023
@author: Kelly Payette
create T2* maps
input: multi-echo reconstructions
python t2s_fitting.py [complete path to folder with files] [sequence number] [num echos] [roi]
example:
python t2s_fitting.py /home/user/case_number_001 59 3 ... |
6403cdeba4528d4281f9d50d5e6f2f5549981310b5432aadd82f91e5ea428d11 | Python | 3,905 | 128 | import argparse
import dataset
import numpy as np
import tensorflow as tf
from pathlib import Path
def conv_block(x, filters, kernel_size):
x = tf.keras.layers.Conv1D(
filters=filters, kernel_size=kernel_size, padding='SAME')(x)
x = tf.keras.layers.BatchNormalization()(x)
x = tf.keras.activations... |
a6a123273b259686c7a3ce2dcd1c15f0b9e93a425712a7ac6a01d7729b28c686 | Python | 3,906 | 142 | from abc import ABC, abstractmethod
from typing import Iterator, Self
from elasticai.creator.hdl_ir import Node
class BaseWire(ABC):
types: set[type["BaseWire"]] = set()
def __init__(self, name: str):
self._name = name
@property
def name(self) -> str:
return self._name
@abstrac... |
d8e285bbc238c32b66e8595bf86e55b4ae4c9b6b9435ff4407aa6327cb86bc15 | Python | 3,906 | 101 | #!/usr/bin/env python
import numpy as np
MIN_HOLDING = 0.01
class Controller(object):
RIGHT_ARM = ['r_shoulder_pan_joint', 'r_shoulder_lift_joint', 'r_upper_arm_roll_joint', 'r_elbow_flex_joint',
'r_forearm_roll_joint', 'r_wrist_flex_joint', 'r_wrist_roll_joint']
LEFT_ARM = ['l_shoulder_pan_... |
4118808b5d5de6acb502d2d718064ce8510270e50627e6f4432636fbc8459f42 | Python | 3,907 | 110 | import logging
from pprint import pformat
import elasticai.creator.ir.datagraph as dgraph
from elasticai.creator.ir import IrSerializer, Registry
from ._ir import DataGraph as _DataGraph
from ._ir import NameRegistry as _NameRegistry
from ._ir import Node as _Node
from ._ir import NodeConstraint as _NodeConstraint
fr... |
4a5bd4bb4aeea9e25af1e81ca54624233bfbd3b2a5243dea3fe5b1736bf2d52d | Python | 3,907 | 112 | import pandas as pd
import numpy as np
from skimage.transform import resize
import sys
window = 10 #change window size to 100 when running with 1.1 Mb
stride = 1 #change stride to 10 when running with 1.1 Mb
observations = sys.argv[1]
# Alignment processing sweep
for i in range(int(observations)):
try:
df... |
72447fe83d82172b0ed2923f0d256b9fd685e63371510bad17b0a95788c93d70 | Python | 3,907 | 97 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
class DepthwiseSeparableConvModule(nn.Module):
"""Depthwise separable convolution module.
See https://arxiv.org/pdf/1704.04861.pdf for details.
This module can replace a ConvModule with the conv block r... |
7908423e792872a5545930d5c7819053a93649fb70815fb6b5858c64c23b5d57 | Python | 3,907 | 90 | from scipy.io import savemat
from tvb.simulator.lab import *
import time
import numpy as np
import multiprocessing as mp
import os
import argparse
def main(region_id):
""" TVB Simulation to generate raw source space dynamics, unit in mV, and ms
:param region_id: int; source region id, with parameters generati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.