sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1b9569a4c77abd7c4a9ce609a2e897909253c6d8a18424fb9fd4c2df5ea65f81 | Python | 20,127 | 478 | from wsilearn.dl.models.model_blocks import ResBlock
from wsilearn.dl.models.model_utils import *
from wsilearn.dl.pl.pl_modules import ModuleBase
from wsilearn.dl.pool_utils import nms_set
from wsilearn.dl.torch_utils import print_model_summary
class AttGated2d(nn.Module):
def __init__(self, in_dim=1024, hidden_d... |
d23909a39fce27298906704ddea619be5fde9d77277ba5e45ab5a24e85467547 | Python | 20,127 | 579 | import json
import logging
import multiprocessing as mp
import shutil
import signal
import time
import uuid
from functools import reduce
from threading import Thread
from pathlib import Path
import numpy as np
from pupil_recording_interface._version import __version__
from pupil_recording_interface.decorators import ... |
4d429edf76e11bf137f4993c051a30e13a0929c8dd7b485e6e634011bbf5b3dc | Python | 20,128 | 490 | import copy
import logging
from itertools import chain
from typing import Any, List, Tuple
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchmetrics
from torch.utils.data import DataLoader
_log = logging.getLogger('torcheeg')
class BYOLTrainer(pl.Lightning... |
84f3846d50391f7963c6cb4f3f21bc35656cbe6f36f2cd2e5d09587ba95686b6 | Python | 20,130 | 574 | import jpype as jp
import numpy as np
from pyspi import utils
from oct2py import octave, Struct
import copy
import os
import logging
from pyspi.base import Undirected, Directed, Unsigned, parse_univariate, parse_bivariate
"""
Contains relevant dependence statistics from the information theory community.
"""
if not jp... |
e3868f61580d9afe6b78bfd24f57f0e246953f7d8a67fdd29acd90b4cb8fcad2 | Python | 20,131 | 506 | """SMART module interfacing with PETSc SNES solver"""
import logging
from typing import Dict, List, Optional
import dolfin as d
import petsc4py.PETSc as p
from .common import Stopwatch
from .model_assembly import Compartment
logger = logging.getLogger(__name__)
__all__ = ["smartSNESProblem"]
_stopwatch_keys = [
... |
4a4844615c82fc75070ba297ee7e0cffa728c9132d101dfc40cc8e608017e989 | Python | 20,155 | 566 | """
Utilities for determining application-specific dirs. See <https://github.com/platformdirs/platformdirs> for details and
usage.
"""
from __future__ import annotations
import os
import sys
from typing import TYPE_CHECKING
from .api import PlatformDirsABC
from .version import __version__
from .version import __versi... |
cd6b48ae11092a8375b9d10ffb5c1327da4cf979c100ddcd2b953164ce7cbe8e | Python | 20,162 | 633 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.metrics im... |
972cdafb6e3a677dec7c2dedcdd35a27f61f57f8fa6d937715c4f8929ef70d25 | Python | 20,168 | 327 | """BLIND.py 2026-10-09. Pre-registration: 04-NOTES/PREREG-2026-10-09a-BLIND.md
Can a fly's physiology rebuild its chemistry? Twin B (TWIN.py, no depression) without electrical synapses (their placement
uses laboratory labels). The signs of the antennal lobe's 30 largest local-neuron types are erased and rebuilt from Se... |
28f41ae6fa50532fe3c2c76ba9ac10c9ccd6c96edbf17d6539b99888934d1d69 | Python | 20,171 | 620 | import time
import pickle
import pandas as pd
import os
class Pipeline:
# take position and return module
def __init__(self):
self.modulelist = []
def add(self, module):
# print(type(module))
# print(isinstance(module, Pipeline))
if isinstance(module, ModuleParent): # TOD... |
783a65c536513dc688507245db368f9839750fb6618196fa028c3abdf86416ef | Python | 20,180 | 470 | # Node-group asset "Illustrate" (CompositorNodeTree), 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,... |
f1b1ac1a38be5e96982b65fdb155d31d893600b0d759ab19c1cd78ba57cdd018 | Python | 20,190 | 557 | #!/usr/bin/env python
'''derived parameters for hybridLFPy forward-model predictions'''
import os
import json
import numpy as np
from parameters import ParameterSet
def flattenlist(lst):
return sum(sum(lst, []), [])
def get_L_yXL(fname, y, x_in_X, L):
'''
compute the layer specificity, defined as:
:... |
73bd3096340b583c10fe753e909aefef25567ebf54366d4667465df4f6db9bf4 | Python | 20,192 | 565 | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
from pinn.layers import (
CellListNL,
CutoffFunc,
PolynomialBasis,
GaussianBasis,
AtomicOnehot,
ANNOutput,
)
from pinn.networks.pinet import FFLayer, PILayer, IPLayer, ResUpdate
class PIXLayer(tf.keras.layers.Layer):
r"""`... |
4276f0af50359f24f7d7ed954717d7c88aa704f54f8af47303eba94997ceda92 | Python | 20,210 | 563 | import numpy as np
import os, sys
import time, datetime
from .constants import hartree2ev
from .utils.mpi import is_master, MPI, comm, mpi_watch, distrib_grps
from .utils.misc import simple_timer, mytqdm
from .io.deephio import load_mat_deeph
import sys
use_slepc4py = True
try:
import slepc4py
slepc4py.init(s... |
f67d9a4145b7ad1d3d714c7519a479597355ed496468ad007b84514dc1eebce3 | Python | 20,215 | 570 | """Wide widget giving an overview of the recordings with markers and
annotations (bookmarks, events, and sleep scores)
"""
from datetime import timedelta
from logging import getLogger
from math import ceil, floor
from PyQt5.QtCore import Qt
from PyQt5.QtGui import (QBrush,
QColor,
... |
26d9c4e8d193157579ef309dcac1064888f9f3996d8fba42f010e01b612b7c12 | Python | 20,216 | 542 | # 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... |
62a99d91cfb14c6af94a999516230478f2fa2f7ca346594acd53b15fbcd474fa | Python | 20,230 | 483 | import os
import shutil
import tempfile
import argparse
import datetime
import json
import time
import nibabel as nib
import torch
import numpy as np
import torch.nn.functional as F
from monai import transforms
from monai.data import DataLoader
from monai.utils import first, set_determinism
from monai.metrics import... |
698870966bdd847c5af8aef77712a89f84d19c5707243cc5164f9531bb413516 | Python | 20,234 | 611 | # 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... |
6034ff16b5eb2ce348b1a0c613841f2dbcaecbd87802cf7a249793892e4355a1 | Python | 20,243 | 390 | # -*- coding: utf-8 -*-
"""
Created on Fri May 13 11:53:14 2022
@author: Dalton
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from pathlib import Path
import dill
import re
import seaborn as sns
from scipy import sparse, signal
from scipy... |
e235b9c34426f3ada70ae63ec636a5af250f4e59c9e04df4295150e2a7cb7c8c | Python | 20,245 | 616 | # 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... |
060d8f0fb4149499d8ea7a603e7ae0c587d43befaabda3143b95403cef817b9e | Python | 20,256 | 612 | """Module contains frequently used functions dealing with channel lists."""
# Authors: The PyPREP developers
# SPDX-License-Identifier: MIT
import math
from cmath import sqrt
import numpy as np
import scipy.interpolate
from mne.surface import _normalize_vectors
from numpy.polynomial.legendre import legval
from psuti... |
2098067ac32ca2d7baaada5d73604ff3341946c2b9e2836cf50d47aa4a158e2f | Python | 20,273 | 525 | # -*- coding: utf-8 -*-
"""This module contains a function for simplifying tasks in
finite-domain representation (SASTask). Usage:
simplify.filter_unreachable_propositions(sas_task)
simplifies `sas_task` in-place. If simplification detects that the
task is unsolvable, the function raises `simplify.Impossible`. I... |
36af39877863b330f206932c357e9609d8f6f9dceb8f44d386cf119d41aad298 | Python | 20,274 | 398 | """Trusted local Python experiment scripts run against the live Observatory engine.
A plugin is an ordinary ``.py`` file defining ``run(api)``. It is executed in the engine
worker thread with the user's full operating-system permissions: there is no sandbox. The
``ExperimentAPI`` is a thin wrapper over the same engine... |
9c8927ff5cab9a45e8413f1c63c989919fd367d82055bf78da9d26eb3ed4b114 | Python | 20,279 | 657 | import glob
import matplotlib.pyplot as plt
import numpy as np
import pydicom
import scipy
from numpy.fft import fft, fftfreq
from scipy import ndimage
from scipy.optimize import curve_fit
from scipy import stats
from sklearn.linear_model import LinearRegression
import Lookup_Data
def gauss(x, *p):
a1, a2, a3, a... |
b9f699bdab9a307c3f794f2d7982657c479a4857e12a58adb65abf1d90386821 | Python | 20,279 | 495 | # 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... |
abdb6c914f45c6b13fc3875277e33a8bb956573a6786352d9483cf39ef594ccc | Python | 20,288 | 592 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 28 16:51:21 2018
@author: Nagano Masatoshi
"""
# python setup.py build_ext --inplace
# case in Python 2.6~
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import matplotlib.pyplot as plt
import GaussianProcessMu... |
b249f0a69e78204c5efc3a0bd696dab9c45299e19b16a3d07389f9420521d515 | Python | 20,292 | 466 | # trace generated using paraview version 5.5.1
#### import the simple module from the paraview
from paraview.simple import *
from matplotlib import pyplot as plt
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'EnSight Reader'
heart_remeshed_3D_MAPSensicas... |
f7693db5dff2e0f1224c88cdb9f0946b5373301dc9df0d0b11dca89188179d6f | Python | 20,300 | 572 | from __future__ import absolute_import
import datetime
import logging
import os
import re
import socket
import warnings
from socket import error as SocketError
from socket import timeout as SocketTimeout
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .pack... |
ab5c4463d7a712999578f3e60bb048dcdc08f8e954952d302429ccd9089ae3ed | Python | 20,301 | 649 | # 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... |
fd0fd51a16a54e844c9c708c44b5e457c2a9390fc1c8044c398f361b1dbbf5ed | Python | 20,302 | 607 | # 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... |
c430bd388330a1f424abcc1eaecfc58181a10633557b86cb14400481ddc9f855 | Python | 20,306 | 442 | """
Generates a ListTomoParticle object from a input STAR file (translocon project version)
Input: - STAR file for pairing STAR files with particles and particles shapes
Output: - A ListTomoPaticles pickled object for every STAR file row
"""
################# Package import
import os
import vtk
impor... |
290fccb1abbaf070eac9d198838bb44de96574f781e278acaf6f7f2c47180fe7 | Python | 20,312 | 518 | # -*- coding: utf-8 -*-
import tensorflow as tf
from tfsnippet.bayes import BayesianNet
from tfsnippet.distributions import Distribution
from tfsnippet.stochastic import StochasticTensor, validate_n_samples_arg
from tfsnippet.utils import (instance_reuse, is_tensor_object,
reopen_variable_s... |
fe6ce18aed08294aa1a1e3f74efa5d2b1a08a97b606194c63ddba215c747e567 | Python | 20,317 | 391 | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team, The Hugging Face Team.
#
# 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... |
a04e9d0f89c2d0cc3c90f2ee0677c9d0dd468cc8014cb27d704f63cbddc5e437 | Python | 20,324 | 404 | from PoseBaseGeneral import PoseBaseGeneral
import tensorflow
vv = [int(v) for v in tensorflow.__version__.split('.')]
if (vv[0]==1 and vv[1]>12) or vv[0]==2:
tf = tensorflow.compat.v1
else:
tf = tensorflow
import time
import datetime
import os
#from tensorflow.contrib.layers import batch_norm
import logging
... |
c34510b9b199fd8e2926ae51bbacef867e3f1f5ea1c72070eb0b11974e3ac871 | Python | 20,328 | 400 | import os
from multiprocessing import Manager
from typing import Any, Callable, Dict, List, Tuple, Union
import mne
import numpy as np
from joblib import Parallel, delayed
from tqdm import tqdm
from torcheeg.io import EEGSignalIO, MetaInfoIO
from .base_dataset import BaseDataset
MAX_QUEUE_SIZE = 1024
class MockLo... |
81bfc52ff93431d2384562c657cb0578dee8677fb9663babeec1239155b2cbc0 | Python | 20,330 | 508 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Dict, Optional, Tuple
import torch
import torch.nn.functional as F
from torch import Tensor, nn
from torch.nn ... |
4cd0414420205b4f18cc36bd479e104e39fe1f43854c04350da2fd0839557382 | Python | 20,340 | 419 | # +
import torch
import numpy as np
from torch import nn, einsum
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from .weight_init import keras_init
def pair(t):
return t if isinstance(t, tuple) else (t, t)
class FeedForward(nn.Module):
def __init__(self, dim, hidden_dim, dropou... |
1d134782bddeb9de7715dfb7d90a885be5de61f6767b5b6214cdab776b3d64d8 | Python | 20,342 | 616 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed May 22 09:45:33 2019
@author: adele
"""
import logging
import collections
import sys
if sys.version_info[0] < 3:
pythonv = 2
else:
pythonv = 3
import matplotlib.pyplot as plt
from matplotlib import gridspec
import seaborn as sns
import numpy as... |
73c818bf163e93ec70d14826d80c69a01527d6c03b8312e27b3b6d8f2f5bd406 | Python | 20,383 | 366 | """
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 pandas as pd
import numpy as np
from pathlib im... |
3ee6a440b28bf0f7397c4197547e862607759e6f588491d6a1f587fa92586841 | Python | 20,429 | 496 | import os, csv, numpy as np
from regtools.registration.report_analysis_figures import (
render_worst_region_crops,
render_folding_crops,
render_cell_density,
render_cell_density_from_dir,
render_warp_quiver,
render_checkerboard,
)
def _vols():
fixed = np.random.default_rng(0).r... |
77a4a54f29f4ef0d6fd9b8bba5c24e15541f85ba5164217d7f0542a1900e6e0f | Python | 20,431 | 559 | '''
Author: Jose Mojica Perez
Usage: python autoscore.py <DATA PATH>
autoscore.py takes in a directory with Fish8.1a and Choose32.1
files and outputs summaries of the data in CSV format.
Copyright (C) 2023 Jose Mojica Perez
This program is free software: you can redistribute it and/or modify
it under the terms o... |
7d5d7257a3e80e058613f6efa7b51584fb729893ba10405992da306a2842896a | Python | 20,462 | 489 | """
Performs Bivariate 1st order analysis to a SetListTomograms object by tomograms with ListTomograms as reference
Input: - A STAR file with a ListTomoParticles pickle (SetListTomograms object input) used as reference
- A STAR file with a set of ListTomoParticles pickles (SetListTomograms object... |
bc230292a63cbaf45d2ff09e0f60ef6394afe659f4cc7e3431c1eb0578348333 | Python | 20,467 | 502 | """ Logic for full registration pipeline
Execute using the 'bifrost' executable installed by setuptools
"""
import logging
import os
import shutil
import sys
from pathlib import Path
import ants
import h5py
import numpy as np
import tensorflow as tf
import voxelmorph as vxm
from skimage.exposure import equalize_adap... |
686e19202f3bcee11e5d93733bf40a03d1ee329dd7620f8bac12f653982a53d7 | Python | 20,473 | 512 | # 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... |
058650e3e72bf1cf9b7b56f263bea35d64839f6f1fea896fa7f4ee9e0c36e330 | Python | 20,474 | 549 | """
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free software: yo... |
b0ec6235928a33795c8a9ecbc4f8c630e44544f83b9a0fbeaffcc5c8920d53b1 | Python | 20,476 | 470 | # 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... |
8a3376570f03ff43604ef602d9178a9747b910a1e30baf8faebf31b4ad7f856f | Python | 20,484 | 472 | import matplotlib.pyplot as plt
import torch
import numpy as np
import scipy.stats
import pickle as pkl
from sklearn.metrics import silhouette_score
from sklearn.decomposition import PCA
import os
import sys
sys.path.append("../../")
from plotting import *
from plotting.visualization import umapWithPCA, umapWithoutPCA
... |
bd8a6e7fed595d3bd6d12b542af10a4c4649cf6137bd6cf6ceb45d792107192c | Python | 20,484 | 496 | #
# 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,... |
10b62421ca4f5dbf2443fcb0abbb2137d3a7c69d1c445ac8333c44cee8340e68 | Python | 20,490 | 480 | from ..util.HMM import message_passing_multi, message_passing_posterior_state, message_passing_incremental
from ..util.ParamStorage import ParamStorage
from ..classes import data_handle
import multiprocessing
import numpy as np
import logging
import copy
import ray as ray
import os
class BayesianHsmmExperimentMultiP... |
de4bc02fa28296af06168d8a16198ecec9112920d023eb9bae57d9f00404108d | Python | 20,493 | 608 | # Copyright 2016-2018 Julien Danjou
# Copyright 2017 Elisey Zanko
# Copyright 2016 Étienne Bersac
# Copyright 2016 Joshua Harlow
# Copyright 2013-2014 Ray Holder
#
# 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... |
b82f382b85c450417e10f7634208209b560e15132b341f8dd46f0d8c068cb483 | Python | 20,503 | 513 | # Copyright (C) 2019 Computational Science Lab, UPF <http://www.compscience.org/>
# Copying and distribution is allowed under AGPLv3 license
#
# This script implements a Wasserstein GAN (WGAN) with Gradient Penalty (WGAN-GP)
# for generating 3D voxel data using a Generator and Discriminator model.
# It includes functi... |
1bcaec2d94aaeb883956622afa507b51c209d608c0c48409993178444665790d | Python | 20,511 | 547 | import collections
import itertools
import operator
from .providers import AbstractResolver
from .structs import DirectedGraph, IteratorMapping, build_iter_view
RequirementInformation = collections.namedtuple(
"RequirementInformation", ["requirement", "parent"]
)
class ResolverException(Exception):
"""A bas... |
3fcaedb49c96e52efe96118656716a5c8add2c7d6f606b5f67b3d02a5e748c1a | Python | 20,515 | 541 | # 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... |
09c00639014d9cab26f8ff1678c5343f3b16b12b24f7d1b5f8953228244272cd | Python | 20,537 | 534 | #!/usr/bin/env python3
from __future__ import print_function
import os
import pickle
import sys
import copy
import torch
from numpy import random
import gc
cwd = os.getcwd()
pwd = os.path.abspath(os.path.join(os.getcwd(), ".."))
sys.path.extend([pwd,'../pddlstream','../ss-pybullet'])
# sys.path.extend([
# os.pat... |
cc477482957766678e545db62ffc61cb4d6a1e901a131f2a6fb4b960437e3f25 | Python | 20,539 | 540 | from os.path import exists
from os import mkdir
import sys
from basicutility import ReadInput as ri
from tqdm import tqdm
import torch
import numpy as np
from torch.utils.data import DataLoader, Dataset, DistributedSampler
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.utils.tensorboar... |
4c2f8e716d8a5385ba475854e2a3e0417bd51f9e1a7400a9673eac5aaf91f4d0 | Python | 20,541 | 561 | """Network Authentication Helpers
Contains interface (MultiDomainBasicAuth) and associated glue code for
providing credentials in the context of network requests.
"""
import logging
import os
import shutil
import subprocess
import sysconfig
import typing
import urllib.parse
from abc import ABC, abstractmethod
from fun... |
66e4a5515e2276a5490f8b0626cc9a1dd70740219fe7b0c29820e19c7ef5cfe7 | Python | 20,544 | 531 | #解决二分类任务
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import os
import sys
import random
import itertools
import math
import pandas as pd
import numpy as np
# import shap as shap
import tensorflow as tf
import keras
# from imblearn.over_sampling import RandomOverSampler
from k... |
213ac3a7e77ecb9e252174abeac07de46876902ec81ea4ea0ae690534423be89 | Python | 20,546 | 447 | import torch
from torch import nn
from collections.abc import Sequence
from torch.nn import functional as F
from torch_scatter import scatter_add, scatter_mean
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.CG22_GCN")
class CG22_GCN(nn.Module, core.Configur... |
3478af765ea3cbd7713679ffc80415efdafbe8bfab74ac4b7946997da260d1a4 | Python | 20,548 | 442 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 08:00:51 2020
@author: daltonm
"""
#%matplotlib notebook
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle
import dill
import os
import time
import glob
import math
import seaborn as sns
import itertools
from ... |
d7893ba0901fdd065ecee93136c12229304eef5cefa25e554bb8eb4cadf5cbaa | Python | 20,548 | 442 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 08:00:51 2020
@author: daltonm
"""
#%matplotlib notebook
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle
import dill
import os
import time
import glob
import math
import seaborn as sns
import itertools
from ... |
6b9a91f161e7ecff827ded9f2285b3d566d062c4f47a19aa8a3eabd7e30f4fb5 | Python | 20,560 | 335 | #!/usr/bin/python
from __future__ import absolute_import
import sys
import argparse
from .utils.process_utils import str2bool
from .utils.process_utils import display_args
def main_extraction(args):
from .extract_features import extract_features
display_args(args)
fast5_dir = args.fast5... |
6422794d66b2d5a1aafb5bd19b01872e28ce895e2f0f2e7a407df4a568cfa38f | Python | 20,561 | 1,076 | import warnings
import pytest
from numpy_utils import combo_check
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.test_util import check_grads
npr.seed(1)
def test_numpy_version():
import numpy
assert np.__version__ == numpy.__version__
def test_do... |
6a8064d67ea79a9c4c30cc358b672399bca6ee805882ab7a7e6a8d65d70df8f6 | Python | 20,571 | 514 | from typing import List
from typing import Union
import numpy as np
from skimage import transform
from skimage import registration
from skimage import feature
from scipy.ndimage.interpolation import map_coordinates
import cv2
import os
import tifffile
from scipy import ndimage
from merlin.core import analysistask
from... |
8616f248b023b8b36bb74017d61b1d68c2a86fa37fdff66561404bdd3b22b1fd | Python | 20,578 | 395 | import glob, ants, itertools, os, json
import numpy as np
from tempfile import mktemp
from tqdm import tqdm
os.environ['ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS'] = '16'
def main(initial_image, label_image, cortical_label_image, num_versions=50, slice_drop=10, slice_neighbours=5, slice_weights='linear', reg_iter=3, tmpd... |
a714350c4a0fd7272c750629f8d7a1ab51b2e2d9fe38df8d3e2e4504fbc80df9 | Python | 20,590 | 453 | """
Modules containing class that
1. maintain detailed morphology information of the circuit.
2. function for single neuron simulation and whole circuit simulation in NEURON
"""
import numpy as np
from neuron import h
from tqdm import trange
class Point:
"""abstract class recording point information
... |
2d424131a3b76d964901588d9bb487b15881390cfe7ea5765d00e1a7d98f2d39 | Python | 20,598 | 446 | # 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... |
957dd4666f06146680f16f691c608aa749c9b451baf1c729cd697418a38a539f | Python | 20,608 | 572 | """Utility functions for running ASE calculators with ASE-based methods."""
from __future__ import annotations
from collections.abc import Callable
from contextlib import nullcontext
from copy import deepcopy
from importlib.util import find_spec
from logging import getLogger
from pathlib import Path
from shutil impor... |
b801771b87369dfcd65fee718beeb070f394354b969b4337b1cb6c28e9e2d17a | Python | 20,613 | 448 | import torch
from torch import nn
from collections.abc import Sequence
from torch_scatter import scatter_add, scatter_mean
from torchdrug import core, layers
from torchdrug.core import Registry as R
from torch.nn import functional as F
from torch_scatter import scatter_add
from torchdrug import layers
@R.r... |
9517fe87b89d59d81f0c59337ebbf83b6915e8dbb649b55e0ac4f4c327441b76 | Python | 20,619 | 672 | import pytest
import os
import uuid
import copy
import tempfile
import pandas as pd
import numpy as np
import utils as u
from analysis_utils import *
@pytest.fixture
def typical_list():
return [1, 2]
def test_typical_list(typical_list):
a = copy.deepcopy(typical_list)
assert a == [1, 2]
a.remove... |
2016ebcf7fd3dfbab63ead1508644cba2a84b896cbd7f10adc5ac3a50663ab5e | Python | 20,621 | 408 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 12:30:26 2020
@author: aabdulaal
................................................................................................................................
"""
from joblib import dump, load
from models import freqcoder, sincoder, RANCoders
import numpy as np
imp... |
281dcbe48c7ec7a28ae7087ca5d1ef064780d7d3264497bec186422c50237543 | Python | 20,621 | 461 | #WCP data file format changed to V9.0. Can now support up to 128 channel.
#Header and analysis block sizes now depend upon number of channels.
#Older format WCP files converted to V9 when opened with unchanged copy saved as .bak file.
import struct
import numpy as np
# TODO: datafile is importing WCPfile, not sure it'... |
bdaa95e452e3b19cbe89724eaac5658cbf18d8b2b8874a8720964ba4260fd65a | Python | 20,621 | 451 | """
Modules containing class that
1. maintain detailed morphology information of the circuit.
2. function for single neuron simulation and whole circuit simulation in NEURON
"""
import numpy as np
from neuron import h
from tqdm import trange
class Point:
"""abstract class recording point information
... |
0a675849e1fe8aba43bd485b3612b939b2bfc85e58677da28a31068a38a9e497 | Python | 20,640 | 407 | """
@author: Haotian Teng
"""
import os
import sys
import math
import torch
import argparse
import numpy as np
from torchvision import transforms
import torch.utils.data as data
from torch.utils.tensorboard import SummaryWriter
from torch.utils.data.dataloader import DataLoader
from functools import partial
from xron.... |
93088bcae5abcfaf971e32cc3398104e34e3f116241d9390cdbd9a344ea64ed7 | Python | 20,641 | 487 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
import control.utils as utils
from control._def import *
from control.core import *
import control.tracking as tracking
from queue imp... |
4ccc4eba9b7f9fa8d44d67ae52107bf2924a9186cf48550878f8be53de605486 | Python | 20,648 | 408 | """
Comprehensive tests for inLibrary attribute behavior across all formats and save modes.
Tests that the inLibrary attribute is:
1. Present in schema sections (Unit, UnitClass, UnitModifier, ValueClass) when save_merged=True
2. Absent in schema sections when save_merged=False
3. NEVER present in extras sections (Sou... |
d0c724c19b70b03ef38c2441580f2efce288d19c0cc44a75c13447720a7a1a5a | Python | 20,652 | 501 | from __future__ import annotations
import numpy as np
from tqdm import trange
from SurvivalEVAL.evaluations.util import (
_inverse_censoring_weights,
check_and_convert_event_data,
)
from SurvivalEVAL.nonparametric_estimator.single_event import (
KaplanMeier,
KaplanMeierArea,
)
from SurvivalEVAL.nonpar... |
652a109d3c90eb1480ab3f01a516d13919ad43e7c2cfa19e734671fd1839eef9 | Python | 20,658 | 473 | """
Registration-output-specific napari viewers.
This module owns all napari display logic that understands the
registration pipeline's output structure - the ``01_affine/`` (legacy
``01_axis_alignment/``), ``02_nonlinear/``, ``03_laplacian_refinement/``
directory layout,
``registration_metadata.json``, ``bound... |
75f2796f9f51824c7a93916dfca71e33db5223489ffeb8f97750f67c214ea30c | Python | 20,661 | 504 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
e17764e3b6f06bfb9f5eb9435356607a35097f6aefc368c7a7511acff0618994 | Python | 20,677 | 457 | # 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... |
325bc0826a747de5521d3faee11745c94d316f288c3c5e2aa8ee6bbe76dcf6e8 | Python | 20,682 | 639 | from collections import OrderedDict
from datetime import datetime, timedelta
from glob import glob
import click
from click import style
from click_help_colors import HelpColorsGroup
from . import __version__
from .utils import (
_get_filepath,
_check_if_file_exists,
_check_if_file_is_readable,
echo,
)... |
663c0efe7f929ae024807375a479e5f13f937b9f642c8d2b8b2c746533ea3c88 | Python | 20,682 | 501 | """
Unit tests for the contour utilities relocated to
regtools/atlas/contours.py (formerly
regtools/manual_contour_registration/contour_utils.py).
Covers:
- extract_region_mask
- extract_region_contours
- fit_spline_through_points
- sample_contour_uniformly
- to_3d_coords
- create_annotation_ove... |
985147a8b1b4e12f7c899acb495ed37d72d4a3fd6be492e037bd2cf42d6adc39 | Python | 20,683 | 526 | import argparse
import json
import os
from openmm import MonteCarloBarostat, XmlSerializer, unit
from openmm.app import (
PME,
AmberInpcrdFile,
AmberPrmtopFile,
ForceField,
HBonds,
Modeller,
PDBFile,
)
from pdbfixer import PDBFixer
from colabmda.openmm.modular.utils import configure_system... |
b44295dce93f63439dcbf920bcc5e2436f87b88e7999fe6eb05fb50f29a8aa97 | Python | 20,684 | 521 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
import os
import numpy as np
from qtpy import QtGui, QtCore, QtWidgets
from qtpy.QtWidgets import QFileDialog, QDialog, QInputDialog, QMainWindow, QApplication, QWidget, QScrollBar, QSlider, QComboBox, QGridLayou... |
31605f6345c2485795effa60091279ed83b93b4c4a88d7ece3c69a2c023d2be3 | Python | 20,691 | 428 | """
June 2024 by Paulien Voorter
paulien.voorter@gmail.com
https://www.github.com/paulienvoorter
Code is uploaded as part of our paper: 'Diffusion-derived intravoxel-incoherent motion anisotropy relates to cerebrospinal fluid and blood flow'
"""
# import libraries
import numpy as np
import torch
import torch.nn as n... |
d8df53ffb5b0f5dc696d818198ec21663acdf46a71f0f246219a87e35399d98b | Python | 20,701 | 593 | # -*- coding: utf-8 -*-
# torch packages
import torch
import torchvision
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.utils.data as data
from torch import optim
from torchvision import datasets, transforms, models
from torchvision.models import resnet50, ResNet50_Weights
import torchvision.tr... |
db290a808a6235292fe2236739f847b14a5b97df8655fd457ea7cc38bc782f31 | Python | 20,702 | 405 | supervised_learning = False
doc = dict(
__class__="""
Builds a generalized low rank model of a H2O dataset.
"""
)
examples = dict(
expand_user_y="""
>>> iris = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/iris/iris_wheader.csv")
>>> rank = 3
>>> gx = 0.5
>>> gy = 0.5
>>> trans = "st... |
618c72cb733be7ed2e14d3ead2e3d5522da0aff62f6d9f3ba71500c7aad9e950 | Python | 20,712 | 378 | import time
import os
import argparse
import wandb
from datetime import datetime
import tensorflow as tf
from tensorflow.keras import mixed_precision
# Environment configuration for TensorFlow
os.environ['TF_ENABLE_EAGER_CLIENT_STREAMING_ENQUEUE']='False'
## custom modules
import src.models.epibert_atac_pretrain as e... |
f38b4d3df5f31d52315cef0a7d17bfba0014b2612daf4283a3f75eaa5a016db5 | Python | 20,713 | 646 | """Settings for quacc."""
from __future__ import annotations
import os
from contextlib import contextmanager
from functools import wraps
from pathlib import Path
from shutil import which
from typing import TYPE_CHECKING, Literal, ParamSpec, TypeVar, Union
import psutil
from pydantic import Field, field_validator, mo... |
745b13594d9b911628ff1b96e67643c27b220660cd72c089f68cfed9dfe26acc | Python | 20,714 | 415 | import torch
from torch._C import device
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
from torch.nn.modules.linear import Linear
from data.processing import process_visit_lg2
from layers import SelfAttend
from layers import GraphConvolution
class COGNet(nn.Module):
def __i... |
79e27928aa3f60a89d7b73ac8e6d1de43590c9ac7999a53266b25ed6307989e5 | Python | 20,721 | 538 | from atom3d.filters import filters
import os
import torch
import numpy as np
import pandas as pd
import random
import torch
import torch_geometric as tg
# import e3nn.point.data_helpers as dh
from transformers import BertTokenizer, BertForMaskedLM
import os
from eudockscore.utils.interface import get_pair_interface_... |
ef1bf333241ebfb5d8b6683466fdb2ebe5882f6610b3258c9781daa3e06cec0b | Python | 20,727 | 479 | from random import shuffle, choice
import os
import logging
import tensorflow as tf
import sys
from PIL import Image
logger = logging.getLogger(__name__)
global tf_image, tf_label, status
import random
import numpy as np
import matplotlib.pyplot as plt
from functools import partial
from albumentations import (
Com... |
f3862e2afaf4f0cac321c9f35e6556c8224fe4db4b4d34b32f7442cf7f87cef3 | Python | 20,728 | 475 | """
Test harness for WikibaseIntegrator.
Every unit test runs fully offline: all HTTP traffic issued through the
`requests` library is intercepted by `requests-mock` and served by
:class:`MockWikibase`, a small in-memory emulation of the MediaWiki/Wikibase
action API backed by the JSON fixtures stored in ``test/fixtur... |
630eb06f9f330133c31deaefe714162611b8c22013ecb447b7ca7b808a097b58 | Python | 20,735 | 491 | # 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... |
661346aa0f68d8123e79baf0ab9f2944a60f0390b07370bf058a75705c4c0e9a | Python | 20,735 | 406 | import numpy as np
import os
import socket
import time
import random
import glob
import argparse, json
import dgl
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from tqdm import tqdm
from nets.... |
e3d3ab757cc3f875eac1abe4aa3a3c67b82fb39f2138d3730e103230434d92f6 | Python | 20,735 | 284 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... |
0584c07cdc7a61876698010a5c9d91deeeae8b3a5b7d8ee78c2027bd3482052a | Python | 20,746 | 331 | import multiprocessing
import os
from warnings import warn
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from conduction_system import DjikstraConductionSystemVC, EmptyConductionSystem
from ecg_functions import PseudoQRSTetFromStepFunction
from geometry_functions import EikonalGeometry, RawEm... |
22bac85230997f13740660ba63591fc913218b2425f5e3f006ba9672b4683992 | Python | 20,760 | 449 | import os
import pickle
import random
import numpy as np
import pandas as pd
from sklearn.manifold import MDS
from sklearn.preprocessing import MinMaxScaler
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.colors as mcolors
from scipy.interpolate import interp1d
from scipy.stats import ttest_rel
fro... |
e639314f10a68282ca8af868bac8591dc760ada13f2f87478ffde528ed077242 | Python | 20,762 | 528 | import io
import json
import os
import tempfile
import unittest
from unittest.mock import patch
from hed.scripts.extract_tabular_summary import extract_summary, get_parser, main
class TestExtractTabularSummary(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.data_root = os.path.realpath(
... |
086d36237e4b90f37fdcab04012a0fbb6893520519424a0c6f80635a5ba3a184 | Python | 20,763 | 474 | '''
Original Author: Nate Zuniga
Modified by: Yi Jie (Josh) Tseng on 10/01/2023
Software requirement: Python
Python module requirement: scipy, sklearn, numpy, pandas and matplotlib
Purpose:
To perform normalization based on the Aguilan et al. 2020. It includes the following steps:
1. Clean and filter data.... |
e93066b1b28429d02d95cafcf369357cad60d9e760e75c693c7c7d0c6c94ad23 | Python | 20,766 | 489 | """
Performs Bivariate 1st order analysis to a SetListTomograms object by tomograms with ListTomograms as reference
Input: - A STAR file with a ListTomoParticles pickle (SetListTomograms object input) used as reference
- A STAR file with a set of ListTomoParticles pickles (SetListTomograms object... |
c417e29dbcfb3f664604bc4a6eebe2e7c4ce65ebf1e6587458349ed6f60ed575 | Python | 20,768 | 433 | from __future__ import print_function, division
import GPy as gpy
import numpy as np
import scipy
import math
from learn_tools.uncertain_learner import UncertainLearner
#from learn_tools.common import map_general
from learn_tools.learner import SUCCESS, FAILURE, NORMAL_WEIGHT, TRANSFER_WEIGHT
# These are all trainin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.