sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e48faf39ccaa12812f0e8bc62c5e58ec2e4483d2242678cf20fccd32446fd7ac | Python | 9,870 | 244 | import multiprocessing as mp
from eppy import modeleditor
from eppy.modeleditor import IDF
from eppy.runner.run_functions import EnergyPlusRunError
import os
import shutil
import pandas as pd
import datetime
import numpy as np
import glob
from create_office_cell import create_office_cell_model
def generate_params():
... |
b173bc63a0fcef20220ab4f555a09a426b808795faba911dffe2bbf688285e0f | Python | 9,878 | 217 | import torch
import torch.nn as nn
from utils.utils import sequence_mask
from model.module import *
from torch.nn import functional as F
import math
class PositionalEncoding(nn.Module):
def __init__(self, d_model, max_len=5000, dropout_rate=0.2):
super(PositionalEncoding, self).__init__()
pe = to... |
8220b8d3dd91fe746f3e2c7097c246c4d49c9ef6b1a633ddccfe7e602c498e0c | Python | 9,879 | 238 | import os
import pymp
import time
import argparse
import h5py as h5
import numpy as np
from tqdm import tqdm
import os.path as path
from functools import reduce
from neuron import h, load_mechanisms
from utils.utils import squeeze_trace, params_sample, visualize_traces
from single_nrn_tune.neuron_model import WormNeuro... |
c828a050ba71984d81e7c3aa9e79af568f987b5dd69a6b3504725a6245d65221 | Python | 9,880 | 296 | # 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... |
783165ace228bb3e4f3d3f18c2968dd58dbd0f5760d11d27239e0b37db0255e8 | Python | 9,882 | 333 | import argparse
import ast
from maldi_nn.models import MaldiTransformer
from maldi_nn.utils.data import DRIAMSSpectrumDataModule
from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping
from lightning.pytorch.loggers import TensorBoardLogger
from lightning.pytorch import Trainer
from maldi_nn.spectrum imp... |
d8c669bb4928987d8e3e4c3e90b82ed8af25e89009efb90bde383727e222c196 | Python | 9,886 | 238 | import torch
from torch import nn
from torch.nn import functional as F
from flytracking.detection.utils.efficientnet import (
round_filters,
round_repeats,
drop_connect,
get_same_padding_conv2d,
get_model_params,
efficientnet_params,
load_pretrained_weights,
Swish,
MemoryEfficientSw... |
25420f274674c5b7b69f397bf47cf95d57c77fba5b2684431550dbb923a8462a | Python | 9,888 | 244 | """Multi-channel image handling for Cellpose-SAM.
A multi-channel input is no longer silently reduced to channel 0: the user is warned
and can pick which channel to segment, consistently across the detector, the CLI, the
GUI channel picker, the orientation preview, and the result viewer.
"""
import inspect
im... |
359d85f48948827ab7d9a51724b7af48d843923874b780cde701fa7fb51437a4 | Python | 9,896 | 296 |
from sklearn.metrics import classification_report, confusion_matrix
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torchaudio
import torchvision
from torch.utils.data import Dataset
from torch.utils.data import DataLoader, TensorDataset
import seaborn as sn
im... |
a5eb51ae80ca57b25801f311e265df56bd0ba19530a5463db6b44755866e8844 | Python | 9,896 | 171 | # coding=utf-8
# Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. All rights reserved.
#
# 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/... |
70b57276a8ab9339c34059d310c72cdcf2691dc4d7a18fe3aaea565a178839d4 | Python | 9,897 | 226 | import collections
import torch
import torch.nn as nn
import argparse
from sklearn.metrics import jaccard_score, roc_auc_score, precision_score, f1_score, average_precision_score
import numpy as np
import dill
import time
from torch.nn import CrossEntropyLoss
from torch.optim import Adam
from torch.utils import data
fr... |
7c07e0a341a0a617076f8824987b3f6bfa1c04452b7d4913a7be5fab7aba9223 | Python | 9,898 | 294 | #!/usr/bin/env python3
"""
openmm_trajanalysis.py
Analyze trajectory (RMSD, Rg, RMSF) for a single system or multiple replicas.
Automatically detects r1, r2, r3... subfolders if present.
Usage:
colabmda openmm analysis --name 4ldj_wt
"""
import argparse
import glob
import os
from pathlib import Path
import matp... |
c75c884b5a453650e28187b760b55f9e0a5da017dba09b65b6ea6d1530453f53 | Python | 9,903 | 277 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import skimage.transform
from PIL import Image
import os
from skimage import io, exposure, img_as_uint, img_as_float
import h5py
rec_header_dtd = \
[
("nx", "i4"), # Number of columns
("ny", "i4"), # Number of rows
... |
e2483b06bd49b1691be839fad7274235b08743e8902657ae8bd7fb10e6a554a9 | Python | 9,904 | 196 | # -*- coding: utf-8 -*-
import os
import time
import numpy as np
from sklearn.metrics import r2_score
import src.data.utils as data_utils
import src.runner.utils as runner_utils
from src import settings
from src.runner.metric import evaluation_metrics, RDM_correlation
from utils.ols import OLS_pytorch
i... |
e52e36fed12d24b030f1cb15d5c088d4a3e562b4745bf20d58abc12251f67978 | Python | 9,905 | 235 | from collections import defaultdict
from copy import deepcopy
from pathlib import Path
from typing import Dict, Optional
import pandas as pd
from pytorch_lightning import Callback
try:
from pytorch_lightning.loggers import LightningLoggerBase
from pytorch_lightning.callbacks import ProgressBar
except:
from... |
6fc80145fd3e6f53e6c927cea267e89b02953e85688273f89c983736a3110662 | Python | 9,906 | 292 | #! /usr/bin/env python
# Released to the public domain, by Tim Peters, 03 October 2000.
"""reindent [-d][-r][-v] [ path ... ]
-d (--dryrun) Dry run. Analyze, but don't make any changes to, files.
-r (--recurse) Recurse. Search for all .py files in subdirectories too.
-v (--verbose) Verbose. Print informative msgs... |
f0f3f767bbb634aa0b0fa870dcba6a364417f45af935a97dfe7502c597ec601f | Python | 9,907 | 252 | #============================================================
#
# Data preparation for Random-Mixed Noise
#
# author: Francisco Perdigon Romero, Ahmed Shaheen
# email: ahmed.shaheen@oulu.fi
# github id: AhmedAShaheen
#
#===========================================================
import re
import numpy as np
impor... |
0811cfd6f78d392c906c2bf36b1ffb9c47e2adb2ee45844097ecd6a0e79c8678 | Python | 9,911 | 239 | from typing import Tuple
import torch
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from torch import nn
def _pair(t):
return t if isinstance(t, tuple) else (t, t)
class PreNorm(nn.Module):
def __init__(self, in_channels: int, fn: nn.Module):
super(PreNorm, self).__... |
b79d7ce91e625d31a223e118c1a44a3d6b3bb912f17dfe40ee40b582780e4374 | Python | 9,911 | 252 | import hashlib
import os
import urllib
import warnings
from typing import Any, Union, List
from pkg_resources import packaging
import torch
from PIL import Image
from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize
from tqdm import tqdm
from .model import build_model
from .... |
bf967e4a960d8d6bd4afa8a4906b649c623bd4e039332ae57184a06f2e8d357a | Python | 9,913 | 285 | """
Created on 07/07/2020
:author: Chinchien Lin
:summary:
"""
import json
import sys
import math
import os
from datetime import datetime
from functools import cmp_to_key
import SimpleITK as SITK
from src.registration.multichannel import MultiChannel
from src.utils import sitk_utils as sutils
... |
efbda4eb20814b2315cde95524cab77c6ecaee554835b888429b82e8012b21f9 | Python | 9,914 | 187 | # example usage: python dropout_inference.py 0.5 0.5
import os
import sys
# this doesn't solve the no module named 'sem' error when running the script on terminal
# in pycharm, adding content root to PYTHONPATH solve that problem
sys.path.extend([os.path.join(os.path.dirname(os.getcwd()), "SEM2")])
import pandas as p... |
fa538aea81790e9bf15ced8396daf1289b561c24d3ec61367f33b5814e43c796 | Python | 9,915 | 273 | import sys
import torch
import numpy as np
import torch.nn.functional as F
from typing import Optional, Dict, List, Callable, Tuple, Union
def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
torch.backends.cudnn.deterministic = True
def expand_to(t ... |
7cd3116d843f7f06ab9a42f6784363130a3b8f6553cea8411d72cd6a5307c1b1 | Python | 9,918 | 346 | # -*- coding: utf-8 -*-
#
# AGFusion documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 10 11:07:09 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
5727c3d457d5aef643d546933f76d87a54fc6cc1c2cc50c969b1d8906b058e48 | Python | 9,925 | 305 | # -*- coding: utf-8 -*-
"""Numerical tests for virials and energy conservation of potentials"""
import tempfile
import pytest
import numpy as np
import tensorflow as tf
from pinn.io import load_numpy, sparse_batch
from shutil import rmtree
from ase import Atoms
@pytest.mark.forked
def test_pinet_potential():
testp... |
4baf4138fbb645a00edfc80ad53e6f7e4ab0400bbfb2f71975e61c447f827263 | Python | 9,926 | 234 | #
# Testing module for ACME's dask components
#
# Copyright © 2020-2025 Ernst Strüngmann Institute (ESI) for Neuroscience
# in Cooperation with Max Planck Society
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd party package import... |
77ab6c533d9c81f13fe6bb34a77d140e833cbde07f6c43840cbf04bd749cbcee | Python | 9,927 | 169 | """Research plugins: field numerics on tiny fixtures, anatomy audit, shadow mode, leak-dynamics runs."""
import csv
import json
import math
from pathlib import Path
from threading import Event
import numpy as np
import pytest
from scipy import sparse
from conftest import assert_no_hooks
from liquidaion_fly.dopamine_f... |
2c0f60128103ba95f0760592d3da3f766d4a45ba056709f02a0eddd7f338b081 | Python | 9,929 | 212 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ... |
6d2547bfe12a158a11151796c9c02036f14635e0f0a6a21f3bc68e25eabb1c32 | Python | 9,929 | 343 | #!/usr/bin/env python
# coding: utf-8
# ## Analysis of drug response log(IC50) regression with held-out cancer types
# In[1]:
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import pancancer_evaluation.config as cfg
import pancancer_evaluation.util... |
df76c443cb6eebdc5ecc3ef55e514c8deb992edf7aa3628b2e818057a8dadc6d | Python | 9,930 | 325 | #!/usr/bin/env python
#******************************************
#
# SHARC Program Suite
#
# Copyright (c) 2023 University of Vienna
#
# This file is part of SHARC.
#
# SHARC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... |
dfcca15aa69e3412045ef82440b7da8d1d05c79b37b7c554a2d2c9ec132bb2b5 | Python | 9,932 | 278 | import logging
import os
import numpy as np
import pandas as pd
from ...utils import paths as paths
from . import deapUtils as du
def saveToPypet(traj, pop, gIdx):
try:
traj.f_add_result_group(f"evolution.gen_{gIdx:06d}")
traj.f_add_result(
f"evolution.gen_{gIdx:06d}.fitness",
... |
0a28fa4a779f5d5af0841c14c4927634d192e777be5677280a99c2b318dc15ee | Python | 9,935 | 282 | # -*- coding: utf-8 -*-
#
# SpikeData plotting functions
#
# 1st argument **must** be `data` to revert the (plotting-)selections
#
# Builtin/3rd party package imports
import numpy as np
from numbers import Number
# Syncopy imports
from syncopy import __plt__
from syncopy.shared.errors import SPYWarning, SPYValueError... |
987cc14bf63062d8e2533481699fc9cfc0ed28e086fc1fd73953d74f3570fc0c | Python | 9,936 | 273 | from __future__ import annotations
import numpy as np
import pytest
from scipy.optimize import NonlinearConstraint
from sklearn.gaussian_process import GaussianProcessRegressor, kernels
from bayes_opt import BayesianOptimization
from bayes_opt.parameter import CategoricalParameter, FloatParameter, IntParameter, wrap_... |
c340b0bde360698cfb6af6bc502e8ab7bb72557f00d0a205eca26674d24ad0a9 | Python | 9,936 | 222 | #!/bin/env python
"""
OXASL - Module to apply Moco/Distortion/sensitivity corrections
This module generates corrected ASL/calibration data from previously calculated
corrections with the minimum of interpolation
Currently the following sources of transformation exist:
- Motion correction of the ASL data. This gener... |
05ff409055978dad06c9f8adebd06497076b112d5d014b3e0a19f9c82e9b0430 | Python | 9,938 | 327 | import torch
import torch.nn as nn
import torch.nn.functional as F
from egg import core
class RelaxedLinear(nn.Linear):
"""Overwrite to allow second, ignored, input"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def forward(self, x, __aux_input=None):
return... |
b6c97e5b1b7f3c87b842adb0c59cb62bbbb66adb1caa7e7a8b566330fd8d9fbd | Python | 9,938 | 239 | #!/usr/bin/env python3
########################################
### Load packages
########################################
print("----- Loading packages -----")
# General
import numpy as np
import pandas as pd
import os
import csv
# Computing
import scipy.io
from scipy import stats
from heapq import nlargest # gi... |
ba09248ec8465272c2a601c44c4e945488a2690b31cad57c517acad186948912 | Python | 9,938 | 248 | from pathlib import Path
from typing import Tuple
import torch
import torch.nn as nn
from tqdm import tqdm
import wandb
from Utilities.losses import get_criterion
from Utilities.lr_strategies import get_lr_strategy
from Utilities.optimizers import get_optimizer
from Utilities.metrics import AVAILABLE_METRICS
from plo... |
29a11890277091e2d0bb54a82871fe712d4bb602ba1006726d87370843669485 | Python | 9,940 | 223 | import argparse
import cProfile
import os
import json
import sys
import snakemake
import time
import requests
from typing import TextIO
from typing import Dict
import merlin as m
from merlin.core import dataset
from merlin.core import executor
from merlin.util import snakewriter
def build_parser():
parser = argpa... |
323892eebbfd1baaad9083a7e77051b2fe561a2492401a2848adf3669e75f3b3 | Python | 9,943 | 269 | import os
import torch
from torch import autograd
from torchdrug import utils
backend = "fast"
path = os.path.join(os.path.dirname(__file__), "extension")
embedding = utils.load_extension("embedding",
[os.path.join(path, "embedding.cpp"), os.path.join(path, "embedding.cu")])
class... |
93aa3657469d8892d5ed72eead442829009db361752af449aa1d857c3ed69c02 | Python | 9,943 | 265 | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
from functools import wraps
def init_params(params, dataset):
"""Initlaize the parameters with a dataset
For potential models, generate the atomic dress from the dataset.
For BPNN, generate the range of fingerprints (to be used with `fp... |
cab7fea6d0b8e10c82c320c1d7d5bfd81f692a0720d60a09e107aa1cc5f55a5a | Python | 9,946 | 257 | # https://raw.githubusercontent.com/theislab/anndata/103461171e80d403ee8556715649533039e8a4ec/anndata/_core/groupby.py
import collections.abc as cabc
from typing import AbstractSet, Iterable, Optional, Sequence, Tuple
import anndata
import numpy as np
import pandas as pd
import scipy.sparse
from scipy.sparse import co... |
3d08216afcd168ff19184012698a736842e4edaea7712b3c65486350d51d7b79 | Python | 9,956 | 202 | ################################################################################
# Import, Set up MPI Variables, Load Necessary Files
################################################################################
import os
from os.path import join
import sys
import matplotlib
import matplotlib.pyplot as plt
from matp... |
f372b61e58ba9030ed49bcd9547308030f6367400072e903509300ab80227b3d | Python | 9,959 | 245 | # coding=utf-8
# Copyright 2021 The HuggingFace Inc. 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 required by applicable... |
b1fd478053a705672af81eb93eefa482858e3b5c9768e05c54ed401e540414e3 | Python | 9,960 | 279 | from typing import cast
import pytest
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.nn.identity.layer import BufferedIdentity
from elasticai.creator.nn.sequential.layer import Sequential
from elasticai.creator.vhdl.system_integrations.firmware_env5 impo... |
04adf0cea6fdd85345b5924924b42c3b3849c7edcd18daa1c0fe6b88bb37c83e | Python | 9,961 | 159 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Modular prediction of off-target effects
@author: Wei He
@email: whe3@mdanderson.org
@Date: 05/31/2021
"""
__version__ = "1.0.0"
import os, argparse,textwrap,logging, sys,pkg_resources
from MOFF_prediction import *
def MOFFMain():
## Set logging format
loggin... |
9f609769e247b58a160ced237dc7742428061b71c710434ccea452a339c67680 | Python | 9,961 | 271 | # 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... |
cd60ef7f06caf908a7a992221134aaf92bbe751b779b8270ab766a1f6e610226 | Python | 9,961 | 159 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Modular prediction of off-target effects
@author: Wei He
@email: whe3@mdanderson.org
@Date: 05/31/2021
"""
__version__ = "1.0.0"
import os, argparse,textwrap,logging, sys,pkg_resources
from MOFF_prediction import *
def MOFFMain():
## Set logging format
loggin... |
c0d12f6f95f6a1bbb037c679510760f88b96dc4a8e248ed4a65fa2a1d1daa2a7 | Python | 9,962 | 222 | # -*- coding: utf-8 -*-
import torch.nn as nn
from supar.config import Config
from supar.model import Model
from supar.modules import MLP, Biaffine
class BiaffineSemanticDependencyModel(Model):
r"""
The implementation of Biaffine Semantic Dependency Parser :cite:`dozat-manning-2018-simpler`.
Args:
... |
c88d908dff1fd56f2414ea7ad7f3f509f59ee869cf2f1d15df371a5a3c442b59 | Python | 9,963 | 309 | """Functions to generate and manipulate OTF files."""
import os
import tempfile
from typing import Any, Optional
import numpy as np
import tifffile as tf
from . import lib
from .util import PathOrArray, imread, is_otf
def predict_otf_size(psf: PathOrArray) -> int:
"""Calculate the file size of the OTF that wou... |
7a5b8b4acfe2b60961e43bad5fd8492b221231b44e67ce2d4163fca8ec924904 | Python | 9,964 | 242 | #
# 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,... |
ddb4ac286abda95c791398c7e8010dd65c2f7024eec2cda699c1d140b7e8e070 | Python | 9,966 | 249 | """
Script to train pan-cancer mutation classification models on TCGA data and
evaluate them on CCLE.
"""
import sys
import argparse
import itertools as it
from pathlib import Path
import numpy as np
import pandas as pd
from tqdm import tqdm
import pancancer_evaluation.config as cfg
from pancancer_evaluation.data_mod... |
808a206c1bee24ac9c80b23bbb2df38365fa914fe8e0fbc09668e6d98e202ffe | Python | 9,969 | 237 | import numpy as np
import pandas
import os
import tempfile
from merlin.core import dataset
from merlin.core import analysistask
from merlin.util import decoding
from merlin.util import barcodedb
from merlin.data.codebook import Codebook
from merlin.util import barcodefilters
class BarcodeSavingParallelAnalysisTask(a... |
db3fbdd44bb349df8277679d14ed5a55b16a63ca1d5cbd94e13ebbf38d3fc159 | Python | 9,969 | 232 | import pickle as pkl
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
import os
from typing import List, Tuple, Dict
import logging
from scipy.spatial.distance import mahalanobis as mahalanobis_scipy
# reload(logging)
logging.basicConfig(format='%(asctime)s %(levelna... |
86149a3c546990ca9cdf2fb138b8b70f09f27e3d0131146723d9af4f2449fbb1 | Python | 9,971 | 254 | import torch
import torch.nn.functional as F
import numpy as np
import ABIDEParser as Reader
import argparse
import random
import time
from torch_geometric.data import Data
from sklearn.model_selection import StratifiedKFold
from model_gat import GAT
from sklearn.metrics import roc_auc_score #AUC
import os... |
31a21f9c463e1e34b7b6aa19b3b6ba95635e607ec5e616eae4e09f42ff7cdfe2 | Python | 9,972 | 313 | # 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... |
28423cf659b2e047d30793e11175b95e9d35dad246853911dac05ab2eb698835 | Python | 9,973 | 209 | import argparse
import random
from timeit import default_timer as timer
import numpy as np
import torch
from scipy import stats
from torch.utils.data import DataLoader
from utils import data_setup, model, engine, utils, loss_function, data_preprocess, augmentation_utils
if __name__ == "__main__":
# setup device ... |
38e940629b49d61857b3357d059d7f666f08cbc4d932f2cf306aa88a145469ed | Python | 9,974 | 268 | import numpy as np
from scipy.linalg import eigh, solve, solve_triangular
from scipy.sparse.linalg import LinearOperator
from sella.utilities.math import modified_gram_schmidt
from .hessian_update import symmetrize_Y
def exact(A, gamma=None, P=None, B=None):
"""Exact dense symmetric or generalized-symmetric eig... |
ec1067c9fa9dbee5c3735c82d01e182b509a48f0d7ca86217dbdf4ab70bcf2da | Python | 9,975 | 262 | # 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... |
1cf9fb5763eff547b4a56e4ea52eb620b98efd826cbfc1855cb80b79843c10a9 | Python | 9,977 | 287 | # Node-group asset "Animate Peptide to Curve" (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.
import math
from typi... |
eb82f5d8d505090ad7eb26ae2951b78b71a41be84d273fd32358ea297e2bf175 | Python | 9,978 | 228 | # coding=utf-8
# Copyright 2021 Google Research and The HuggingFace Inc. team. All rights reserved.
#
# 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/LICE... |
d7d085372d6ae60a7c0bf32543db5e09df3e0c8850120a6cc3707448e061cb47 | Python | 9,979 | 252 | import pytest
import numpy as np
import json
import networkx as nx
from shapely import geometry
from merlin.util import spatialfeature
testCoords1 = [(1, 1), (1, 2), (2, 2), (2, 1), (1, 1)]
testCoords2 = [(0, 0), (2, 0), (2, 2), (0, 2), (0, 0)]
feature1 = spatialfeature.SpatialFeature([[geometry.Polygon(testCoords1... |
1fbde601258ffc3a54ece8d310e98733d872dd4751b0db0a30515d4f30c7fc14 | Python | 9,983 | 241 |
import numpy as np
import glob
import os
from pytorch_lightning import LightningDataModule
from sklearn.model_selection import KFold
from NET_module.utils.utils import get_config_file, get_task_code, print0
from NET_module.data_loading.dali_loader import fetch_dali_loader
# inspired by the NVIDIA nnU-Net GitHub re... |
ce988a9bda481bddd811c84d3e6f4537e7b98c19dc2a25f6b07a6b53ec654b51 | Python | 9,985 | 262 | import numpy as np
import pytest
import scanpy as sc
from anndata import AnnData
from fast_array_utils.conv import to_dense
from pandas import DataFrame, Series
from pytest import fixture, mark
import pertpy as pt
from pertpy._types import cast_matrix
from pertpy.tools._distances._distances import Distance, Metric
ac... |
f596d34ee9c2db2970bde9a40cf46f2c30d422b75fdb26b2b81bf9ea5901a92a | Python | 9,988 | 269 | # 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... |
7cb3d28836437503e54a7fe9065109440724198ffb072d5a6469af70935d6a24 | Python | 9,994 | 278 | """Tests for Shell and Substruct objects.
Author: Seth Axen
E-mail: seth.axen@gmail.com
"""
import os
import pytest
DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
PLANAR_SDF_FILE = os.path.join(DATA_DIR, "caffeine_planar.sdf.bz2")
class TestShellCreation:
def test_error_when_center_not_atom(self):
... |
d8058f4d84ac1ee2852e016607a076aec9f49b9b9f2b1786f0bb04ae41257bed | Python | 9,995 | 276 | """
Cog SDK BasePredictor definition.
This module provides the BasePredictor class that users subclass to define
their model's prediction interface.
"""
import importlib
import importlib.util
import inspect
import os
import sys
import warnings
from typing import Any, Callable, Optional, Union
from .types import Path... |
c020ab626e3555f337b7540e324a5ab605b5ef91c5d7419a6f32973ee622365b | Python | 9,997 | 236 | #!/usr/bin/env python
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... |
6f52ef55f60fcf26d29e059bff9e50ae66b5856bfbcde7e19d5b43a7542c00fd | Python | 9,999 | 224 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
### Libraries ###
import numpy as np
import pandas as pd
import scanpy as sc
from sklearn.ensemble import RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import fbeta_score
from sklearn.metrics import precision_score
from skle... |
d72ebfc45f40104db9b384e09ad8efaa8ef5502ef3865681331ddf703b027c90 | Python | 9,999 | 281 | import os
import collections
from classification_models import get_submodules_from_kwargs
from ._common_blocks import GroupConv2D
from ..weights import load_model_weights
backend = None
layers = None
models = None
keras_utils = None
ModelParams = collections.namedtuple(
'ModelParams',
['model_name', 'repetit... |
71bf18d241fcab65249b7c78e6f88b4ee38e2b19fe5b21f8506575372ec6060f | Python | 10,001 | 312 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 9 14:44:44 2024
@author: Dustin Garner
"""
import os
import numpy as np
import pandas as pd
import functools
from enum import Enum
import matplotlib.pyplot as plt
import seaborn as sns
border = 0
text_pad = 0
label_pad = 2
font_size = 6
xtick_r... |
ed22f571136fec537f7e14e3280be54d4741551132580c27e330faabd3591674 | Python | 10,001 | 197 | import os
import unittest
from pandas import DataFrame
from hed.errors.exceptions import HedExceptions, HedFileError
from hed.models import DefinitionDict
from hed.models.hed_string import HedString
from hed.models.tabular_input import TabularInput
from hed.schema.hed_schema_io import load_schema_version
from hed.too... |
0ac601e26360298ca4788f37ba19f554ad2b9c94cad4778c77fa0023c66b74ff | Python | 10,002 | 240 | """
Class for representing a parameter space for exploration or optimization.
"""
from collections import namedtuple
import logging
import numpy as np
import pypet
from ..utils.collections import sanitize_dot_dict
SUPPORTED_KINDS = ["point", "bound", "grid", "sequence", "explicit", None]
class ParameterSpace:
... |
e8a35c97e13a1012d505e49606037ce73bffa35a6d37a93bb466c21d4bc6b573 | Python | 10,002 | 236 | """Tests for JSON schema format explicit attributes handling."""
import json
import unittest
from hed.schema import load_schema_version
class TestJSONExplicitAttributes(unittest.TestCase):
"""Test that explicitAttributes field correctly distinguishes inherited from explicit attributes."""
@classmethod
... |
b5eeb1a83d915c65c4f4fb9136fefba84e60a869df24cb4806bc3048d2697297 | Python | 10,003 | 290 | import glob
import os
from itertools import compress
from pathlib import Path
import napari
import numpy as np
import pandas as pd
import tkinter as tk
from tkinter import filedialog
import cv2
from napari_video.napari_video import VideoReaderNP
def save_layers_to_video_directory(viewer, video_path, point_layers):
... |
76f5302c57b78427101167af1543c936b3bfad255adab8624c68cacc393ba0a5 | Python | 10,006 | 278 | # -*- coding: utf-8 -*-
"""
Created on Mon May 7 19:44:40 2018
@author: Francois and Deepak
"""
import numpy as np
import cv2
from scipy.ndimage.filters import laplace
from numpy import std, square, mean
#color is a vector HSV whose size is 3
def default_lower_HSV(color):
c=[0,100,100]
c[... |
7207af07d8310694d55440a106dd6b16e11b71ef3954e70ed7c6b1f9ee2abbd0 | Python | 10,008 | 316 | # 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... |
b63f3158fc3039ca84daec92f210fc81231c6e3d6a6e6494488c22f5e7149201 | Python | 10,008 | 187 | from ckg import ckg_utils
from ckg.graphdb_builder import mapping as mp, builder_utils
from ckg.graphdb_builder.ontologies.parsers import * # TODO: remove star import
import os.path
import pandas as pd
import csv
from datetime import date
import sys
try:
ckg_config = ckg_utils.read_ckg_config()
log_config = c... |
f90fcd5a2c8b22cc33bdc88b3c996b73e6289e3eedd911e6a2f5cea8bfd76a07 | Python | 10,008 | 317 | """Computes the extraction efficiency of a collection of dipoles in a disc.
tutorial reference:
https://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/#extraction-efficiency-of-a-disc-in-cylindrical-coordinates
"""
import math
from typing import Tuple
import matplotlib.pyplot as plt
import ... |
94dd3698134c44bafc739e1e7d3f36106f82bfff743151e10700899cba115bef | Python | 10,010 | 278 | # -*- coding: utf-8 -*-
"""
Created on Mon May 7 19:44:40 2018
@author: Francois and Deepak
"""
import numpy as np
import cv2
from scipy.ndimage.filters import laplace
from numpy import std, square, mean
#color is a vector HSV whose size is 3
def default_lower_HSV(color):
c=[0,100,100]
c[... |
d1c41dcc5174c151ae48cc7f6bdc5321eb117801e641df41972d83a1b6a70ad2 | Python | 10,011 | 285 | """Guard tests: the GUI must re-theme consistently in light & dark mode."""
import pathlib
import pytest
from regtools.gui import gui_constants as gc
from regtools.tests._theme_lint import contrast_ratio, inline_color_violations
_REPO = pathlib.Path(gc.__file__).resolve().parents[2] # repo root
_GUI_CONS... |
18e55f75cf242c33963d467139c1d07d0991ac10c8b5d260445fd26cab17ad3d | Python | 10,012 | 377 | # -*- 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, efficientnet_b0, Ef... |
a876b6596a96f547f81fd3afb0a702754c1bf9a3a16dae6f5f40c83ada6ebfdb | Python | 10,013 | 315 | # -*- coding: utf-8 -*-
"""Participant class"""
import logging
from os.path import join as opj
from dcm2bids.utils.utils import DEFAULT
from dcm2bids.version import __version__
class Acquisition(object):
""" Class representing an acquisition
Args:
participant (Participant): A participant object
... |
6465829068dd3f738733f151523d1461bfb028dcd7fb63bf9d9378be21ce2cb4 | Python | 10,016 | 261 | import logging
from itertools import chain
from typing import List, Tuple
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torchmetrics
from torch.autograd import Function
from torch.utils.data import DataLoader
from ..classifier import ClassifierTrainer, classification_metr... |
b881c4abece3fa9cb65f74ec7be55b34cac81178a328cee43b35f863d40c1005 | Python | 10,018 | 245 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.integer.MPQ.softmax.design import (
SoftmaxLUT as SoftmaxLUTDesign,
)
from elasticai.creator.nn.inte... |
16111c1081502be63754848f39ff90526fad123c584c8798072dc04481556165 | Python | 10,023 | 284 | import os
import pathlib
import random
import re
from typing import Union
import cycler
import matplotlib as mpl
from matplotlib import figure
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy.stats
import seaborn as sns
import gaussianize
import sys
sys.path.append(r'C:\\Users\\ICN... |
7d73122033cd678487db4b32a5d02d596cd485de1bfda3564136f92234b0d6c8 | Python | 10,023 | 242 | import torch
from torch import nn
from torchdrug import core
from torchdrug.layers import functional
from torchdrug.core import Registry as R
@R.register("models.TransE")
class TransE(nn.Module, core.Configurable):
"""
TransE embedding proposed in `Translating Embeddings for Modeling Multi-relational Data`_.... |
4d32efe29e5013623c9d9456d6d64f115ed2350f48180449698153a0248063be | Python | 10,024 | 324 | # 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... |
129c299fb8eb61cf8bab262807cceaa018451641376cbad0cfde15e2d69efb5e | Python | 10,027 | 222 | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and the HuggingFace Inc. 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
#
# Un... |
f0ce11b1585553f2a62b433a8cb6316d09d8dc3e57ebe7009b7677d1e311a51c | Python | 10,027 | 296 | # TODO new save, something like
# torch.save({
# 'model_state_dict': model.state_dict(),
# 'some_param': model.some_param # 保存字典参数
# }, 'model_with_dict.pth')
#
from typing import Callable, List, Dict, Optional, Literal, Tuple
import torch
from torch import nn
from hotpp.layer.utils import ElementLi... |
ede19fdeb0b022a789155aeb3d1aaaaf479f5021976e7a98f26e898c700b644c | Python | 10,028 | 178 | import torch
from torch import nn
from torchdrug import core, data
from torchdrug.layers import functional
from torchdrug.core import Registry as R
from cg_steps_energy_injection.cg_protein import CG22_PackedProtein
@R.register("layers.CG22_GraphConstruction")
class CG22_GraphConstruction(nn.Module, core.C... |
a7ce3342a2cefcf1281e7c8f45f71d9b6b87a7e4972375f8a37dc8acc1941bbc | Python | 10,030 | 250 | """Classes for calculating connectivity between signals."""
from typing import Union
from numpy.typing import NDArray
import numpy as np
from coh_exceptions import ProcessingOrderError
from coh_connectivity_processing_methods import ProcMultivariateConnectivity
import coh_signal
class ConnectivityGranger(ProcMultiv... |
c489f1720e14ff612ceffeab519978664ceb3e9d98491cacb95deac70c54bbbd | Python | 10,030 | 286 | def format_values(name, spath):
"""Formats values and writes them into array
Parameters
----------
name : str
Name of the txt file
spath : str
Name of the directory
parameter : str
Name of the parameter
Returns
-------
values : ndarray
1 ... |
e0ecf01fbfc6337985c353469cd9dfce7a61ddec56d6a0e67a6529a9223f7056 | Python | 10,031 | 190 | # 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... |
9351d431dd1b13e1b100609d7eb0269bbd021d7633eb8c84723dd3770344729e | Python | 10,032 | 239 | from __future__ import division
from __future__ import print_function
# coding: utf-8
# In[13]:
# !/usr/bin/python
from builtins import range
from past.utils import old_div
import os
import re
import glob
import sys
import argparse
from subprocess import call
import stat
def main(argv):
# defaulttrackerpath... |
d7707c5d41b8a170ee2dd5ef7db216c0b15e47e654db502a4d2d7371d38df1b5 | Python | 10,032 | 261 | ######################## 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... |
57f276ded746a196a5315a1e8b395e33d489a75bb71dd62729d365221358f64e | Python | 10,038 | 196 | import argparse
import os
import time
from scipy.io import loadmat, savemat
import numpy as np
import logging
import datetime
import torch
from torch import optim
from torch.utils.data import DataLoader
import network
import loaders
def main():
start_time = time.time()
# parse the input
parser = argpars... |
15ce863cf6faa817172e39630041c1d5ae96d20834568050a7b60f17137df8ea | Python | 10,042 | 323 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import sys
sys.path.append("../scripts")
# In[1]:
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
from torch.autograd import Variable
from torchmetrics.functional.classification import (
binary_accuracy,
binary_auroc,
... |
47fa1412db3d8ac95a36f5c0652ce11599ae4adfebb31f7e7960428945a35980 | Python | 10,042 | 352 | from unittest import TestCase
from unittest.mock import MagicMock, patch
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from tgan.data import (
MultiModalNumberTransformer, RandomZData, TGANDataFlow, check_inputs, check_metadata)
class TestTGANDataFlow(TestCase):
def test___init... |
4e216ccc8b9bca0026bbffd848de5fc4f34a2afa2772e5de45c093117a0e0077 | Python | 10,044 | 316 | import os
import pickle
from neuralPCAClassifier import Classifier
import random
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from random import randint
import sys
def getRandomRocPoints(patients):
answers = []
for i in range(0, len(patients["validation... |
8f053ec6b40f269e3201385c719315dfa14728445aa8cad5bf8ba0cc7986eaf9 | Python | 10,045 | 243 | """
Generates a ListTomoParticle object from a input STAR file with vesicles segmentations
Input: - STAR file for pairing STAR files with vesicles segmentations
Output: - A STAR file with a ListTomoParticles object pickled
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
... |
92eaf2ef04e95b6bedbc10e624d0d221341838c5dd59e43b72597433f2d67cc8 | Python | 10,046 | 236 | """MNE raw data format reading.
This module provides functions for reading MNE raw data format
"""
from copy import deepcopy
from pathlib import Path
from typing import Callable, Optional
import numpy as np
from mne import events_from_annotations, find_events, set_log_level
from mne.channels import DigMontage
from m... |
f0ead31f390d502d0534534cb07e1e225753097d0d5c7143cfd0ebc50273f163 | Python | 10,047 | 325 | import numpy as np
from itertools import product
from hippo.models.cscg_tools import extract_AB
from pymdp.agent import Agent
from pymdp.utils import obj_array_from_list
from pymdp.control import (
get_expected_states_interactions,
get_expected_obs_factorized,
calc_expected_utility,
calc_states_info_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.