sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f2989892c80ecd0999dec1aaed06bb2355c43aa2bd5ed1d1daebd7f42f60818d | Python | 4,761 | 117 | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
from resnet_features import resnet18_features, resnet34_features, resnet50_features, resnet101_features, resnet152_features
from densenet_features import densenet121_features, densenet161_features, densenet169_features, den... |
ebb1402914b9629268f216afe355a3630ff95179a0f0ca5632d8a155f8e1fc4e | Python | 4,762 | 138 | import os
import numpy as np
from os.path import join as pjoin
from nilearn.masking import unmask
import argparse
from dimension_encoding.shapemodel import (
load_shapecomps,
make_shape_model,
find_embedding_fmritrials,
)
from dimension_encoding.utils import (
load_singletrial_data,
load_clip66_pre... |
d1498c58c541ba296aa90849f642a2c9e983bff75dd838a4490987b9b326a042 | Python | 4,763 | 121 | import json
import numpy as np
import pytest
from sleeplab_format.extractor import config, cli
from sleeplab_format import reader
def test_extract_preprocess(ds_dir, tmp_path, example_extractor_config_path):
orig_ds = reader.read_dataset(ds_dir)
dst_dir = tmp_path / 'extracted_datasets'
cfg = config... |
e4d96317840df5ef39b0a329ab554c50e42ebd54747a2cbd77ec5423550df890 | Python | 4,763 | 131 | """Intensity preprocessing (clip+normalize / N4 / histogram-match) must drive
the ANTs metric ONLY - the registered OUTPUT has to be the warp applied to the
RAW moving, preserving original intensities. Previously the output was
``reg['warpedmovout']``, i.e. the percentile-clipped/normalized moving warped,
so the sa... |
3e3d033728727cedcead0ce968d85cc98edefe68c2775bdb968c0d5dbbca09c4 | Python | 4,764 | 136 | # Node-group asset "Group Pick Vector" (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... |
acf0cda10cad73193af7a0d7184364cca3139b7de464f163fd4953bf2648c608 | Python | 4,764 | 132 | import gzip
import html
import os
from functools import lru_cache
import ftfy
import regex as re
@lru_cache()
def default_bpe():
return os.path.join(os.path.dirname(os.path.abspath(__file__)), "bpe_simple_vocab_16e6.txt.gz")
@lru_cache()
def bytes_to_unicode():
"""
Returns list of utf-... |
297a99210ae990d292ff91bc1ae197ab84af7945f3f3bed0c517e9fa2894105b | Python | 4,766 | 99 | """
Train a Tsception Model on the DREAMER Dataset
==============================================
In this tutorial, we'll showcase how you can use TorchEEG to train a Tsception model on the DREAMER dataset for the task of emotion classification. Let's go through the process step-by-step, covering everything from datas... |
9129fd6367d374c8ba55c1db2fccc6705f78cbc4869e80ed394959baf4dcaa3c | Python | 4,767 | 117 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : sdmatrix.py
# Author : Yufeng Liu
# Date : 2023-01-30
# Description :
#
#======================... |
aa2c898d83a83c748ebdb01846c2eb8702fa26dead153079fcea849dfc112fbb | Python | 4,767 | 131 | # 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... |
e046f453af634419ea95b71d8cb0309a417a34e9464b2f89833cfe27b68abf1f | Python | 4,768 | 144 | ##
# \file correct_bias_field.py
# \brief Script to apply automated fetal brain mask segmentation using monaifbs/fetal_brain_seg.py
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date October 2017
#
# Import libraries
import numpy as np
import os
import niftymic.base.stack as st
import nifty... |
8a5a7e3a938d537d55c9958a9b28f99434859b6bd917f51185331cc0f464e958 | Python | 4,771 | 118 | import torch
from torch_scatter import scatter_mean
from torch import nn
import torch.nn.functional as F
from torchdrug import models, layers, core
from torchdrug.core import Registry as R
from siamdiff import layer
@R.register("models.GVPGNN")
class GVPGNN(nn.Module, core.Configurable):
'''
Modified based ... |
a5b530b2f29163f1ece93a48574d4e1a1ac76cda9b07f8409678a427e18f9135 | Python | 4,771 | 146 | # 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... |
eeee33cee93d47fae0d1bb58533bed1f017ce8c3254ac2a881a2b80b52c3f8b7 | Python | 4,771 | 158 | # pylint: disable=invalid-name, missing-function-docstring, unused-argument, too-many-arguments, too-few-public-methods
""" Logistic Regression model module """
import time
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import StratifiedShuffleSplit
from apto.util... |
212a8302ee09798c900b85e7f12c3bb07b2a2c5e3652e1cdce4ae65471d61428 | Python | 4,772 | 126 | #!/usr/bin/env python3
import sys, os
from pandas.io.parsers import read_csv
import numpy as np
import pandas as pd
import multiprocessing
try:
gtffile = sys.argv[1]
outputfile = sys.argv[2]
except:
sys.exit("Please, give: (1) gtf file; (2) exons")
#### Convert gtf file in an easy to handle data frame ###... |
493c3b8e25eab2b0af8de714826ee92d704eaef8b5c135a55e93469dc4f13f89 | Python | 4,772 | 143 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : sdmatrix.py
# Author : Yufeng Liu
# Date : 2023-01-30
# Description :
#
#======================... |
d1d2c94048a4a392a9fffa1ca1b69b33ac0fbe813f9552d8f2a2d2ba4cd9da1a | Python | 4,772 | 135 | """Implementation of CLI view command."""
import matplotlib.pyplot as plt
import matplotlib as mpl
from cycler import cycler
from treem.morph import Morph
from treem.io import SWC
from treem.utils.plot import plot_neuron
from treem.utils.plot import plot_section
from treem.utils.plot import plot_tree
from treem.uti... |
04716b54d70d594d60c501f8924becce3832edca34a2a5b854c6f03e3229cfaf | Python | 4,773 | 161 | # coding: utf-8
import os.path as osp
import torch
import numpy as np
import cv2
from .utils.prior_box import PriorBox
from .utils.nms_wrapper import nms
from .utils.box_utils import decode
from .utils.timer import Timer
from .utils.functions import check_keys, remove_prefix, load_model
from .utils.config import cfg... |
681b7251150ca502a3daa03daf521f4703329031438dc434c6bbda1fb2745c00 | Python | 4,773 | 163 | # Node-group asset "Visualize Relative Atoms" (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 TY... |
fa8244003bba9d2038a505ce9ba6e63cdddf446beaf86f4421ba577167c0e42e | Python | 4,773 | 176 | """
========================
Study configuration file
========================
Configuration parameters and global values that will be used across scripts.
Authors: Jose C. Garcia Alanis <alanis.jcg@gmail.com>
License: BDS-3
"""
import os
import multiprocessing
from pathlib import Path
import numpy as np
import js... |
de164346c967dd88c1684c73a1f1aa6b1c383a833c0e4bf7eed59dcb30ef3912 | Python | 4,775 | 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... |
8d6931af917b5fe58acc9e0a75bbbf9cf5dc2fd7cefb256cb3e6b49bab48dbdc | Python | 4,776 | 140 | """
Avoid double picking by forcing particles within the same tomogram to stay in the same half set
Input: - Source STAR file
Output: - A STAR file where particles within the same tomogram are forced to go to the same half set,
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global variables
##... |
08be6364cb39db83b944d81481462114b5356cb2e1ef6e98501bc6825444a774 | Python | 4,777 | 112 | import os
from argparse import ArgumentParser
import mlflow
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, LearningRateMonitor
from pytorch_lightning.loggers import TensorBoardLogger
from rich import print
from data_loading.data_loader import PHDFMDataModule
from mlf_core.mlf_... |
3f28688be5ee00d334f0e591ca7d48e9bcdbd9cad456ad4ddc56d92a0c75cbb3 | Python | 4,777 | 129 | # Node-group asset "Residue Parameter" (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... |
592d92e1a3b89f0be4cc91bb360329bb4def29b667e9f97ad08297951bda7c94 | Python | 4,777 | 152 | # -*- coding: utf-8 -*-
#
# Time-frequency analysis based on a short-time Fourier transform
#
# Builtin/3rd party package imports
import numpy as np
import logging
import platform
from scipy import signal
# local imports
from .stft import stft
from ._norm_spec import _norm_taper
def mtmconvol(
data_arr,
sam... |
5a2615a550734c74f8c5c5a621496cd8987728209b8ba583fba8f072bb07ddc9 | Python | 4,777 | 183 | import os
import pickle
import unittest
from parameterized import parameterized
from HyDGL.file_handler import FileHandler
from tests.utils import TEST_FILE_LALMER, TEST_FILE_QM_DATA_OREDIA, TEST_FILE_JSON, Utils
class TestFileHandler(unittest.TestCase):
@parameterized.expand([
[
TEST_FILE_... |
bf8e158395d831e895eb22b305641736929bd749d7af051929b47d46eefe01e1 | Python | 4,778 | 131 | import numpy as np
from scipy.io import FortranFile
from scipy.sparse import csr_matrix
from ..matao.mataocsr import MatAOCSR
from .aodata import AOData
from .struio import from_siesta
from .hrloader import read_vnloc
def read_orbindx(filename):
with open(filename) as fp:
line = fp.readline()
lin... |
de66c01369bbbfd07e2f085d658370d96cb38520bb7bcbc79fa13554d881792d | Python | 4,779 | 101 | # Copyright (c) 2021, 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... |
05b3e635d1987b1aa2374d9dfd6409dcdada82a614d7ab3bd3197748eef6be3d | Python | 4,782 | 96 | import os
from copy import copy
from typing import Union
import numpy as np
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
def train_test_split_groupby_trial(
dataset: BaseDataset,
test_size: float = 0.2,
shuffle: bool = F... |
1fb465a36aa1039bd9725e2caa906af196da1d6b5407adcfe7e3f769cb3041f4 | Python | 4,782 | 167 | """
Monkey patching of distutils.
"""
import functools
import inspect
import platform
import sys
import types
from importlib import import_module
import distutils.filelist
__all__ = []
"""
Everything is private. Contact the project team
if you think you need this functionality.
"""
def _get_mro(cls):
"""
... |
73bcb680a3bcbfb01962d67bf316bebff010696246ecf1ff2ba58a3fff16a1cf | Python | 4,786 | 147 | import os
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.pyplot import imread
from scipy.optimize import minimize
import autograd.numpy as np
from autograd import value_and_grad
# Fluid simulation code based on
# "Real-Time Fluid Dynamics for Games" by Jos Stam
# https://www.josstam.com/_files/ugd... |
864f436cab22bd6972a52df4c4220774b1fc62e8cd39de48301fc7da48f2e553 | Python | 4,786 | 147 | import numpy as np
from collections import defaultdict
import time
from sklearn.cluster import AffinityPropagation
import torch
def cluster_label2list(label):
cluster=[[] for _ in range(np.max(label)+1)]
for i in range(len(label)):
cluster[label[i]].append(i)
return cluster
def calc_degree(graph_... |
d853b9faf22a804161a0b52358056272e2238ac07af76f296ff0dd0061832e36 | Python | 4,787 | 129 | """
Template matching on a particles STAR file
Input: - The particles STAR file
- Template matching settings
Output: - A new column with the template matching scores (_psCCScores) is added to the STAR file
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global variables
#############... |
1203435be435f2e2eac1a58a39f9649f66dc00d00fccf0cb9e911f45cc5b6e97 | Python | 4,788 | 132 |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
tmp = np.ones([256,4])
tmp[:,1] = tmp[:,1]*np.linspace(0,1,256)
magenta_cm = ListedColormap(tmp)
tmp = np.ones([256,4])
tmp[128:256,0] = tmp[128:256,0]*np.linspace(1,0.5... |
5482fc8ee25fb2fe22b195c4dfb1c0c110297ff5e2fadcc57b5d546a175f2d5b | Python | 4,789 | 86 | from pddlstream.algorithms.downward import fact_from_fd, plan_preimage, apply_action, \
GOAL_NAME, get_derived_predicates, literal_holds
from pddlstream.algorithms.scheduling.recover_axioms import extract_axiom_plan
from pddlstream.algorithms.scheduling.reinstantiate import reinstantiate_action_instances, reinstant... |
03b094e975b284e1ef9280137f7874553f72e3c57a1cdc80c5fc507a2090d663 | Python | 4,790 | 122 | 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... |
44c4c2e6376afe991ace68302cf9d5f29d0027fcc0bf7ae1ff9442f22b20a4f8 | Python | 4,790 | 169 | import pathlib
from torch.utils.tensorboard import SummaryWriter
import yacs.config
class DummyWriter(SummaryWriter):
def __init__(self):
pass
def add_scalar(self, tag, scalar_value, global_step=None, walltime=None):
pass
def add_scalars(self,
main_tag,
... |
5eba81c4fd4942fc25aa97e508cc56d923958e3662608a6b0a7319545f5b36c9 | Python | 4,790 | 140 | # -*- coding: utf-8 -*-
import tensorflow as tf
from .. import _logging as logging
from .core import *
__all__ = [
'PadLayer',
'ZeroPad1d',
'ZeroPad2d',
'ZeroPad3d',
]
class PadLayer(Layer):
"""The :class:`PadLayer` class is a padding layer for any mode and dimension.
Please see `tf.pad <ht... |
ef5009c4ec80a0771e06c75e86e3d29da92de6005b4b05d3c2f5f91c44352250 | Python | 4,790 | 151 | """Utilities for manipulating geometry of morphology reconstructions."""
import math
import numpy as np
from treem.io import SWC
def rotation_matrix(axis, angle):
"""Computes rotation matrix for 3D manipulations.
Args:
axis (float[3]): rotation axis.
angle (float): rotation angle in radian... |
18e2762c1fc620aa36403b2632de2f437cdf739b4254a644d4b8620cf7a608f7 | Python | 4,791 | 121 | import torch
from torch.utils.data.sampler import Sampler, WeightedRandomSampler
import math
class SubsetSampler(Sampler):
r"""Samples elements sequentially from a given list of indices, without replacement.
Args:
indices (sequence): a sequence of indices
generator (Generator): Generator used... |
80e12096782f6e93dd2db84db29342dcc917367f141a8faaf494499fcd30474f | Python | 4,791 | 103 | """
Modules containing class that
1. maintain detailed soma morphology information of the neurons in circuit
2. function for single neuron simulation and whole circuit simulation in NEURON
"""
import numpy as np
from neuron import h
from network.detailed_circuit import *
class PointCell(Cell):
"""class fo... |
bd4892a0e0e0efc458461fe0ab121144d66e1df281ca74563fe1d7a66ebecc9d | Python | 4,791 | 168 | """Utilities for k-point handling."""
from __future__ import annotations
from typing import TYPE_CHECKING, cast
import numpy as np
from pymatgen.core.structure import Structure
from pymatgen.io.ase import AseAtomsAdaptor
from pymatgen.io.vasp.inputs import Kpoints
from pymatgen.symmetry.bandstructure import HighSymm... |
454966913366b2f6e87ed95859d3b0e3659ace1d5f6f263c94e89ad35ba71331 | Python | 4,792 | 100 | import os.path
import re
from collections import defaultdict
from ckg.graphdb_builder import mapping as mp, builder_utils
#########################
# OncoKB database #
#########################
def parser(databases_directory, download=True):
config = builder_utils.get_config(config_name="oncokbConfig.yml", d... |
ea36190bb9063f326c01063726e6138dfb64804c0fdcf8210480676cad1685ef | Python | 4,792 | 139 | import typing
import numpy as np
import torch
import torchvision
from flytracking.detection.models.efficientdet_base import EfficientDetBackbone
from flytracking.detection.utils.efficientdet import (
BBoxTransform,
ClipBoxes,
)
from flytracking.detection.utils.process import (
aspectaware_resize_padding,
... |
706415480e5d02cedc690f6ccf8925958bda2386691a2ab55a10a06889973520 | Python | 4,793 | 139 | import logging
from optparse import Values
from typing import Any, Iterable, List, Optional, Union
from pip._vendor.packaging.version import LegacyVersion, Version
from pip._internal.cli import cmdoptions
from pip._internal.cli.req_command import IndexGroupCommand
from pip._internal.cli.status_codes import ERROR, SUC... |
1d7fc2e21d515c5e71ed7cbe9a83bfb18e41376d79a8e91cd9d5a97a3e86ad43 | Python | 4,794 | 238 | #!/usr/bin/env python3
# Crude script for the conversion of
# Gaussian output files to frequency files
# for molden. Only works with freq=hpmodes
from sys import argv
#from constants import NUMBERS, au2a
au2a = 0.529177211
NUMBERS = {
'H': 1,
'He': 2,
'Li': 3,
'Be': 4,
'B': 5,
'C': 6,
'N'... |
217d0a7ece6bf6ee326cfd71f685c06a8449189f9de764c9d254aeb48a2d301b | Python | 4,794 | 119 | from __future__ import annotations
import pandas as pd
from sklearn.compose import make_column_selector
from tests.mock_data import MockTrainingData, MockCuppaClassifier
from cuppa.classifier.classifiers import SubClassifiers, MetaClassifiers, ClassifierLayers
def get_expected_probs(clf_names: str | list[str]) -> pd... |
aba284ac450080723174de824085fe22209e6b864e9632e646f7bbde54007255 | Python | 4,794 | 144 | import cv2
from numpy import std, square, mean
import numpy as np
from scipy.ndimage import label
import os
def crop_image(image,crop_width,crop_height):
image_height = image.shape[0]
image_width = image.shape[1]
roi_left = int(max(image_width/2 - crop_width/2,0))
roi_right = int(min(image_width/2 + cr... |
ec73196068cf5813ddd843dabc41d9a7e8bcfb98187d8c67990f3c7b62c02e29 | Python | 4,794 | 126 | # 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... |
0f3939e39af761f68db9057ca17fca159bc4e66c8d6c82bca7a2198071a9a864 | Python | 4,797 | 150 | import os
import torch
from scipy.io import loadmat
from scipy.interpolate import interp1d
import pandas as pd
import numpy as np
from tqdm import tqdm
import random
signal_size = 1024
def res(array, npts):
interpolated = interp1d(np.arange(len(array)), array, axis = 0, fill_value = 'extrapolate')
... |
e7b47e1d2c63d0f5a620b30dd0616650da8431fac45526a65f28c3f96ebf7dbb | Python | 4,797 | 115 | ######################## BEGIN LICENSE BLOCK ########################
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ve... |
a2071db71f924dc7f485f11f6c3883121764d8fa5dfca8131ac9e1759baf4c6b | Python | 4,799 | 155 | """
Script for simplifying an input graph into a tree and extracts its properties
Input: - Pickle file with a GraphMCF
Output: - Output tree (pickle, VTK and GT files)
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import sys
import time
import getopt
import operator
... |
bc150b273ec259d8e3ddd3dfba73857f03bd66fc2af6d5461b2a8265c8b63fcd | Python | 4,799 | 154 | import time
from functools import wraps
from contextlib import contextmanager
import datetime
from functools import reduce
import numpy as np
import random
import torch
import os
import logging
# --------------------------------------------
# time this
# --------------------------------------------
def timethis(func):... |
0cb8aba59ec74f1ac6f801c641c24720e76829498c11fa8a443928533cc9d608 | Python | 4,800 | 148 | """
Module for decoding spatial position from neuronal activity
(c) 2016 C. Schmidt-Hieber
GPLv3
"""
import numpy as np
from scipy.special import factorial
def decodeMLPoisson(ratemap, counts_time):
"""
Decode spatial position from neuronal activity. Compute
maximum likelihood assuming spikes are a Pois... |
8d09d2563bb0d1d8e2de6eea2258b9e9b46916bd66a3742cdedd3660dba4cd1b | Python | 4,800 | 151 | # %%
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
import math
import numpy as np
import torch.optim as optim
import torch
import torch.nn as nn
from torch_geometric.data import DataLoader
import torch.nn.functional as F
import argparse
from metrics import accuracy, precision, auc_score, recall
from dataset impor... |
b0a43761e733a1a12135d791b32344c52bb8797f6d2fbc4d5e7c7884dfc22ea9 | Python | 4,801 | 133 | # 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... |
f77726e745c7c8ae22079424b101405b3f840da94fa275159f0e276e9b7827c7 | Python | 4,802 | 165 | """Parameter-related utilities for the Q-Chem calculator."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from pymatgen.io.ase import AseAtomsAdaptor
from pymatgen.io.qchem.inputs import QCInput
from pymatgen.io.qchem.sets import QChemDictSet
from pymatgen.io.qchem.utils import ... |
3b39d27b8654dcf3ecb91f4114604ebb19ce64aedf96864c08c4f25db1543f3e | Python | 4,803 | 197 | import os
import numpy as np
__author__ = 'martinez'
#####################################################################################################
# File with the set of the globals variables of PySeg package
#
# Paths
ROOT_DIR = os.path.dirname(os.path.dirname(os.getcwd()))
DATA_DIR = ROOT_DIR + '/data'
DPS... |
f144b74c31b74b40ae092eca67eed88baa3abb19382172f98c4095adb20dce31 | Python | 4,803 | 197 | __author__ = 'martinez'
import os
import numpy as np
#####################################################################################################
# File with the set of the globals variables of PySeg package
#
# Paths
ROOT_DIR = os.path.dirname(os.path.dirname(os.getcwd()))
DATA_DIR = ROOT_DIR + '/data'
DPS... |
8473a74d1ed478bfbd0c4170c49aa456a3978f223cdfaf28a935f341be663638 | Python | 4,806 | 143 | """Process-tree termination + pid-file helpers (issue #119).
Exercises the real logic against stand-in ``python -c "time.sleep(...)"``
subprocesses, per the issue's "How to test". Qt-free.
"""
import os
import subprocess
import sys
import time
import pytest
from regtools.utils import proc_control as pc... |
8ed9c9a0b5577c266df5b502bf4892a0910e9d6f53306c00baf386a33e6c09bb | Python | 4,806 | 141 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Meters."""
import datetime
import time
import numpy as np
import os
from collections import defaultdict, deque
import torch
from fvcore.common.timer import Timer
import json
from datasets import logging
from datasets im... |
bf3de0a7d51644b8ca8c9ad1665b142b3a63b6c17bdada4a045758e370dc41b5 | Python | 4,806 | 138 | """Plot continuous predictions for all subjects"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Annotated, Literal
import matplotlib as mpl
import numpy as np
import pte
import pte_decode
from matplotlib import pyplot as plt
from pytask import Product
import motor_intent... |
1a08d885ce3e5524d40d3c31cf321be45e8638700f6f318d4b5f5dd4fc5abc4f | Python | 4,807 | 127 | # 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... |
88b2a46fc9a39707b22ddab6632da1b7d6ce9b5f00864279d8dc19f4df9f05b6 | Python | 4,807 | 152 | from __future__ import absolute_import, division, print_function
import sys
import numpy as np
import pandas as pd
from topaz.algorithms import match_coordinates
def precision_recall_curve(target, pred, N=None):
if N is None:
n = target.sum()
else:
n = N
## copy the target and predi... |
dd949a071cbf12d716edca67b05b9eb0926fd6d98dc0fed477b46337a0b0f41a | Python | 4,807 | 131 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : math_utils.py
# Author : Yufeng Liu
# Date : 2021-07-19
# Description :
#
#====================... |
ed5b20ce4528cb6dcd71950823ea5fd004150ab91ef3898296c2024f9eeaeca7 | Python | 4,809 | 165 | """Parameter-related utilities for the Q-Chem calculator."""
from __future__ import annotations
from logging import getLogger
from typing import TYPE_CHECKING
from pymatgen.io.ase import AseAtomsAdaptor
from pymatgen.io.qchem.inputs import QCInput
from pymatgen.io.qchem.sets import QChemDictSet
from pymatgen.io.qche... |
9187e495cd3bda3e7020d01a3176c0e080f3f8fb6fc8e9643e15895793112457 | Python | 4,810 | 103 | """
Modules containing class that
1. maintain detailed soma morphology information of the neurons in circuit
2. function for single neuron simulation and whole circuit simulation in NEURON
"""
import numpy as np
from neuron import h
from eworm.network.detailed_circuit import *
class PointCell(Cell):
"""cl... |
e83fd9bfc66e644167419e4ba83862ff9f2f02197ad7e5819be66102debe2b05 | Python | 4,810 | 143 | """AQCat25-compatible slab recipes"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from quacc import job
from quacc.recipes.vasp._base import run_and_summarize
if TYPE_CHECKING:
from typing import Any
from ase.atoms import Atoms
from quacc.types import CopyFi... |
222601a605b5a286659341616770d8142f37777b3fed86da5705434bf98c89c9 | Python | 4,811 | 142 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you ca... |
243d280d6dadefdcf2351bb508c42210d7de34a1eab9195e97223de04e7adad7 | Python | 4,812 | 113 | """Regression: the CCF boundary editor must not corrupt the shared
``load_nifti_obj`` lru_cache.
``volume_io._load_nifti_obj_cached`` (maxsize=2) returns the SAME nibabel
proxy - and the SAME backing data array via ``np.asarray(obj.dataobj)`` /
``get_fdata()`` - to every caller of a given ``(path, pir)``. Its doc... |
94267a8e35d6bb089e41897a688520bfd0bd852a39c60d338f5c8031249391a6 | Python | 4,812 | 111 | import data.ABIDEParser as Reader
import numpy as np
import torch
from utils.gcn_utils import preprocess_features
from sklearn.model_selection import StratifiedKFold
class dataloader():
def __init__(self):
self.pd_dict = {}
self.node_ftr_dim = 2000
self.num_classes = 2
def load_data(s... |
1e54c82a7a88c009dcde4065c01fd259206195a58875cf8bf70b68d28d3be6d3 | Python | 4,813 | 107 | 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 ... |
6f3609c073bdf93adc0008e0dfbde6324de5afe4efb9d7e54a1ceab0f3f173ae | Python | 4,817 | 137 | from typing import Optional, Callable, Tuple, List
import torch
from torch import Tensor
import torch.nn as nn
from torchvision.models.vgg import VGG
from torchvision.models.resnet import ResNet
from constants import N_ITEMS
__all__ = ['rey_multiclassifier']
_DROPOUT_RATES = (0.3, 0.5)
_BN_MOMENTUM = 0.1
class C... |
636acf537e4f827544d5d646cbb51e2bd19959845605024041b00e30f960e267 | Python | 4,818 | 134 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Reorganising NIfTI files from dcm2niix into the Brain Imaging Data Structure
"""
import argparse
import logging
import platform
import sys
import os
from pathlib import Path
from datetime import datetime
from dcm2bids.dcm2bids_gen import Dcm2BidsGen
from dcm2bids.uti... |
a3b6c4111ae82f22a9edfca622c986a463d60515bfccebe3de0696ee07767bce | Python | 4,818 | 181 | """Init data for quacc."""
from __future__ import annotations
import threading
from importlib.metadata import version
from logging import INFO, LogRecord, basicConfig, getLogger
from pathlib import Path
from typing import TYPE_CHECKING
from warnings import filterwarnings
from ase.atoms import Atoms
from pymatgen.io.... |
2376bd28f45d61fff29f7fb27f3e9164b300c96edf187dc8ff5ee03e8522c2a8 | Python | 4,819 | 133 | """Regression tests for the 2D-registration CCF annotation-slice output.
When the fixed image is the 3-D CCF atlas, ``_load_and_orient_2d`` slices the
Allen annotation at the same coronal index, puts it on ``template_slice``'s
exact grid, and returns it as ``annotation_slice`` (int32). The pipeline then
writes i... |
1916687fbe8879ce223f864e4530367e7b8817b600420a8672fae0c18d0eedc8 | Python | 4,823 | 99 | import numpy as np
import pandas as pd
import vireoSNP
def load_ground_truth(n_mut, af_pct, size=None, tree=None):
if size is None and tree is None:
ground = pd.read_csv('data/' + str(n_mut) + '_clonal_variants_fixedAF' + str(af_pct) + 'pct/clonal_var.csv')
elif tree is not None:
ground = pd.re... |
1b6b5dd6590edc8dfdca748c538761cb1f2d8f92f9c2e9580ba50b4ddc61613a | Python | 4,824 | 149 | # ----------------------------------------------------------------------
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/... |
74135222e4bf92482a6f04c2ee3a4d4de320e9458b910db2229d04221c1ff024 | Python | 4,824 | 144 | from itertools import chain
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 i... |
407e9512a793429f6869ab676a86be709348f943a09817afa45f848d719b0d82 | Python | 4,826 | 121 | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname((os.path.abspath(__file__))))))
from PyUtilities import read_config_file
import logging
import pandas as pd
import os
import shutil
from bids import BIDSLayout
# Configure logger
workflow_logger = logging.getLogger('workflow_logger')... |
8bf95fe79e29f734283f5013b2cdfac60cbada42ff418df4adff2eb94f10ed6c | Python | 4,826 | 146 | # 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... |
b4792d4fead77ef175ca312df803f98a20a34b0a569647bc4b0b2b90dd0836e6 | Python | 4,826 | 112 | import sys
sys.path.append('/home/brains/worm_simulation/neural_model/')
from network.init import *
from network.input import *
from network.simulate import *
from network.export import *
from utils.args import *
from utils.jsonfunc import *
import numpy as np
import os
from neuron import h
from cnn import CNN, CNN2
im... |
043de5a23d329829d4feecbb2cec43c3394fe033991cbbc574d22c487e6927cd | Python | 4,827 | 136 | from collections.abc import Sequence
import numpy as np
import pandas as pd
from scipy.sparse import issparse
from pertpy._logger import logger
from ._base import LinearModelBase
from ._checks import check_is_integer_matrix
class EdgeR(LinearModelBase):
"""Differential expression test using EdgeR."""
def ... |
bc6a3d93ae9c4cac318679358ee0fa0508fecf65e647aa9f5cf1e51bff3c7740 | Python | 4,828 | 100 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import sys
import os
import time
import numpy as np
import pandas as pd
from tqdm import tqdm
import pickle
# Network specific
from connalysis.network import topology
from connalysis import randomization
# Projec... |
c792afb7d6c69e7aa83db7709ce04be7b99c7026e1fb1dc5048e7a1b7170f546 | Python | 4,828 | 165 | from copy import deepcopy
import torch
class ModelSaver:
def __init__(self, model, optimizer, dir_model, logger):
self.model = model
self.optimizer = optimizer
self.dir_model = dir_model
self.logger = logger
def save(self):
self.logger.info(" ===== Saving model! ====... |
ac43b077a51ff5446a07d8f49fdd63821b4faf1a6ba7198ef9dca6773d4cb5b2 | Python | 4,830 | 129 | ##from CSBDeep
try:
from tensorflow.keras.layers import Dropout, Activation, BatchNormalization
from tensorflow.keras.layers import Conv2D, MaxPooling2D, UpSampling2D, Conv3D, MaxPooling3D, UpSampling3D
#from tensorflow.keras.layers.merge import Concatenate
from tensorflow.keras.layers import Concatena... |
453612e49a118a0e6f92661a7cce2388e70824e029b635d40b0e7f851062b7de | Python | 4,831 | 129 | import conntility
import pandas
import numpy
import bluepysnap as snap
import json
"""
Helper functions to load the connectivity of a network from multiple sources.
To filter them into a subnetwork. And generate random control networks.
"""
def load_network(cfg):
"""
Load the connectivity of a network from so... |
e56376f86cfdc98fb9c6ed6e81f9b1e784c9592410980cbcccaee1b5bfcf604f | Python | 4,832 | 120 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 15 09:24:00 2019
@author: adele
"""
import logging
import os
from os.path import join as joinP
import cPickle as cpk
from collections import Counter
import numpy as np
import matplotlib.pyplot as plt
from bioservices import KEGG
import pandas as p... |
0bcea3302bf55968b058668ec95ccceade4460cca38c33f792c1fc5bd6980429 | Python | 4,833 | 154 | """Radiation pattern of a dipole antenna above a ground plane using Brillouin-zone integration.
Tutorial reference:
https://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/#antenna-above-a-perfect-electric-conductor-ground-plane
"""
import math
from typing import Tuple
import matplotlib.pyp... |
e6b257c305d8fa8fdefce14f3640aea877bbfd78619559f444e10ce3e8d9b2c6 | Python | 4,833 | 159 | import torch
from einops import rearrange
from torch import nn
from x_transformers import Encoder
class SimpleViT(nn.Module):
def __init__(self, *, dim, depth, heads, emb_dropout=0):
super().__init__()
self.dropout = nn.Dropout(emb_dropout)
self.transformer = Encoder(dim=dim, depth=depth,... |
97df1940b0179b7411bcc81819050f3e686224ecdf87a099bc202e7bcc09d818 | Python | 4,835 | 144 | # Node group "Curve to Mesh with UVMap" (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... |
8201b9586b9af81473af38e5d0bd5210e3a3edec743516e7aaf72229c67cea57 | Python | 4,838 | 121 | """Test the spectrum device interface based on spcm_core, without driver and cards."""
import pytest
import console.spcm_control.abstract_device as abstract_device
from console.spcm_control.abstract_device import SpectrumDriverError, type_to_name
CARD_HANDLE = 1 # handle returned by the mocked spcm_hOpen, see confte... |
961e32b944fff16a15ff88292605edb6c3fe888f68d989d126c89c63293237e3 | Python | 4,838 | 131 | """FHI-aims recipes for the MAD dataset."""
from __future__ import annotations
from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING
from ase.data import atomic_numbers
from quacc import Remove, get_settings, job
from quacc.recipes.ai... |
ad5d445fd260f55bb03f900afa5f679eb2545defacf9a64cfb371c8558513a59 | Python | 4,838 | 168 | # 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... |
eaadedafa0ce9bd945df03ffb7c2dfd6a538b549acc728db82a8d4399660a624 | Python | 4,838 | 128 | """Testing CLI command modify."""
import subprocess
import os
def test_scale():
"""Tests for scaling of dimensions."""
os.chdir(os.path.dirname(__file__) + '/data')
proc = subprocess.Popen(['swc', 'modify', 'pass_simple_branch.swc',
'-s', '1', '1', '1', '-e', '2',
... |
5e5611aabbc98cbe8e3c7017c5d120071992216fff8b44d4fe883aa60fdf461f | Python | 4,839 | 172 | #!/usr/bin/env python
# coding: utf-8
# ## Exploration of feature selection robustness
#
# We want to look at whether or not there are differences in how "robust" (i.e. stable/consistent between cross-validation folds and random seeds) the feature selection results for different selection methods are.
# In[1]:
imp... |
03221331c4c2ca1eb48357999177d88a0fa1f2caf3e84156263bb140a2aff8ed | Python | 4,840 | 138 | """Runtime CPU-thread limiting for co-locating multiple Sella processes.
Sella is heavily CPU-BLAS bound (internal coordinates, geodesic ODE, Hessian
updates), and nothing in the stack caps thread pools by default: numpy/scipy
OpenBLAS and the torch CPU pools each grab as many threads as there are cores.
Running N Sel... |
9b5634789e8298b7fef2f3ef91e938fd67c796b03de6c38cc9352c3be3c9ef2f | Python | 4,840 | 148 | import random
from typing import Dict, List
import matplotlib.pyplot as plt
import numpy as np
import torch
from sklearn.preprocessing import minmax_scale
def data_normalization(X_train, X_test):
X_train_normalized = []
X_test_normalized = []
for x in X_test:
X_test_normalized.append(minmax_scal... |
bff16dd1bd79f9d6090752b2f830080cccc98cf7b908d6081ef4fd5cebba9a91 | Python | 4,840 | 133 | import argparse
import multiprocessing
import pickle
from functools import partial
from pathlib import Path
import numpy as np
import pandas as pd
import psutil
from archngv import NGVCircuit
from joblib import Parallel, delayed, parallel_config
from tqdm import tqdm
from astrovascpy import bloodflow
from astrovascpy... |
356a746cc6316c65c2a99450934f5e1a5d629cacbaa95af956b284b3c3617ec2 | Python | 4,841 | 111 | # C. Cocuzza, 2021
# Python version: adapted from maxT.m (MATLAB function) by Michael Cole & Taku Ito
# Statistical significance for (1) nonparametric data, and (2) family-wise error correction of nonparametric data
# Max-T NPPT, Nichols TE, Holmes AP. (2002). Nonparametric permutation tests for functional neuroimagin... |
b0c5cebd8962ba511ff70abf9f0887ab77d74162cfb6812194cdd631fca2d204 | Python | 4,842 | 146 | """Qt rendering of registration help content (tooltips + dialog).
Pulls all text from regtools.registration.registration_help; holds no content
of its own. A single RegistrationHelpDialog is reused across info buttons.
"""
import html
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QDialo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.