sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fce17996ff0dacc77a56b9b435d871c426b4efec9a0467b2ceeb7c5a7c493498 | Python | 6,736 | 181 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import odl
from odl.contrib import torch as odl_torch
class Initialization_ConeBeam:
def __init__(self, image_size, image_reso, proj_angle, proj_axis, proj_size, proj_reso, dde, dso):
'''
image_size: [z, x, y], as... |
936958bd49126b15323efa6fe12f39f38d09e06b0e41a20051c6dc3dd4074d28 | Python | 6,737 | 212 | # polarization grating from C. Oh and M.J. Escuti, Optics Letters, Vol. 33, No. 20, pp. 2287-9, 2008
# note: reference uses z as the propagation direction and y as the out-of-plane direction; this script uses x and z, respectively
import math
import matplotlib.pyplot as plt
import numpy as np
import meep as mp
resol... |
31737ccb75a314127cb0b6fcfd4e086f53522d05c2d03b982cb453b94da89da2 | Python | 6,738 | 126 | import os
path = "/home/zhaomengdi/Project/eworm/Celegans_as_deep_net_net/chemotaxis_net/components/model_302"
files= os.listdir(path) #得到文件夹下的所有文件名称
print(len(files))
s = []
cell_name_list = ["I1L", "I1R", "I2L", "I2R", "I3", "I4", "I5", "I6", "M1", "M2L", "M2R", "M3L", "M3R", "M4", "M5", "MCL", "MCR", "MI", "NSML", "... |
ec1daccd73bc4530cfdb29e9f41869c95f2a6c45f58ca18f1b9ac456656fd964 | Python | 6,738 | 185 | import cv2
import numpy as np
import argparse
from lib.core.inference import get_final_preds
from lib.utils.transforms import get_affine_transform
from lib.config import cfg
import torch
import torchvision.transforms as transforms
""" The file Contains a set of functions and definitions used for pose estimation."""
... |
e7c32223796756b382cdd65416713cabca3d4bb60faaa808ef151ce8a4b6596a | Python | 6,739 | 166 | from simtk import openmm, unit
from simtk.openmm import app
from simtk.openmm import XmlSerializer
from analyse import *
import time
import os
import sys
from argparse import ArgumentParser
import random
parser = ArgumentParser()
parser.add_argument('--proteins',nargs='+',required=True)
parser.add_argument('--numbers'... |
05b3f2f977f21f027accaa33b903af36f419cecc7dbdd6ffd1b6179fb86c0537 | Python | 6,741 | 189 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import sys
from unittest import TestCase, main, skipUnless
try:
from unittest.mock import patch, Mock
except ImportError:
from mock import patch, Mock
from ..ansitowin32 import StreamWrapper
from ..initialise import init, just_fix_wind... |
e51f4d4a8f6a7dcabd03d1c0effec9530fe12fd9a64214139125aca56e99ffe6 | Python | 6,741 | 169 | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from typing import Any, Dict, Optional
from models.model import Model
from models.kan_layers import KAN
class He3DCNN_KAN_Net(nn.Module):
"""
MULTI-SCALE 3D DEEP CONVOLUTIONAL NEURAL NETWORK FOR HYPERSPECTRAL
IMAGE CLASSIF... |
eeb889a0e57eb6c6b1ca4c748912607496b6c5615d1e8d2164c686a8f11567e2 | Python | 6,744 | 166 | """Slice-thumbnail filmstrip tests for the CCF Boundary Editor."""
import numpy as np
import pytest
@pytest.fixture
def qapp():
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QApplication([])
yield app
def _two_region_volumes(tmp_path, shape=(20, 20, 30)):
... |
0495e10c3abad04231defc0bbc0ae7f33be40f0074c6bcfcb01249ee934fd647 | Python | 6,746 | 197 | import pandas as pd
import numpy as np
import seaborn as sns
from scipy.optimize import curve_fit
from scipy.misc import derivative
import matplotlib.pyplot as plt
def normCenter(DBLmetricsDF,mixedIDs):
mixedIDs = list(set(DBLmetricsDF["FirstID"]).union(set(DBLmetricsDF["SecondID"])))
logVal = np.log(DBLm... |
63ad77c2b35a943b72a1e5fe257f04c41a607309b693bea6f2b0932afe3e0d6a | Python | 6,748 | 177 | import numpy as np
import scipy.signal.windows
from itertools import product
import matplotlib.pyplot as plt
import scipy.signal
# from numba import jit
# @jit(fastmath=True, nogil=True, nopython=True)
def conv(x: np.ndarray, filter: np.ndarray):
"""filter...
Args:
x ([type]): [description]
f... |
13b7941907d53149a7b1d8539b6ea5d58b74ae2fc5aa961e0ad823c1d99bc6b7 | Python | 6,749 | 205 | #!/usr/bin/env python
"""
Validates HED in a tabular file (TSV) against a specified schema version.
This script validates HED in a tabular file, optionally with a JSON sidecar,
against a specified HED schema version.
"""
import argparse
import os
import sys
from hed.errors import ErrorHandler
from hed.models import ... |
988ea1647ef955f29633c0f12e3e6bc6ee8bed94a12d68cddf2dfe39a42b8218 | Python | 6,749 | 161 | """ Task-Agent Interaction: Interaction between forgetting model and object-based memory task """
import numpy as np
import pandas as pd
from scipy.stats import beta
import matplotlib.pyplot as plt
import time
# Use interactive matplotlib backend and turn interactive mode on
# This is required for Ubuntu and plot upd... |
afa2a66d0d29581643bb1ce7887c0b48b0b6feaa3bc948da1bc36f8389278c88 | Python | 6,749 | 189 | from __future__ import absolute_import
import random
import torch.optim as optim
import mlflow
from tools import *
from models import create_net
def load_params_from_mlflow(run_id):
client = mlflow.tracking.MlflowClient()
run = client.get_run(run_id)
return run.data.params
def train_model(args, run_id=... |
128122f436761c05c348c467426a1756046c1508278ba7a20473df1df79e01ae | Python | 6,750 | 172 | import torch
from torch_geometric.nn import GCNConv,ChebConv
from util import dataloader
from torch.nn import Linear as Lin
from edge import EDGE
from opt import *
import torch.nn.functional as F
from torch import nn
import torch
from torch_geometric.nn import GCNConv
from torch_geometric.nn import GraphConv, TopKPoo... |
b6fbf7219902f87fced3bb3ec8961d32bd8d66128b969192415b171096d5ea80 | Python | 6,750 | 234 | """Computes the extraction efficiency of a cleaved stack using a 2D sim."""
import argparse
from typing import Tuple
import meep as mp
import matplotlib.pyplot as plt
import numpy as np
RESOLUTION_UM = 25
WAVELENGTH_UM = 1.0
CLADDING_UM = 0.5
ACTIVE_UM = 0.3
SUBSTRATE_UM = 1.0
PML_UM = 0.5
AIR_UM = 1.0
SIDE_UM = 3.... |
0e5636d7d9121eaec987c6b320be2d75c3ae5e9379ec4b2598f79a016517c868 | Python | 6,751 | 203 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Tong He and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import os
import time
import random
import argparse
import numpy as np
from pathlib import PurePath
import torch
import torch.utils.data
import torch.nn as ... |
7ce7077cafbd75893ce3d04181ea98fe0123ed27334efbb8986047470cbc7b88 | Python | 6,752 | 209 | import logging
import pandas as pd
from typing import Tuple, List, Optional
from gt4sd.frameworks.enzeptional import (
EnzymeOptimizer,
SequenceMutator,
SequenceScorer,
CrossoverGenerator,
HuggingFaceEmbedder,
HuggingFaceModelLoader,
HuggingFaceTokenizerLoader,
SelectionGenerator,
)
from... |
a7ab7c6f907e438de1f60ca6daab0525693f2204e6f59c249524e97ad3410935 | Python | 6,753 | 194 | """
FSL-compatible wrappers for Fabber tools
"""
from __future__ import absolute_import
import sys
import os
import six
import numpy as np
import nibabel as nib
from fsl.data.image import Image
from fsl.wrappers import LOAD, wrapperutils as wutils
import fsl.utils.assertions as asrt
from fabber import Fabber, Fabbe... |
929c024ea69e0e171827cfbe955404def557cd10a28a2f9ebd449ff946d66014 | Python | 6,754 | 213 | """Functions to customize workflow steps."""
from __future__ import annotations
from copy import deepcopy
from functools import partial
from typing import TYPE_CHECKING, Literal
from quacc.utils.dicts import recursive_dict_merge
if TYPE_CHECKING:
from typing import Any, Callable
def strip_decorator(func: Call... |
03371a4a5a17c1eedd85d80987bb449ace6821c9a5490de4c6a25503bbbb5b79 | Python | 6,755 | 170 | import os
import argparse
import numpy as np
import pandas as pd
import random
import sys
from tabulate import tabulate
import torch
from old_code.dataloaders.dataloader_item_classification import get_item_classification_dataloader
from src.inference.model_initialization import get_classifiers_checkpoints
from src.tr... |
81ae4a4cd1ce35cc9f0692791b58af89c7342c7da5f9b1488d585c6808de3919 | Python | 6,755 | 152 | import torch
from monai.metrics import compute_meandice, do_metric_reduction, compute_hausdorff_distance
from monai.networks.utils import one_hot
from torchmetrics import Metric
# inspired by the NVIDIA nnU-Net GitHub repository available at:
# https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmen... |
4ed72720eefe85dd2c39820867133a74ff5f190d8afc31a09e7d58c5c2ace60e | Python | 6,756 | 175 | import unittest
import igraph as ig
import louvain
import random
from ddt import ddt, data, unpack
import sys
PY3 = (sys.version > '3');
#%%
def name_object(obj, name):
obj.__name__ = name;
return obj;
graphs = [
###########################################################################
# Zachary karat... |
a5b4e27bd8a146c6a07ef7116d226f127fce4d93f01377d20915cc4b5089b2e6 | Python | 6,757 | 217 | # 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... |
6eda3e0272c4620eed5ff462e9079b92188692263340da9d7fa042939a59158b | Python | 6,758 | 242 | #!/usr/bin/env python
import os
import warnings
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask, roi_to_brain
from nilearn import plotting as nplot
from sklearn.metrics import pairwise_distances
warnings.filterwarnings("... |
e4f8e7635eba7df0d4f757764cdca1dde5ddc3b36c197b90ee9f81428c96526b | Python | 6,760 | 196 | import os
import csv
import numpy as np
import pandas
from typing import List
from typing import Union
import merlin
def _parse_barcode_from_string(inputString):
return np.array([int(x) for x in inputString if x != ' '])
class Codebook(object):
"""
A Codebook stores the association of barcodes to gene... |
2c35d33730958bea933807763e8ed886c6aaa4e8a6f567433bcb8c63929c8447 | Python | 6,761 | 173 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 1 04:38:02 2022
@author: haotian teng
"""
import torch
import itertools
import numpy as np
def log_domain_sparse_matmul(A:torch.sparse_coo_tensor, log_B:torch.Tensor, dim:int = -1):
"""
Do a sparse-dense tensor multiplication and reduced o... |
75f675d8ee3f5b67482441d9fd858da3b744a3b099453ddac1f547a596484278 | Python | 6,763 | 177 | # Node-group asset "Accumulate Axis Rotation" (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... |
2cfd9070135bb7c8f126bcae2ea125db079a1ef1b9162991dcd441656248ddc8 | Python | 6,764 | 172 | """Allows output of HedSchema objects as MEDIAWIKI format"""
import pandas as pd
from hed.schema.hed_schema_constants import HedSectionKey
from hed.schema.schema_io import df_constants, wiki_constants
from hed.schema.schema_io.schema2base import Schema2Base
class Schema2Wiki(Schema2Base):
"""Converts a HedSchem... |
97e6799d2be143bc6e108255a811ea6c087d6d159dc24718b5082e591f151226 | Python | 6,764 | 196 | import os
import csv
import numpy as np
import pandas
from typing import List
from typing import Union
import merlin
def _parse_barcode_from_string(inputString):
return np.array([int(x) for x in inputString if x is not ' '])
class Codebook(object):
"""
A Codebook stores the association of barcodes to ... |
cf9e38d0b563d6a0089570b14a2053c1b79ed0e79350a27079d6daed7682524a | Python | 6,764 | 191 | import bct
import numpy as np
from tqdm import tqdm
from sklearn.utils import check_random_state
def strength_preserving_rand_sa_flexE(A, rewiring_iter = 10,
nstage = 100, niter = 10000,
temp = 1000, frac = 0.5,
... |
067c57268d47571555587e8e919290ac0cba7353ac59a85b6609820884d1d31f | Python | 6,765 | 227 | #
# 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,... |
7b691db02b6f79c8fb3fa44ca0cff6b57b1fb21b095b64d4141029216950ead2 | Python | 6,765 | 182 | """Confirm reproducibility of the RSN inferences within and across modalities
"""
# Set up dependencies
import os
import itertools
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from utils.array_ops import reorder_matrix_by_indices
from utils.data import load_data, load_o... |
6bd65b4672937fefbe39365f0b6a01da3cbf0716b05bf60c7db5b2cb8ac7a0c8 | Python | 6,766 | 196 | """Initialize settings for plotting."""
from __future__ import annotations
import pathlib
import re
from enum import Enum
import cycler
import matplotlib as mpl
import mne
import numpy as np
import seaborn as sns
from matplotlib import figure
from matplotlib import pyplot as plt
PALETTE_WJN_2022 = np.array(
(
... |
bfefbaf5cfa97ead2fc5c8b95db25c02e1a831dc7a4aa2ea9134d36d483f3fa3 | Python | 6,766 | 161 | """The contents of a BIDS dataset."""
import logging
import os
from hed.tools.bids import bids_util
from hed.tools.bids.bids_file_group import BidsFileGroup
from hed.tools.util import io_util
# Sentinel value for default arguments (avoids mutable default bug)
_SENTINEL = object()
class BidsDataset:
"""A BIDS d... |
084a0eecb8c728305cb3c81c820ee49842cf2f156b0fd658b63f00cfcaa75023 | Python | 6,767 | 205 | # 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... |
295a1e6afd760e3a2d157a1862e00fde3ae80fac865b95258d58fa39ed40b529 | Python | 6,767 | 226 | import numpy as np
import pathlib
import subprocess
import datetime
import random
from collections import namedtuple
from . import parameters
def kl_div(mu1, mu2, sigma1, sigma2):
"""
Kullback-Leibler divergence between two univariate Gaussians.
"""
return np.log(sigma2) - np.log(sigma1) + (sigma1**2... |
4907d8a0f2a2e6f247d1ecd8e856c396bc3f7620095c4deb778b604ed6e61283 | Python | 6,769 | 172 | import datetime
import json
import sys
import os
import numpy as np
from PIL import Image
import SimpleITK as SITK
from src.registration.multichannel import MultiChannel
from src.segmentation.multichannel_segmentation import MultiChannelSegmentation
from src.utils import sitk_utils as sutils
Image.MAX_IMA... |
540670535715f884601dc4b96305660984aa7bc129d03a48c6ffb841d05fb604 | Python | 6,769 | 179 | from __future__ import print_function
from examples.discrete_belief.dist import UniformDist, DeltaDist, MixtureDist, MixtureDD
from examples.pybullet.utils.pybullet_tools.pr2_primitives import State
from examples.pybullet.utils.pybullet_tools.pr2_utils import set_arm_conf, get_carry_conf, open_arm, get_other_arm, \
... |
75c90d5da051735f02e53b7e2e0f1a594ab6fc3651eae5f39d660e469eab5b73 | Python | 6,769 | 216 | """Functions to customize workflow steps."""
from __future__ import annotations
from copy import deepcopy
from functools import partial
from typing import TYPE_CHECKING, Literal
from quacc.utils.dicts import recursive_dict_merge
if TYPE_CHECKING:
from collections.abc import Callable
from typing import Any
... |
98e1d0d7fecc1116e3273059c36e4d2e46fe018b06c5fe932c615a111060f195 | Python | 6,769 | 198 | import pytest
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
@pytest.fixture
def saved_files(relu_layer, inputs):
relu_layer.forward(inputs)
relu_layer.eval()
design = relu_layer.create_design("relu_0")
destination = InMemoryPath("relu_0", parent=None)
de... |
bf83aeeff80366e6bf549aa595a6188262561dfac4c1c44b2b423fdce6cf1f6f | Python | 6,770 | 229 | # 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... |
2495a3aa2626f3754c071e53cf691a1543bc35a91fdf3e1dde68475ff4bd160a | Python | 6,771 | 164 | import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Input, Conv1D, MaxPooling1D, Flatten, Dense, Dropout, BatchNormalization, ReLU, LayerNormalization
def standard(input_shape, output_shape):
inputs = Input(shape=(input_shape[1], input_shape[2]), name="input")
layer... |
3a078f7ce349d700a09e9b890b2f68b6fea7ec46c9d7275c3eeccb3e05353718 | Python | 6,771 | 137 | import numpy as np
from .misc import index_traverse, sort_translations_siesta
from .structure import Structure
class SuperCell(Structure):
def __init__(self, structure_uc, limits_abc, ordering='normal'):
'''
limits_abc array(3, 2): integers [[a_min, a_max], [b_min, b_max], [c_min, c_max]]
... |
1309df0c42a2bc316d4041a754b09f245d060f5c1a077c9506ef92ac3760217a | Python | 6,772 | 205 | from __future__ import division, print_function
import operator
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cross_validation import KFold
from sklearn.linear_model import Ridge
class RadialBasis1D(object):
""" Uses kernels to project elements of an array of scalars x int... |
2681f313f249aa8d3ba010a5ba7aea7f41e8866a6244a8261b195164fa104f0e | Python | 6,772 | 184 | # 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... |
7d824f3e2fa780eb1097105d128e6f5a286064874c9f3c93ed06a99269fca937 | Python | 6,773 | 172 | import json
import os
import hashlib
# Dictionary mapping the file extension to the datatype
data_dict = {
"nii.gz": "NifTI",
"nii": "NifTI",
"txt": "Text",
"vtp": "VTK surface model",
"mat": "MATLAB file",
"h5": "Hierarchical Data Format",
"mph": "Multiphysics simulation file",
"seg.nr... |
6b6048bb678334180db3b4cdcb3c2afe068e0254587369b00797e2acfe347bd5 | Python | 6,774 | 152 | import os
import re
from copy import copy
from typing import List, Tuple, Union, Dict
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
class KFoldGroupbyTrial:
r'''
A tool class for k-fold cross-validations, to divide the training set and t... |
922ed78fedc3d4da327acfd2887b4afe4d2c5e74ab40ab4624bce5435c285d5e | Python | 6,774 | 151 | try:
from Tkinter import Tk, Canvas, Toplevel
except ImportError:
from tkinter import Tk, Canvas, Toplevel
import colorsys
# NOTE - this will overwrite (but remember) existing drawings
# TODO - try PyGame, PyCairo, or Pyglet
MAX_ROWS = 5
MAX_COLS = 9
COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'v... |
c11a84b999274402e1f5f44260059822f0f490d325d28bef3177ebcbd0f9218f | Python | 6,774 | 176 | '''
Description:
Figure plotting for including/excluding the latent space update.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import numpy as np
import scipy.stats
import pickle as pkl
from plotting import *
from plotting.__init__ import _removeTopRightBorders, _removeAllBorders
# =======================... |
7caa22370d11cce1df6b9b2709afc9cbdeb202486fe496e5fc7de3d4e9c298d0 | Python | 6,775 | 241 | # -*- coding: utf-8 -*-
# ============================================================
#
# BWL FIR Filtering
# authors: David Castro Piñol, Francisco Perdigon Romero
# email: davidpinyol91@gmail.com, fperdigon88@gmail.com
# github id: Dacapi91, fperdigon
#
# =========================================================... |
7db07a23adda3c723e2f60341efad6988da98726c802f09317bc630d68b3d3d7 | Python | 6,776 | 194 | """JAX training loop for scGen, replacing the scvi-tools ``JaxTrainingPlan`` it used before 1.5.0."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import jax
import jax.numpy as jnp
import numpy as np
import optax
from flax.training import train_state
if TYPE_CHECKING:
from collectio... |
a39a2d2adef2fe699413d62dcd2478c8626bc2b5a5e8f59d14ad5367f0db07b0 | Python | 6,776 | 261 | # 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... |
3cd9467b3bf6f084538f2f8095c2d3b56cb4fa533d577380222e9a88c9e43708 | Python | 6,777 | 138 | import os
import torch
import logging
from torch.optim import lr_scheduler
from torchdrug.utils import comm
from torchdrug import core, utils, datasets, models, tasks
logger = logging.getLogger(__file__)
def build_ppi_solver(cfg, train_set, valid_set, test_set, use_solver=False):
task = core.Configu... |
95f043c713a1596ca28be3355d59277e91dbf3d907afe1a0a19cc9d93e1eb89f | Python | 6,777 | 233 | # 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... |
a7745b2fdef8ee1c060197c9631a42e86213c7e02e298ceaeca08ae11a392ebb | Python | 6,777 | 187 | #!/home/subinoy/Softwares/anaconda3/envs/tf/bin/python3
# OWNER : SUBINOY ADHIKARI
# EMAIL : subinoyadhikari@tifrh.res.in
import os, sys, stat
import gc
import pickle
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.optimizers import Adam
from dense_variational_autoencoder i... |
c5d6c2829dc111958b091472d9a50d8400b4399e25bcf42e394a0341b99a1d11 | Python | 6,779 | 140 | # Code to perform permutation testing to control for family-wise error (FWE)
# Using max-T approach as described in Nichols & Holmes (2002)
# Nichols TE, Holmes AP. (2002). Nonparametric permutation tests for functional neuroimaging: A primer with Examples. Hum. Brain Mapp., 15: 1-25. doi:10.1002/hbm.1058
import numpy... |
6869cdcfe5a1dcccc4a9e0dcec3c35aae52d07ba02f04a311c07d380f1022ead | Python | 6,780 | 128 | import os.path
from collections import defaultdict
import pandas as pd
from ckg.graphdb_builder import builder_utils
from ckg.graphdb_builder import mapping as mp
#########################
# Pfam #
#########################
def parser(databases_directory, import_directory, download=True, updated_on=... |
1997cb94c4dc7456b031f7964ab845799e6ff334ec704a0980e318d1a3447676 | Python | 6,782 | 161 | # Copyright (c) 2020, 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... |
2c55279eb2ef15419f48ea472a76cf37c9d11f1fc482de3caf9e48356fcaa801 | Python | 6,782 | 187 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..initializer import create_initializer
class BasicBlock(nn.Module):
def __init__(self, in_channels, out_channels, drop_rate):
super().__init__()
self.drop_rate = drop_rate
self.bn = nn.BatchNorm2d(in_channels)
... |
6c27c2004a0e06e5ad2a70a7af7eeea8124be19bd385f4b721ebe81d240c75c2 | Python | 6,784 | 204 | ################################################################################
# Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md
#
# All rights reserved.... |
a115a6bfa6fc6b6d41dc8e57d8585b9aeefdc368572b1b52653ce6367832cebf | Python | 6,784 | 149 | import sys
from typing import TYPE_CHECKING, List, Dict
from distutils.command.build import build as _build
from ..warnings import SetuptoolsDeprecationWarning
if sys.version_info >= (3, 8):
from typing import Protocol
elif TYPE_CHECKING:
from typing_extensions import Protocol
else:
from abc import ABC as... |
c31bf71a6dc49292310f8932381c191c98b3a1f25a271b4f76dc5e1be4f7b446 | Python | 6,784 | 157 | import argparse
import logging
import os
import random
import sys
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
from torch.utils.data import DataLoader
from tqdm import tqdm
import time
import cv2
from torchvision import transforms
from PIL import Image
from modules import ... |
0ce4065df38095bde8c1d22992ce39b69b304eb236180e67dce7bb64c1de6592 | Python | 6,785 | 132 | """
ID_JOIN_MAT571_TO_V783.py - the join that was the project's #1 technical risk.
The synister feather is keyed by mat571 segment id. Every cell type, every published
annotation and every model's edge table is keyed by FlyWire v783 root id. There was
no map between them and no login that would produce one.
There d... |
051beb6fe62316e94125e63702a8647d47ad09cee549fac6c3dd6a30bfc18e76 | Python | 6,786 | 160 | ##
# \file case_study_fetal_brain_test.py
# \brief Unit tests based on fetal brain case study
#
# \author Michael Ebner (michael.ebner@kcl.ac.uk)
# \date July 2019
import re
import os
import unittest
import numpy as np
import SimpleITK as sitk
import pysitk.python_helper as ph
import pysitk.simple_itk_helper as ... |
49e6337ed9597ade01d43a6bf72cce6ea0c6386fe574fcb1697849488a41bce5 | Python | 6,786 | 156 | import pylab as pl
import numpy as np
import time
from .utils import get_parameters, srm0_filter, assure_list
class Display(object):
def __init__(self, state_dict, model_specs):
self.plot_rule = ["Z"] if not "plot_rule" in model_specs else model_specs["plot_rule"]
self.num_input_channels, self.pl... |
9a10ac2e37908170f9ef4ca2b7fe5e32767103a6593309e92337152e9449b6af | Python | 6,786 | 184 | from __future__ import annotations
from typing import (
Any,
Dict,
Iterable,
List,
Optional,
)
import pandas as pd
from ..core.models import (
DatasetIndex,
)
from ..morphometrics.builtin import (
add_global_centroids,
)
# ===============================================================... |
a43687bb7188c07b7c0ebbe77efd03f01551ecd56a9257ec760fb57dc9111d26 | Python | 6,786 | 121 | from pandas import read_csv, DataFrame, concat
from numpy import arange
from nilearn.glm.first_level import make_first_level_design_matrix
from glob import glob
import os
def pull_regressors(confound_path: str, regressor_type: str = 'opt1') -> DataFrame:
"""
This function is compatible with the *confounds_tim... |
b2fea88af997ba1b08fb8b563d3c11c08c3abe32f6cf7b49af8543c0cddf2329 | Python | 6,786 | 202 | '''ShuffleNetV2 in PyTorch.
See the paper "ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from collections import OrderedDict
from torch.nn import init
import math
... |
e9daa2be4166e82835458bbef6a0a1b43366db8061b08067d8cc711ce0ab5671 | Python | 6,786 | 216 | # 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... |
81e60e63892afafcb1aba31760bb813a0abfa09832bdc29160768e71098bbb4e | Python | 6,787 | 181 | import numpy as np
from scipy.integrate import solve_ivp
from sklearn.preprocessing import (MinMaxScaler, StandardScaler,
FunctionTransformer)
# helper function for log-transformation
log_transformer = FunctionTransformer(np.log10,
inverse_func=l... |
93c64cd24022af1e07f80078dec6c3191b28bbf5d4941b4103b9e50c5cdf7352 | Python | 6,787 | 175 | # Node-group asset "Points of Edge" (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_CHECKIN... |
a836fb6e2a8837661fdcc6f4eff4d1e6c829ba4c12e5b16b7bd9bf859401b261 | Python | 6,788 | 129 | """
OFFSET COMPENSATION COMPONENT
This file contains the variables and functions necessary for offset compensation.
"""
import numpy as np
def init_offset_compensation(self):
if self.USE_OFFSET_COMP:
self.diff_avg_1 = list()
# self.diff_avg_2 = list()
self.values_mean = list()
se... |
6ef371dbafd98514164be94c5559a7655ceb245d6305e225d0ac4bc794ede5f0 | Python | 6,790 | 173 | from collections import Counter
import numpy as np
import pandas as pd # for dataframe and CSV handling
import argparse
from sklearn.model_selection import KFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.inspection import permutation_importance
from sklearn.metrics import matthews_corrcoef, roc_... |
626785681846b75086d0268c432c683a332bdcce3559c527131d36634cc3669a | Python | 6,791 | 204 | import os
import pickle
import matplotlib.pyplot as plt
import numpy as np
from uptake import make_data_folder
class Files:
"""
A class define the .pkl files to import.
Attributes:
----------
beginning: string
beginning of the pkl file to be extracted
... |
6bac942ff877e55d101d1798b5c6feed66f9dc885b55a9ab4cfde287e61c7550 | Python | 6,791 | 187 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..initializer import create_initializer
class BasicBlock(nn.Module):
def __init__(self, in_channels, out_channels, drop_rate):
super().__init__()
self.drop_rate = drop_rate
self.bn = nn.BatchNorm2d(in_channels)
... |
ac97b14eabba16ffd643e84016199406b5e11fc770c47ca2cdd4fd40431368ec | Python | 6,792 | 179 | import numpy as np
import pandas as pd
import pytest
from pertpy.tools._milo_glmm import between_within_df, fit_nb_glmm, fit_nb_glmm_nhoods, has_separation
from pertpy.tools._mixed_models import parse_random_effects, random_effect_matrices
@pytest.mark.parametrize(
"design,expected",
[
("~ condition ... |
06d035dc1ca0497d6363087a72f4abdd9c0dc4b2ba54e452ff6130d06db4f4cd | Python | 6,794 | 137 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import os
from pathlib import Path
def return_train_... |
16da4d7663aa1c9f979bb0566f5b6c83a4ea3025a61059fc6a6ba1e4a410d16d | Python | 6,794 | 199 | #
# 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,... |
f12fb03bae3caf876967b568f356b7eb941af7e49ddd5df7312f6f6ffcce0988 | Python | 6,794 | 197 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Tong He and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import os
import time
import random
import argparse
import numpy as np
from pathlib import PurePath
from keras import backend as K
from keras.optimizers imp... |
b1f99a7e1d5ee8c676e6666a32587c0f038e76b8860cd188e7e59d42b1326b9f | Python | 6,798 | 165 | import matplotlib.pyplot as plt
import numpy as np
import os
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation as animation
from matplotlib import cm
import ray
from neuron_model_parallel import NeuronSim
from helper import fibonacci_sphere, plot_electrode_and_neuron
LOAD_PATH = os.path.join(os.getcw... |
2d5c2afa1d43a904ad0475df2c3481a073ca44035796b2c72f7120cfd7ceb9d2 | Python | 6,799 | 139 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
from pathlib import Path
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core... |
8d3f66ee3c657f185b4062034286eb4dcd972309f2eb1f81878bfca2f6fa4c48 | Python | 6,800 | 156 | import json
import os
import numpy as np
import xml.etree.ElementTree as ET
from .constants import bohr2ang, hartree2ev
from .utils import atom_name2number, atom_number2name
from .bgwio import bgw_vsc, bgw_filetype
class Structure:
'''
Attributes:
---------
rprim(3, 3): R_ij is the jth cartesian compo... |
eb0b186baf121da6d64464c03e9777e30962106144ba287d8e99f1d271687be6 | Python | 6,800 | 156 | import numpy as np
import torch
from torch.nn import Linear as Lin, Sequential as Seq
import torch_geometric as tg
import torch.nn.functional as F
from torch import nn
from PAE import PAE
from model.layers import general_GCN_layer, snowball_layer,truncated_krylov_layer
class graph_convolutional_network(nn.Mod... |
48cc953d9d464a05bcffd6a2e586305f55bb7be1d314faec09de6eb1c2143889 | Python | 6,801 | 163 | # regtools/tests/test_batch_2d_controller.py
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import pytest
from unittest.mock import MagicMock
pytest.importorskip("PySide6")
from PySide6.QtWidgets import QApplication
from regtools.registration.gui.batch_2d_tab import Batch2DTab, _COL_STATUS
... |
4a42bcf8130bc3238465f4476bccf21d57ee4d431614ec902162b01fa302926d | Python | 6,801 | 201 | """Perform and save time frequency analysis of given files."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Annotated, Literal
import mne
import mne_bids
import numpy as np
import pandas as pd
import pte
from matplotlib import pyplot as plt
from pytask import Product
imp... |
f0af4f8c1c36a3257a3ad4727466ef075c966f596ab59409f23b45e59b8a74e3 | Python | 6,801 | 228 | # coding: utf-8
__author__ = 'ZFTurbo: https://kaggle.com/zfturbo'
if __name__ == '__main__':
import sys
import os
# For this test, make sure that only the tested framework is available
sys.modules['jax'] = None
sys.modules['torch'] = None
gpu_use = 0
print(f"GPU use: {gpu_use}")
os.... |
7be81722b668030c12463036a2924a6950accec25b8d8532697fcf35a5a2386a | Python | 6,803 | 183 | #
# 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,... |
3ca7a6f064485b78a191627d19a7e8d0cb6775c045bcbc62dda96bb4d3edd42a | Python | 6,804 | 162 | import os
import warnings
from pandas import concat, DataFrame
import numpy as np
from nilearn import image
from itertools import combinations
from nilearn.maskers import NiftiMasker
from scipy.stats import spearmanr
from pyrelimri.tetrachoric_correlation import tetrachoric_corr as tet_corr
def image_similarity(imgfi... |
a4f3d0c9a8b883b1013be7b8c4bec8dbcb1f42501b6550c60146c2898fbf895d | Python | 6,805 | 73 | """FIG_CENSUS.py 2026-10-02. Report figure F15 (the census of signs and the two v2LN30):
(a) every scored neuron ranked by the channels its single wrong sign costs (first-order theory; full rate theory for the 20
checked), (b) doubt against damage, (c) the wiring witness: the v2LN30 against the rest of their lineage,... |
2c3e418ac11d4fdbe0cd2eeb2d852e934d73d25e28323d90ed2b00c55bbea449 | Python | 6,806 | 187 | """Validation of dependencies of packages
"""
import logging
from typing import Callable, Dict, List, NamedTuple, Optional, Set, Tuple
from pip._vendor.packaging.requirements import Requirement
from pip._vendor.packaging.specifiers import LegacySpecifier
from pip._vendor.packaging.utils import NormalizedName, canonic... |
45558b69546d8e1206096e299534ce72e62cabe0e6582705c4fafb57d431fe75 | Python | 6,806 | 201 | from cloudvolume import CloudVolume, Storage
from shapely.geometry import Polygon, box
from shapely.geometry.collection import GeometryCollection
import numpy as np
from io import BytesIO
from PIL import Image, ImageDraw
import json
import sys
# Hack for persistent CloudVolume objects... clean up with a cache or somet... |
787c5b707a432e5193b8a1c22af6b78b0a74b4fa6352bbf060d09e22927c1191 | Python | 6,806 | 159 | import sys
import os
import os.path as op
import numpy as np
from scipy import stats
from sklearn.model_selection import KFold
from sklearn.svm import SVC
from sklearn.decomposition import PCA
import mne
from params import BIDS_ROOT as bids_root
from params import SUBJECTS as subjects
from params import ALPHA as alp... |
816d01bf21ee761312b2ab08351d54bb1582eaa3c2cff2e18bb5db4945a0327b | Python | 6,806 | 165 | import argparse
import os
import torch
torch.set_default_tensor_type(torch.cuda.FloatTensor)
from train import retrieve_clusters
from utils import load_snp, null_dist_score1
from scipy import stats
import pyhocon
from collections import defaultdict
import multiprocessing
from scipy.stats import norm
import numpy as np
... |
dcebca4b1dba24658e43e9c20acd491954a8b48575019a95c42687043d0bfb8c | Python | 6,806 | 168 | from collections.abc import Sequence
import torch
from torch import nn
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.GCN")
class GraphConvolutionalNetwork(nn.Module, core.Configurable):
"""
Graph Convolutional Network proposed in `Semi-Supervised Classificat... |
310b22b0af7ac2344f0d3a160f8c3ebbef45d7a9b9b5cd072babfdbfe62b7617 | Python | 6,808 | 174 | """
INITIALIZATION PARAMETERS
These variables contain the hyperparameters for AnDePeD operation.
"""
import numpy as np
import pandas as pd
import multiprocessing
class ReRe:
# class variables for multiprocessing
class_lock = multiprocessing.Lock()
progress_for_executions = {}
executions_max = {}
... |
7a262317ccfcf48940e60cccb8a9c6d95d8b694280fafc39b256c17c244c6852 | Python | 6,810 | 176 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
b19b7d360ed05e5a6fef5cb08cd0b0cceb2b5d885906cc111a5bc0ce8a27ece7 | Python | 6,810 | 188 | #! /usr/bin/env python
# Time-stamp: <2021-03-23 22:02:10 christophe@pallier.org>
# License: Creative Commons Attribution-ShareAlike CC BY-SA
""" Implementation of Posner's endogeneous attention cueing task (see https://en.wikipedia.org/wiki/Posner_cueing_task)
Note: This experiment is meant to be run on FullHD (1920... |
35d08c0b0036ae4a555f5d4e747336727f4d2f0585102d6bc8c9db7a1505cd9a | Python | 6,812 | 229 | import cocotb
import pytest
from cocotb.clock import Clock
from cocotb.triggers import ClockCycles, FallingEdge, ReadOnly, RisingEdge
from cocotb.types import LogicArray
from cocotb.utils import get_sim_time
import elasticai.creator_plugins.multipliers as multipliers
from elasticai.creator.arithmetic import int_conver... |
4fa36b8be826535082a6e603a205b3c81cbc91f84336cc5b983b448d8dbf8c80 | Python | 6,812 | 174 | from typing import Tuple
import torch
import torch.nn as nn
class BGenerator(nn.Module):
r'''
TorchEEG provides an EEG feature generator based on CNN architecture and GAN for generating EEG grid representations of different frequency bands based on a given class label.
.. code-block:: python
im... |
58230a5895e0a3928aa45de07f1f9b2fbac7d78bac24831e25b282ab1eb2b881 | Python | 6,812 | 124 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.