sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a19246c37d5eeb87705d20a6ac39ef65bc156f564a8567d4f30237556a218c99 | Python | 9,695 | 270 | from __future__ import absolute_import
import inspect
from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature
from typing import Any, Collection, Iterable, Optional, Tuple, Type, Union
from .console import Group, RenderableType
from .control import escape_control_codes
from .highlighter import Rep... |
228a1710a169144acf49ff175f82f66129bcc192ab50b872f80601f6d837fa08 | Python | 9,697 | 344 | # -*- coding: utf-8 -*-
#
# Synthetic analog data generators for testing and tutorials
#
# Builtin/3rd party package imports
import numpy as np
# syncopy imports
from .utils import collect_trials
_2pi = np.pi * 2
# ---- Synthetic AnalogData ----
@collect_trials
def white_noise(nSamples=1000, nChannels=2, seed=N... |
33f957ae19764f7c27672465fba97c0ff66817d2f4010fc0defd966ed73f9b84 | Python | 9,699 | 289 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
import numpy as np
from scipy.stats import zscore
#if self.quadratic_upsample:
# Y = quadratic_upsampling1D(cc, g)
#elif self.gradient_upsample:
# Y = upsample_grad(cc, self.n_components, self.n_X)
def qu... |
fd7d5dc264477aa4fac9f6ac3c483da948a810d1bcfb7b2e70fb736bd927c566 | Python | 9,699 | 200 | import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings(action='ignore')
import matplotlib.pyplot as plt
import json
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline
from skle... |
6549328eea14687c765a2abb968e2beac53e9c172fcdc1f15caa8e63ec8ba435 | Python | 9,700 | 267 | # 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... |
f5ff16a6481ddea3516936201543b456ae875164a287988bdc05906a74569783 | Python | 9,700 | 308 | # %%
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import argparse
import numpy as np
import pandas as pd
import torch.nn.init
from tqdm import tqdm
import pickle
import matplotlib.pyplot as plt
import os
from sklearn.metrics.cluster i... |
1d4c8feca004acb8eac91a1a3ad31ca00fa8056298e668465e236ca7d39d3ed9 | Python | 9,704 | 270 | import tensorflow as tf
import tensorflow.experimental.numpy as tnp
import pandas as pd
import time
import os
import sys
import glob
import json
import functools
def pearsons(y_true, y_pred):
'''
Helper function to compute r2 for tensors of shape (batch, length)
'''
y_true.shape.assert_is_compatible_... |
e711708c9f41f8b2b1e380a31af5076a5ddd83de5a2e8dfda34f4fd17546545b | Python | 9,706 | 273 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.addition import Addition
from elasticai.creator.nn.integer.depthconv1d import DepthConv1d
from elasticai.creator.nn.integer.pointconv1dbn import PointConv1dBN
from elasticai.creator.nn.integer.quant_utils import (
AsymmetricSignedQParams,
Glo... |
ef1f10ff51b235bcd7f7fa7b2efa20d0e688a3a04c89c6c06929857ccabfb85a | Python | 9,706 | 327 | def al_ratio(contour_length, contour_area):
"""Determines ratio of contour length and area
Parameters
----------
contour_length : ndarray
1 dimensional array with type float that contains length of contours
contour_area : ndarray
1 dimensional array with type float that ... |
6374fd8592c29e297bc21d50c74fb0729ede4e227c22a1775b21d41832a9876f | Python | 9,707 | 316 | import sys
import sys
from pathlib import Path
import yaml
import json
import numpy as np
import torch
import click
import argparse
from torch.nn.parallel import DistributedDataParallel as DDP
from segm.utils import distributed
import segm.utils.torch as ptu
from segm import config
from segm.model.factory import crea... |
62b1dda676846b75083f775776b30ce80d5a3428f0bee2308885b3a7f4ef884a | Python | 9,708 | 212 | #!/usr/bin/env python
# import pandas as pd
# import numpy as np
# import seaborn as sns
# from sklearn.mixture import GaussianMixture
# import scipy.stats as stats
# import matplotlib.pyplot as plt
# import seaborn as sns
# from scipy.stats import norm
# import numpy as np
# from scipy import stats
# from plots impor... |
80fd0a2d4ccf5effd6d4c8d441f97502fd80da1f09613d09b29f7734ab658551 | Python | 9,709 | 200 | from dreamcoder.utilities import eprint
import random
class DefaultTaskBatcher:
"""Iterates through task batches of the specified size. Defaults to all tasks if taskBatchSize is None."""
def __init__(self):
pass
def getTaskBatch(self, ec_result, tasks, taskBatchSize, currIter... |
a64a53f7fd2f0ee2a147f1f71ab2b98e9fb6aa44b689c5c2f7d611b54e1885b0 | Python | 9,711 | 241 | import sys
import os
import numpy as np
import re
import cv2
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QFileDialog,
QVBoxLayout,
QWidget,
QPushButton,
QMessageBox,
QListWidget,
QLabel
)
from PyQt5.QtCore import Qt
from annotation_module import process_... |
1055234660cab864eb6c6b1bd135fdf105770d8eefeb05397feaef2bc6a39f29 | Python | 9,713 | 252 | import torch
from torch.utils.data import Dataset, DataLoader
import pickle
from Sampler import get_diabetes_peptides
import pandas as pd
import numpy as np
class SignedPairsDataset(Dataset):
def __init__(self, samples, train_dicts):
self.data = samples
self.amino_acids = [letter for letter in 'AR... |
a1e21136a716e9f3f90f16c3e65dbf2abd63c7707ca2e210f6468ff668c6c0e7 | Python | 9,715 | 233 | import os
from typing import Any, Callable, List, Optional, Tuple, Union
import pandas as pd
import torchvision.transforms as T
from PIL import Image
from pytorch_lightning import LightningDataModule
from torch.utils.data import Dataset, DataLoader
class InvariantRecognition(Dataset):
def __init__(
self,... |
9a7c5e998a09e0dc5c2390659751605ffdb08a5368b1f849fd8277125d10ba78 | Python | 9,719 | 261 | import io
import json
import os
import unittest
from hed import schema
from hed.errors.error_reporter import ErrorHandler
from hed.errors.error_types import ErrorContext, SidecarErrors
from hed.models import Sidecar
from hed.validator.sidecar_validator import SidecarValidator
class Test(unittest.TestCase):
@clas... |
d3043c03c1536a99d509688c730521462b405c9f67bf97fb1f1b2d0b68b7443c | Python | 9,720 | 193 | """
Classes for building from a set of clusters contained by an GraphMCF object
# Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry)
# Date: 09.05.15
"""
__author__ = 'martinez'
from .core import *
import disperse_io
import graph_tool.all as gt
import globals as gs
try:
import pickle as pi... |
7c2b190cff5f50ac90ae092ab8cb7b04372d0db3cb2cfec7fc4642373385e725 | Python | 9,721 | 380 | from functools import partial
import jax
import jax.numpy as jnp
from netket.jax import logsumexp_cplx as logsumexp
import netket as nk
from netket.operator import ContinuousOperator
from netket.vqs import MCState, expect, expect_and_forces
from netket.utils import mpi
from typing import Callable, Optional, Any
from ne... |
d2d89b60323148e1e16d43437d01eaba3b2d49f8bca884868bf1571479cc0e6d | Python | 9,721 | 270 | from functools import partial
import jax
from jax.tree_util import Partial
from netket.jax import (
compose,
scanmap,
scan_append_reduce,
)
from netket.utils import HashablePartial
# from netket.jax.sharding import sharding_decorator
from netket.jax._scanmap import _multimap
from netket.jax._chunk_utils ... |
4a5662cdcb195c4a08f75034dd2eeffdfb18bada00fb37c3cd3cec90a4f9462c | Python | 9,722 | 234 | import torch
import torch.nn as nn
import torch.nn.functional as F
class SelfAttention(nn.Module):
def __init__(self, in_channels, grid_size):
super(SelfAttention, self).__init__()
self.in_channels = in_channels
self.grid_size = grid_size
self.multiatt = nn.MultiheadAttention(in_ch... |
efb007dd957a908a7590f560aba9d1da2345f43ffc05a3a0801557522c8134e8 | Python | 9,724 | 229 | """
Interaction tests for LexemeEntity against the simulated Wikibase instance.
"""
import pytest
from wikibaseintegrator import WikibaseIntegrator, datatypes, wbi_login
from wikibaseintegrator.models import Form, Sense
wbi = WikibaseIntegrator()
def new_form(representation='pinos', grammatical_features=... |
537a1d9f30e1ef1aa42ead483925640cb74784c6ccba3d8093dcec2cd182e714 | Python | 9,726 | 228 | import argparse
import h5py
import json
import logging
import numpy as np
import pyedflib
import sleeplab_format as slf
import subprocess
import time
from pathlib import Path
logger = logging.getLogger(__name__)
def profile_time(f, *args, **kwargs):
t1 = time.time()
p1 = time.process_time()
res = f(*ar... |
37b0f38706b617794b840dd234800a830a85a9e64cc221d5fc0c2155ba232195 | Python | 9,734 | 218 | """
This script evaluates the reference segmentations and model predictions
using the "animaSegPerfAnalyzer" command
****************************************************************************************
SegPerfAnalyser (Segmentation Performance Analyzer) provides different marks, metrics
and scores for segmentati... |
fa51675bd416f5efb4122db38f64f569385c759b54588b4bbb5cd9dbea3f4bf4 | Python | 9,739 | 403 | #!/usr/bin/env python
# coding: utf-8
# ## Download and preprocess CCLE data
# 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
# In[2]:
# gene to explore mutation distribution for
gene = 'TP53'
... |
ac3a7eedb534bfd6a9a681279b73f876aeb3caaa7171975d5a5fccd28b667ec9 | Python | 9,742 | 228 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
9560e8a1fc740210af1578ca0dbb4d0967c2fe6754a7a907aee5f32fc7c3b2e5 | Python | 9,744 | 289 | #
# 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,... |
03a2b0702e8375b5cbe5d8656190f938230a553d58edc4ada442c46b5729ea12 | Python | 9,746 | 335 | from math import pi
import numpy as np
import pandas as pd
from bokeh import events, models, plotting, transform
from sklearn.preprocessing import MinMaxScaler
color_mapping = {"accepted": "#2ecc71", "rejected": "#e74c3c", "ignored": "#3498db"}
tap_callback_jscode = """
// Accessing the selected component ID
... |
35b450d4741e6a21bfa53ddd686a96eee0cb034240ae4498896c4d830f9973b8 | Python | 9,746 | 218 | import random
import numpy as np
from dimensions.common import CUPS, BOWLS
from learn_tools.collectors.common import INFEASIBLE, get_contained_beads, fill_with_beads, InitialRanges, \
create_table_bodies, randomize_dynamics, sample_norm, MAX_BEADS, \
dump_ranges, MAX_SPILLED, MAX_TRANSLATION, create_beads, sa... |
c3ec6305de6651a527ece3d93fc8025585baee389d12233709305dce2060e9c3 | Python | 9,747 | 188 | # import libraries
import torch
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
import numpy as np
import functions
import matplotlib
matplotlib.use('TkAgg')
# np.random.seed(42)
# torch.manual_seed(42)
class DCE_NET(nn.Module):
def __init__(self, hp):
super(DCE_NET, sel... |
fe85cf4301bd6e156ead5a627a7f9a3fed75020d8ee7e01e87affbb39ac567b3 | Python | 9,747 | 301 | # 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... |
e6399f0ca839b4cd77ca62e313585953274eb965b799dcc00484d0f738baeeb4 | Python | 9,750 | 331 | # 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... |
9fca6cdc86623b5e5901c245d41210e747e31166800d87232831b9a780db3c01 | Python | 9,753 | 254 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
60d63e501f86dac69761d4bc1068ad2aa3a0b18e2ce0cf9cea6c0c0a762ea641 | Python | 9,756 | 312 | import os
import argparse
import torch
import numpy as np
from maldi_nn.models import AMRModel, MaldiTransformer
from maldi_nn.utils.data import DRIAMSAMRDataModule
from maldi_nn.spectrum import PeakFilter
from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping
from lightning.pytorch.loggers import Tenso... |
a8df11e0ddc25d7b7cdc193c749f4ed2ece03892441a865cc6773097f5f79c26 | Python | 9,757 | 288 | # # Example for system in Meyers, Craig and Odde 2006
#
# Geometry is divided into 2 domains; one volume and one surface:
# - PM
# - Cytosol
#
# This model has a single species, A, which is phosphorylated at the cell membrane.
# The unphosphorylated form of A ($A_{dephos}$) can be inferred from mass conservation;
# eve... |
087385ebc5bc377ed48761c9938646fad39574e253811e7d8c14f0873a5b06da | Python | 9,758 | 331 | from datetime import datetime
from pathlib import Path
from textwrap import dedent
from numpy import (dtype,
memmap,
array,
c_,
empty,
nan,
float64,
)
import wonambi
from .utils import D... |
b31e404524ce471ad1b3ec5b1878feb5653df7b7f469d8d14dc26ba49d2f6400 | Python | 9,760 | 168 | import numpy as np
import nibabel as nib
import h5py
import os
import pkg_resources
from .multregconn import *
from .corrcoefconn import *
from .pc_multregconn import *
from .combinedFC import *
import ActflowToolbox as actflow
from .. import tools
dilateMM = 10
partitiondir = pkg_resources.resource_filename('Actflow... |
af5de25f5672fde59a72710507e33864666f68265dfde55471977280f38bcff4 | Python | 9,761 | 236 | import torch
import torch.nn as nn
import torch.nn.functional as F
class SelfAttention(nn.Module):
def __init__(self, in_channels, grid_size):
super(SelfAttention, self).__init__()
self.in_channels = in_channels
self.grid_size = grid_size
self.multiatt = nn.MultiheadAttention(in_ch... |
bebf3e4250ed0d0ec5a1ca4d463b6be042526951fdfc7a502852e1e48b30cd76 | Python | 9,762 | 206 | from __future__ import print_function
import importlib
import time
import numpy as np
import sys
import os
PARENT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(PARENT_DIR)
from itertools import islice, chain
from .utils import compute_inverse_kinematics, compute_forward_k... |
5c6249cd85c3508cd576aa9771a0260f369e12cd0a1d6517d0172efc7bbec4fb | Python | 9,763 | 282 | from pathlib import Path
import torch
import pandas as pd
import numpy as np
from typing import Tuple
class Dataset_Fredmd(torch.utils.data.Dataset):
"""
Creates a PyTorch suitable data set for FRED-MD. The data is transformed to
log-differences and rolling origins are created. Afterwards each rolling ori... |
63f3b2c0768ca34892b89002d8eadf6d1e446a2df90d621002b00fca476982d5 | Python | 9,763 | 253 | import os
import pandas as pd
import numpy as np
from os.path import join as pjoin
from tqdm import tqdm
from nilearn.masking import unmask
import argparse
from sklearn.metrics import roc_auc_score
from dimension_encoding.utils import (
load_singletrial_data,
load_category_df,
load_clip66_preds,
load_f... |
3007b17267b9778edd9e5729bb5664e8d5e3ee26acb5d90e655f1ed1d1c8164e | Python | 9,771 | 278 | import numpy as np
import time
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from merlin.core import dataset
from merlin.util import binary
from merlin.view.widgets import regionview
class RegionViewWidget(QWidget):
def __init__(self, warpTask, barcodeDB, dataSet):
... |
724ed377c5ab2ba14146a5c7d1b1a5d0e2b93b2e14886c58b01c5d1b6f0cbb58 | Python | 9,771 | 225 | import os
import os.path as osp
import json
import torch
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm, trange
from shutil import copyfile
import numpy as np
import random
import math
from torch.utils.data import TensorDataset, DataLoader
import yaml
from .dataset import TIGREDataset as Datas... |
9c15c27634a847ce270bf35e64ef39c3a60a402fe341d53e60ad49c91ee9ebeb | Python | 9,771 | 329 | # 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... |
5a3c2235d46cbf1ab12f8300e536f96bfab7437b1485da5b645f3018bb4f308d | Python | 9,773 | 270 | import email.message
import email.parser
import logging
import os
import zipfile
from typing import Collection, Iterable, Iterator, List, Mapping, NamedTuple, Optional
from pip._vendor import pkg_resources
from pip._vendor.packaging.requirements import Requirement
from pip._vendor.packaging.utils import NormalizedName... |
540b299274723d1b93b6e91df0ff95995a4912dd5077dc14e35b0c8918c5e7c2 | Python | 9,775 | 282 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 4 12:13:46 2020
@author: JiaLi
"""
import numpy as np
import sys
sys.path.append("..")
from scripts import basic_comp as bcomp
from scripts import initialization_params
import seaborn as sns
import matplotlib.pylab as plt
import networkx as nx
# initialize a random ... |
c14a20f158963fb5678b93c46fd5b518263c791584b5818140d184ece8bebf44 | Python | 9,775 | 215 | from typing import List, Tuple
import torch
import torch.nn as nn
from .mmd_like import _MMDLikeTrainer
def _gaussian_kernel(x_source,
x_target,
mul_kernel=2.0,
num_kernel=5,
fix_sigma=None):
"""
Code from XLearn: computes the f... |
70b90a6eeee566c8f6f6387f264077197e6a753b668f6af7ef239ef4596b2ad8 | Python | 9,776 | 306 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Fit non-probabilistic LDS model
Training
Created on Thu Jun 13 2019
@author: jmagraner
"""
#%% SLURM custer scheduler specs
# As we are submitting a large number of jobs, add these lines before importing
# anything to enforce SLURM resource allocation, since settin... |
2c6cf7bb1557223b3a1b364c3f26b88a9a23b450b9a5276d05b1cda47dcdfd30 | Python | 9,779 | 250 | """Qualitative group-level comparison of dynamic M/EEG RSN features
"""
# Set up dependencies
import os
import numpy as np
from sys import argv
from osl_dynamics.inference import modes
from utils import visualize
from utils.data import load_data, load_order
from utils.dynamic import compute_summary_statistics
from ut... |
991b02499644619ece8a5fbf816aefa42a6db3becf324388b3c628e4feefcfe6 | Python | 9,780 | 240 | import torch.nn as nn
import torch
from models.tools import TransLastTwoC, CustomLayerNorm, get_norm_layer, PrintLayer
from typing import List
class Chomp1d(nn.Module):
def __init__(self, chomp_size):
super(Chomp1d, self).__init__()
self.chomp_size = chomp_size
def forward(self, x):
r... |
740cbf1da0b113709d9c1b04cc3e977a0cf749fbbadf021aa77c5d14500780c7 | Python | 9,784 | 268 | import logging
import anndata
import pandas as pd
import scipy.sparse
from anndata import AnnData
from pandas import CategoricalDtype
from cirrocumulus.abstract_dataset import AbstractDataset
from cirrocumulus.anndata_util import (
ADATA_LAYERS_UNS_KEY,
ADATA_MODULE_UNS_KEY,
dataset_schema,
)
from cirrocu... |
a691895684a3ae084855ce978e1e945a7f12307a6ebd0303c78de0e48114faf7 | Python | 9,784 | 215 | import glob, json, os, sys
import numpy as np
import cv2
import matplotlib.pyplot as plt
from tensorflow.keras.models import load_model
sys.path.append('pix2pix')
from utils import get_res_and_size, rgb_to_labels
from models import mosaic_prediction
def main(model_dir = '.', model_to_run=100000, mad_threshold=2.... |
3e2445a5a3ebe4a7caefa17bac939d9344716bae2a41ed3687a9fc51eb44e9ef | Python | 9,786 | 198 | import yaml
import os
import logging
from models.resnet import r3d_18
from models.densenet import DenseNet121, TinyDensenet, TinyCNN
from models.multimodal import MultiModalModel
from monai.networks.nets import DenseNet121 as monaidensenet
from monai.networks.nets import Densenet201, SEResNet50
from exceptions.excepti... |
734ec7a4778abae75424ec521272fc177178166cbdf27846eda08dfa44864cc3 | Python | 9,788 | 214 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Reliability in RC +/- vs. their controls
author: András Ecker, last update: 03.2024
"""
import os
from itertools import combinations
import numpy as np
import pandas as pd
from scipy.stats import kruskal
from c... |
09933d893bb8034e2d6108347873b45078f3c0b2deba62d4c59ecb4d713349e2 | Python | 9,789 | 260 | from typing import Any, Dict, List, Tuple
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torchmetrics
from torch.utils.data import DataLoader
from torchmetrics import MetricCollection
_EVALUATE_OUTPUT = List[Dict[str, float]] # 1 dict per DataLoader
def classification_metrics(metric_list:... |
cf32e025765fa4fc1c8196398ee602237d2fac50afef03ec97f80fc184123fcd | Python | 9,791 | 354 | """
Adapted code from:
https://github.com/slowkow/allelefrequencies/blob/main/allelefrequencies.py
"""
from __future__ import annotations
import argparse
import logging
import os
import re
import gzip
import urllib
from enum import Enum
import requests
from bs4 import BeautifulSoup
import pandas.errors
import pand... |
aebdb7a0c61c6e0b698156f6518a5f886bf53f1bcb6efe9c0ad55d4066e21415 | Python | 9,794 | 273 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from src.models.tdrg.utils.position_encoding import build_position_encoding
from src.models.tdrg.utils.transformer import build_transformer
class TopKMaxPooling(nn.Module):
def __init__(self, kmax=1.0):
super(TopKMaxPool... |
67c8e9445042d6a9e94f85ea567c841bd9d6ba15173ba61348e217566d45da2d | Python | 9,795 | 217 | import unittest
import numpy as np
from neurolib.control.optimal_control import cost_functions
from neurolib.control.optimal_control.oc import getdefaultweights
from neurolib.models.fhn import FHNModel
from neurolib.control.optimal_control import oc_fhn
import test_oc_utils as test_oc_utils
p = test_oc_utils.params
... |
87fb9cdaa973feab5978ee048017e5542a3523b1bb295c743976ef6f79bce8db | Python | 9,797 | 273 | # 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... |
9d48d02e7562d2dc4dea001cd6865777d331b48c72697c945959dae3de0cdcac | Python | 9,799 | 303 | # 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... |
904c77a202fa35319441bd8e400fb185c913c30bbead27a958302ddb980f4e8a | Python | 9,800 | 228 | import os
import sys
import time
model_name = sys.argv[1]
datadir = sys.argv[2] # should point to the directory where the fast5 & reds dir exist
print("Model Name: " + model_name)
# Python Script Paths
exedir = "../run_scripts/" # the path to HierarchyCall's test/run_scripts dir
bonito_script_path = "./run_bonit... |
6dbef2bfa4438bb793b51f2d00d00d513f516f864e36da566c29049ccb457a95 | Python | 9,802 | 306 | # 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... |
4236a35e1dbb6ba963caf21a96315cdfa8bc8bc604265c69ede1c0e1b4645886 | Python | 9,804 | 328 | # 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... |
7ce945c84ec9b26aafb43a84dd63f2486a5386a0b041c48ef7c30ec987085b6e | Python | 9,806 | 231 | """The test runner's own stall handling.
A wedged suite that exits green is worse than a wedged suite, so these pin the two
properties that failed on 2026-07-25: every run is watched, and a stall is reported as a
failure rather than mapped to success.
History: both parallel attempts wedged at 99% (an xdist tear... |
364282964be39301b87192962a3f270218597f0c2226cff1ff9ce934ac1ade43 | Python | 9,807 | 232 | import glob
import os
import h5py
import re
import yaml
from PyInquirer import prompt
from prompt_toolkit.validation import Validator, ValidationError
CONFIG_PATH = os.path.join(os.path.split(os.path.abspath(__file__))[0], 'config_train.yml')
class NumberValidator(Validator):
def validate(self, document):
... |
e94460633ef237d60eabbea568d0414fc9345a261e12b8d2c6e4462239e5be95 | Python | 9,813 | 202 | '''
CalciumDenoising/model.py Copyright (C) 2022 Sharif Amit Kamran, Hussein Moghnieh
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later ver... |
1f9d285657f8cb20a5dd245c95db140c335d3952e657c987823d885ecfd98eb0 | Python | 9,814 | 244 | import os
import random
import lxml.etree as ET
import argparse
import carla
from utils import ALL_TOWNS, interpolate_trajectory
PRECISION = 10
DISTANCE = 380
PRUNE_ROUTES_MIN_LEN = 20
LIMIT_FINAL_ROUTES = 50
def get_possible_lane_changes(current_waypoint):
all_lefts = {}
all_rights = {}
tmp_wp ... |
341e6e7fc1c85fcfa58bde582e864ed3d9c02c85a52c21c31796a27d229c067f | Python | 9,815 | 282 | import logging
import os
import subprocess
from optparse import Values
from typing import Any, List, Optional
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.configuration import (
Configuration,
Kind,
get_configuration_files,
... |
baaa1e4c07fa1ce615311d948004fc37ce54668184544a1075a9ff028e9239f9 | Python | 9,816 | 255 | import collections
import logging
import os
from typing import Container, Dict, Generator, Iterable, List, NamedTuple, Optional, Set
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.packaging.version import Version
from pip._internal.exceptions import BadCommand, InstallationError
from pip._... |
528dbe6eca26d23c54f7ccad13d64362e5ccb738ee0f60d9c3d8706a99ecd46a | Python | 9,818 | 244 | import typing
import math
from glob import glob
from typing import Union
import cv2
import numpy as np
import torch
from torch import nn
from torch.nn.init import _calculate_fan_in_and_fan_out, _no_grad_normal_
import torchvision
def invert_affine(metas: typing.List[typing.Tuple[float, ...]], detections: typing.List... |
0b693798cbc2b44058ff0bc37c4f1bfe892467477a43218eb1e3afc84510bd59 | Python | 9,820 | 279 | # Node-group asset "Curve Custom Profile" (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 typing i... |
0d3aee06a1f20f3febbcd97ae81a9dd7247e13360b24641752e00ba89b7a2907 | Python | 9,823 | 266 | import pickle
import os
from numpy import mean, std
'''
class TissueDataset():
NAValue = -1
def __init__(self, cancerFolderName, healthyFolderName, matchToFolderName):
#convert genome to latest
genomeMap = self.createMap(matchToFolderName)
print("Loaded genome map successf... |
6ba638f75f74babd0ce5d3ae0de5e61938011b20eb1ab19521c3e85d54639007 | Python | 9,823 | 196 | # 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 *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core as core
import control.c... |
8895163e8047fab33ff1b636b8204fc1b119e135b7670e665241f2d8370369f4 | Python | 9,823 | 300 | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
#from torchsummary import summary
model_urls = {
'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth',
'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth',
'vgg16': 'https://download.pytorch.org/models/vgg16-397923af... |
e2ddb78af8ebbaa33a84a057d4aa46893b7e3381c68517199c62d5d1cd352bb5 | Python | 9,824 | 255 | import collections
import math
from typing import (
TYPE_CHECKING,
Dict,
Iterable,
Iterator,
Mapping,
Sequence,
TypeVar,
Union,
)
from pip._vendor.resolvelib.providers import AbstractProvider
from .base import Candidate, Constraint, Requirement
from .candidates import REQUIRES_PYTHON_I... |
109ba6c438fa8eec39a981aaf87b3f637b62902e51f94d5db8813c5376174a18 | Python | 9,825 | 283 | from __future__ import annotations
import numpy as np
import pandas as pd
from typing import Iterable, Callable
from numpy._typing import NDArray
from sklearn.base import BaseEstimator
from sklearn.isotonic import IsotonicRegression
from cuppa.components.passthrough import PassthroughRegression
from cuppa.misc.utils ... |
dcb295cff3e172d0907e966f5d61d66192baa690c8d99f181cce40e89223b1ca | Python | 9,825 | 257 | from dreamcoder.utilities import *
from dreamcoder.program import *
from dreamcoder.task import Task
class FrontierEntry(object):
def __init__(
self,
program,
_=None,
logPrior=None,
logLikelihood=None,
logPosterior=None,
pc=None,)... |
d991d2f5b40b3e255338435a8243bedb0ba886f1943d687d49db0bd88e1cd058 | Python | 9,826 | 289 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : plot.py
# Author : Yufeng Liu
# Date : 2023-04-18
# Description :
#
#==========================... |
9aea0ebb671811eaadcae0edf9d4b0ffc4acf217d09393f7ba2a8dce125b33c7 | Python | 9,830 | 354 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:AUTHOR: Jens Petersen
:ORGANIZATION: Heidelberg University Hospital; German Cancer Research Center
:CONTACT: jens.petersen@dkfz.de
:SINCE: Wed May 17 14:29:20 2017
:VERSION: 0.1
DESCRIPTION
-----------
Update all scan types under a given XNAT endpoint
REQUIRES
----... |
e491871a2badd1df219fc97b9ed7db527c52d222adf2ab50620b9e0d9ab1e67e | Python | 9,833 | 282 | # 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... |
68080015f28828a346180e7f943cc8271ab8390d0021b553480c58d209964916 | Python | 9,834 | 202 | '''
CalciumDenoising/model.py Copyright (C) 2022 Sharif Amit Kamran, Hussein Moghnieh
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later ver... |
d7d36ac03f25be10010433bdf68298677f9b00a26524442c1bbb9e55aacdd413 | Python | 9,834 | 268 | """Shipped plane parameters and their shape/axcodes validation."""
import json
import numpy as np
import pytest
nib = pytest.importorskip("nibabel")
@pytest.fixture(autouse=True)
def _clear_shipped_cache():
"""Never let a tmp_path table survive this module.
``load_shipped_table`` is ``lru_ca... |
9931cffcdd332ec5fa29b26c94d43ea036e6e00bf65a2d80d3a60883354f2387 | Python | 9,835 | 273 | # 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... |
f410737a6191739ddc67a7e2ae4b09cc74076c291e5a33eef22a30562a9eda11 | Python | 9,835 | 305 | # -*- coding: utf-8 -*-
#
# polyssifier documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 5 06:14:39 2015.
#
# 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.
#... |
0edc8339cbbe4d0dd8b433f618ef971a7c10937473071b5c33c801f392ad81cc | Python | 9,840 | 296 | # -*- coding: utf-8 -*-
"""
Created on Fri May 24 14:42:38 2024
@author: mpolonen
NOTE: can be used to pick waves I, III, V for both regressors (pulses, anm)
Gives peak and trough amplitudes and latencies, as well as the overall
peak-trough amplitude
Best for plotting chosen peaks on waveforms!
"""
impor... |
883ccfdfcfcb62211a61867b2b872efa4fea21e359eda8feb923ba334460b026 | Python | 9,840 | 240 | """
KNOWN_NT_VALIDATION.py - written 2026-09-17, after the second pre-registration.
THE TEST THE PROJECT HAS BEEN MISSING.
Every claim so far has been checked against the classifier, against another connectome, or
against itself. This one is checked against a BENCH. The FlyWire annotation file carries
`known_nt... |
149ea72378c3ee1d97345535dfc6c952dd8762658e9516e5b68084b8801985ec | Python | 9,842 | 517 | import sys
from typing import TYPE_CHECKING, Iterable, List
if sys.version_info >= (3, 8):
from typing import Literal
else:
from pip._vendor.typing_extensions import Literal # pragma: no cover
from ._loop import loop_last
if TYPE_CHECKING:
from pip._vendor.rich.console import ConsoleOptions
class Box... |
1206f18b01e03ea88d17f5d6386a276f6ddc44c63669798952c3a53ff0310924 | Python | 9,843 | 218 | import numpy as np
import pandas as pd
from ABFbot_functions import *
def detect_bursts(peak_indices, time_resolution, frequency_threshold = 10):
burst_list = []
num_previous_less_threshold_tonic = 0
num_previous_less_100ms = 0
for index in range(len(peak_indices)):
is_starting_burst =... |
1628d046425370ed37937e768770f7345616142b669d26a633a26d51022bec2e | Python | 9,844 | 237 | 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... |
31e6977cca3d813d51702055960c151bd1da5058cd8e23ff34ccb5d343ffaf1c | Python | 9,844 | 218 | import numpy as np
import pandas as pd
from ABFbot_functions import *
def detect_bursts(peak_indices, time_resolution, frequency_threshold = 10):
burst_list = []
num_previous_less_threshold_tonic = 0
num_previous_less_100ms = 0
for index in range(len(peak_indices)):
is_starting_burst =... |
a81f62112ec50614255afac30e27903d6a234caf9a7edf1158d400224a665d02 | Python | 9,844 | 247 | # -*- coding:utf-8 -*-
import numpy as np
import os
from core.utils import *
def compute_score_one_class(bbox1, bbox2, w_iou=1.0, w_scores=1.0, w_scores_mul=0.5):
# bbx: <x1> <y1> <x2> <y2> <class score>
n_bbox1 = bbox1.shape[0]
n_bbox2 = bbox2.shape[0]
# for saving all possible scores between each two... |
78305434efa9d1a92873a2ceb3534399b7f0a171625e613ab5c9ac440981e338 | Python | 9,846 | 261 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# ----- U-Net -----
class contracting(nn.Module):
def __init__(self):
super().__init__()
self.layer1 = nn.Sequential(nn.Conv2d(3, 64, 3, stride=1, padding=1), nn.ReLU(), nn.Conv2d(64, 64, 3, stride=1, padding=... |
42d640d302b382389a096f1e71edef8f76a069a4ad7c63c37d0ac190bd6fb0c5 | Python | 9,850 | 247 | # -*- coding: utf-8 -*-
#
# Test FOOOF integration from user/frontend perspective.
import pytest
import numpy as np
import inspect
import matplotlib.pyplot as plt
import dask.distributed as dd
# Local imports
from syncopy import freqanalysis
from syncopy.shared.tools import get_defaults
from syncopy.shared.errors im... |
a76f3d0be0f706ce9c9299dfa8ab4c5674f10823c4d204ef53c6c9289ef3ae54 | Python | 9,853 | 231 | """Registration GUI worker threads.
Background ``QThread`` workers used by :class:`RegistrationTab`. These were
previously defined inline inside ``RegistrationTab`` methods; they are lifted
here verbatim (same class names, same signals, same ``run()`` logic) so the tab
can stay focused on orchestration. Each wo... |
5f454d80a53d5c359c80f6c620d2de1b693b10002f09b9bff25a0db68d33c934 | Python | 9,857 | 222 | # 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... |
d6962923487a1c69072d4e1a2eaaf1d7f619465507c329d23a4683a51b61a28a | Python | 9,859 | 277 | #
# 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,... |
7583b04fafb3306044baa03dba240884ec89e08b76d070ac4ba9012c68430b25 | Python | 9,863 | 223 | import os
import sys
import argparse
import pandas as pd
from datetime import datetime, timedelta
from passlib.hash import bcrypt
from ckg import ckg_utils
from ckg.graphdb_connector import connector
from ckg.graphdb_builder import builder_utils
from ckg.graphdb_builder.users import users_controller as uh
try:
ck... |
8a4cfdb2b1ba277a6734ead42c02eaa950be995457e785352d2a75cbd47e5143 | Python | 9,863 | 280 | import re
from abc import abstractmethod
from collections.abc import Callable, Collection
from typing import Protocol, cast
from elasticai.creator.graph import find_all_subgraphs, get_rewriteable_matches
from elasticai.creator.ir._attribute import AttributeMapping
from elasticai.creator.ir.datagraph import DataGraph, ... |
32f82bdc9eb4347d0ad4b50cb49b4ae2d602c69f9d05ed2caac71a8887f5fd5d | Python | 9,868 | 274 | from __future__ import division, print_function
import os
from typing import List, Literal, Tuple
import numpy as np
import torch
import torch.nn.functional as F
import torch.utils.data
from PIL import Image
from scipy.spatial.transform import Rotation
from sklearn.neighbors import KDTree
from topaz.utils.data.loader... |
bc638ee9ede030896e08597fdbd30002d7ae757cec2b2b50ee40bd77e9b95e15 | Python | 9,869 | 283 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/09_geo.ipynb.
# %% auto 0
__all__ = ['DiffusionDistance', 'DiffusionAffinity', 'DiffusionMap', 'PhateDistance', 'old_DiffusionDistance', 'setup_distance']
# %% ../nbs/09_geo.ipynb 3
import graphtools
from scipy.sparse import csr_matrix
import numpy as np
from sklearn... |
cd0abed6abf4c90903ac7248e5304ebf0600bf4bb070ac420483557fc82905af | Python | 9,870 | 221 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
from supar.config import Config
from supar.model import Model
from supar.modules import MLP, Biaffine
from supar.structs import ConstituencyCRF
class CRFConstituencyModel(Model):
r"""
The implementation of CRF Constituency Parser :cite:`zhang-etal-20... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.