sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
24ce2d24fb5bc6ce9482652299c4123f13975157c8f54dbc5b7a0241a81706c0 | Python | 12,614 | 308 | import re
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from collections import OrderedDict
from torch.hub import load_state_dict_from_url
from torch import Tensor
from typing import Any, List, Tuple
__all__ = ['DenseNet', 'densenet121', 'densenet169', 'densene... |
9739ef05b9ef27774905d70a5bb3f67ec014bd0b89add4b04123750fed1051ef | Python | 12,616 | 365 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from django.core.exceptions import ImproperlyConfigured
from django.db import transaction
from django.utils.crypto import get_random_string
from drf_spectacular.utils import OpenApiResponse, extend_schema, ... |
669b71e09cbd734d2595418229d8f5582c94593e882292b45751a99d705b7379 | Python | 12,618 | 399 | import os
import sys
import scipy.io
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy.signal as ss
import yaml
split_biglicks = True
##PARAMETERS
cross_thr = 0.1 #for hp-filtered envelope [z]
min_npts = 2
merge_dur = 0.015 #<=mergedur detections get merged
hp_freq = 150
sg_params = [51,3]#s... |
e6fa1ceb51d5d084756adf45bac9838850afd2c16ff934cfe3756ebe1d6a1f66 | Python | 12,618 | 370 | # cec2017.composition
# Author: Duncan Tilley
# Composition function definitions, f21 to f30
from . import basic
from . import transforms
from . import hybrid
import numpy as np
def _calc_w(x, sigma):
nx = x.shape[1]
w = np.sum(x*x, axis=1)
nzmask = w != 0
w[nzmask] = ((1.0/w)**0.5)[nzmask] * np.exp... |
a23d8b4ed1d760349b7f767be451f425da4f024cb4fd16b26d33e792ca462fd8 | Python | 12,619 | 228 | """A module that contains basic flow operation processors, such as :py:class:`~corelay.processor.flow.Shaper`,
:py:class:`~corelay.processor.flow.Sequential` and :py:class:`~corelay.processor.flow.Parallel`.
"""
import typing
from collections.abc import Iterable, Iterator, Mapping, Sequence
from typing import Annotate... |
ac6fb7c4d92cca5304c8713ba6eb4ebc0cc801142fa69e63794ed94ceae13230 | Python | 12,620 | 266 | import os
import shutil
import subprocess
import tempfile
from nipype.interfaces.base import (
BaseInterface,
BaseInterfaceInputSpec,
CommandLine,
CommandLineInputSpec,
TraitedSpec,
File,
Directory,
traits,
)
from traits.api import Int, Str
from cvdproc.config.paths import get_package_p... |
225a46c6a57efb6a1cb5a075f916d100366cd5baa5ced1a83e9a304f43eb6da2 | Python | 12,626 | 302 | # -*- coding: utf-8 -*-
import logging
import os
import threading
from dipy.io.stateful_tractogram import StatefulTractogram
from dipy.io.utils import is_header_compatible, get_reference_info
from dipy.tracking.streamlinespeed import length, set_number_of_points
from dipy.tracking.vox2track import _streamlines_in_mask... |
b1c41a0b6a9f2d8b6e57befb1dcb9eb3cc5256768ead027a1ea02ceeff7f8830 | Python | 12,628 | 400 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
aa08a538cec9e9541978faaba8c6e572fb5a06921bd1e13800ea827203256b0b | Python | 12,632 | 303 | import os
import glob
import keras
import keras.callbacks as KC
import numpy as np
import tensorflow as tf
from keras import models as KM
from keras.optimizers import Adam
import metrics
import models
import nibabel as nib
from generators import image_seg_generator_rgb, image_seg_generator_rgb_validation
from tensorflo... |
fa449b2d46a883fa1ec88184afb5d36abe32e2cbe1b1e3c520837ffaf23863c4 | Python | 12,632 | 351 | #!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from dataloader import TestDataset
from collec... |
8ae50b772c2f3a4f0f00061b940dde7d23dbc8d7cfad81f9a912605955c3e5cd | Python | 12,639 | 365 | """
InceptionNeXt implementation, paper: https://arxiv.org/abs/2303.16900
Some code is borrowed from timm: https://github.com/huggingface/pytorch-image-models
"""
from functools import partial
import torch
import torch.nn as nn
from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from timm.models.helpe... |
2849e124a82f3047422314e602521f07deb11fe9f959b4ce21393fcca79dcbaa | Python | 12,645 | 295 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Optional, Tuple, Type
import torch
from torch import nn
from ..sam2_utils import LayerNorm2d, M... |
6f9942edca11786052a377e46fd105a1a6dda13fe5ac53d830ffac121e89ef23 | Python | 12,646 | 358 | from __future__ import annotations
import dataclasses
import typing
from typing import Final
from typing import Literal
from typing import cast
from PySide6.QtCore import QT_TRANSLATE_NOOP
from .._ai_models import AI_ASSIST_MODEL_OPTIONS
from .._ai_models import AI_TEXT_MODEL_OPTIONS
Group = Literal[
"Appearanc... |
d8d291a41dc66420d59b7b6d3dfd63e47e66723f08f207263a07cd91d3539bf8 | Python | 12,646 | 330 | import os
import re
import sys
import toml
import grpc
import google.protobuf
import shutil
import base64
import zipfile
import tarfile
import hashlib
import pathlib
import platform
import itertools
import subprocess
import configparser
def urlsafe_b64encode_nopad(data):
return base64.urlsafe_b64encode(data).decod... |
2d02cad0e54522ee300c526e60c9758b9c44a8407781497658931c6bc515506a | Python | 12,650 | 339 | import os
import unittest
import numpy as np
import pandas as pd
from numpy.testing import assert_array_equal
from pandas.testing import assert_frame_equal, assert_index_equal
from heig.input.dataset import (
read_keep,
read_geno_part,
read_extract,
Dataset,
Covar,
get_common_idxs,
parse_in... |
16738744d3b5b9d08970193121a4c2ac3fcf6d170565caaf74c752311f95b7b1 | Python | 12,651 | 302 | import numpy as np
from scipy.stats import percentileofscore as percscore
import matplotlib as mpl
vals_to_num = lambda uvals: {val:ii for ii,val in enumerate(uvals)}
def check_convert_vals(uvals,vals):
if type(uvals[0]) == type('bla') or type(uvals[0]) == type(np.array(['bla'])[0]):
vdict = vals_to_num(u... |
250de6392755abe3016d7a49e2afed480086a6981899dd7caba5d315003327e1 | Python | 12,654 | 244 | #!/usr/bin/python
#-----------------------------------------------------------------------
# File : pyfim.py
# Contents: frequent item set mining in Python
# (in the current version only with the eclat algorithm)
# Author : Christian Borgelt
# History : 2013.01.23 file created
# 2013.01.24 close... |
d4c484a71715a57f265d04ef9c72f7b6f3aefccc91a712298aaa12712db2fd72 | Python | 12,658 | 255 | import torch
import torch.nn as nn
import torch.optim as optim
from torch_geometric.data import Data
from sklearn.metrics import roc_auc_score, average_precision_score, ndcg_score
import numpy as np
import torch_geometric.nn as pyg_nn
import random
import pandas as pd
# %%
SEED = 666
random.seed(SEED)
np.... |
52c75831bfc40443fa3daf198d35f66a596f2a93387272b5ff1a75f30e88eda4 | Python | 12,664 | 286 | # Kai Sandbrink
# 26.06.2022
# Implements a bandit task with k regular arms but stochastic transitions
import numpy as np
import random
from PeekTakeTorchTask import PeekTakeTorchTask
class ObserveBetEfficacyTask(PeekTakeTorchTask):
# def __init__(self, n_arms = 3, alphas = {'peek': 0, 'take': 0},
# ... |
a3975fd799a575d297702bc1047f529589c176d53a61d978788642ebba412570 | Python | 12,669 | 270 | #########################################################
## Modified DNV calling function
#########################################################
## Source: https://discuss.hail.is/t/de-novo-calls-on-hemizygous-x-variants/2357/20 posted by Kyle Satterstrom
from hail import *
from hail.methods.misc import require_bi... |
44c0cdeeaeaa0b07db587b88f757554ba546e8f5d6692988aaf2d4fe87dcd493 | Python | 12,673 | 427 | '''
ERICA toolkit
-------------------
Useful functions called within other modules or within exampe Juypter notebooks.
'''
import numpy
import scipy
from matplotlib import pyplot
from matplotlib import collections
from scipy.optimize import leastsq, fmin
class minim:
def __init__(self,funct,x,obs,p0,args=Non... |
9305e56d4eb0619be372da77e8aadb1c4592042f850c693b96b35304e8881fe4 | Python | 12,679 | 344 | # coding: utf-8
import numpy as np
import pylab as pl
import h5py
from sklearn.utils import shuffle
import bisect
import os
from chinn import variables
CHANNELS_FIRST = "channels_first"
CHANNELS_LAST = "channels_last"
def load_pairs_as_dict(files, min_length=1000, min_dist=5000, max_dist=2000000, max_length=None):... |
8d1575fca0bac276c18a0b918778629ceedbe98404fcf58b587d28958ceabfe9 | Python | 12,683 | 366 | import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import math
from torch.utils.tensorboard import SummaryWriter
# os.environ['CUDA_VISIBLE_DEVICES'] = "3"
thresh = 0.5 # neuronal threshold
lens = 0.5 # hyper-parameters of approximate function
decay = 4 # decay constants
num_classes = 10
batch... |
99a18e28769d6a37d494a6330043fdadd1cd01036a605040064a4e5ba79b14bc | Python | 12,684 | 334 | # -*- coding: utf-8 -*-
# cifar100_resnet18_td_vs_baseline.py
import copy, random, os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
# =... |
6bf5a754466094356e9166ec55c6e20aae27da4b9584b8b1863701c7a197ac4a | Python | 12,688 | 386 | import os, sys, math, random, argparse, numpy as np
import bpy
import bmesh
import blender_util as bu
import json
from math import radians
from mathutils import Matrix
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('--nobjects', type=int, default=14, help='number of objects in the scene'... |
dcc6cbdf2bc30d284ac10fbcdebf47e6efebfc794cc2437cea8078d4df91472e | Python | 12,692 | 362 | """
Copyright 1999 Illinois Institute of Technology
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, publis... |
aea250894eccb86ad87542e1f6a94a6255eb4256ccceb4efff76cb0e73c88270 | Python | 12,697 | 318 | """Long-lived ChemGraph supervisor built from LangChain agent middleware."""
from __future__ import annotations
from collections.abc import Collection, Sequence
from typing import Any
from deepagents.backends import StateBackend
from deepagents.backends.protocol import BackendProtocol
from deepagents.middleware impo... |
b2fcec4fe0e10546bf8760157504596112de99ccd41176587992f34a2ca9119b | Python | 12,700 | 347 | #!/usr/bin/env python3
"""
Training Results Analysis Script
This script analyzes training log files from THINGS experiments and provides statistics
on completed training runs including accuracy metrics.
"""
import os
import re
import glob
from pathlib import Path
import numpy as np
import pandas as pd
from typing imp... |
8ceb7aabd47685207e6662615560a03366f9b7059eb0c601f0ea1d69675055c5 | Python | 12,701 | 383 | from __future__ import annotations
import os
import subprocess
import sys
import textwrap
from pathlib import Path
import pytest
from labelme import _config
from labelme import _yaml
def _parse(config_file: Path, /) -> dict | None:
return _yaml.safe_load(config_file.read_text(encoding="utf-8"))
def test_crea... |
f26b2306d2e5e9a0328f9b2b20bc1218bf88878bc33aeade120869b650a611bb | Python | 12,701 | 273 | from typing import Callable, Dict, Optional
import numpy as np
import matplotlib.animation as manimation
from scipy.signal import savgol_filter
from neurophox.helpers import to_absolute_theta
DARK_RED = (0.7, 0, 0)
LIGHT_RED = (0.85, 0.5, 0.5)
DARK_ORANGE = (0.7, 0.35, 0)
DARK_BLUE = (0, 0.2, 0.6)
LIGHT_BLUE = (0.5, ... |
757a00acd5594ad64e2094c0016dbfe275db26852de974e3edb8bc27125bf2ce | Python | 12,702 | 285 | """
Load grouped data.
Supported formats: h5 and Nifti.
Image data can be labeled or unlabeled.
Read https://deepreg.readthedocs.io/en/latest/api/loader.html#module-deepreg.dataset.loader.grouped_loader for more details.
"""
import random
from copy import deepcopy
from typing import List, Optional, Tuple, Union
from d... |
01193d499892a689c41c577dd1cd3fb8558f5e3e78738723e63a18120059c9a9 | Python | 12,703 | 317 | """
Tensorflow Model class that dynamically augments training data on each batch
Target labels for augmented seqs are generated using an ensemble provided to the model
Dynamic augmentations can replace or be added to original training data
"""
import tensorflow as tf
import tensorflow.keras as keras
import evoaug_tf... |
ad4f4d440702342c67e88325e7d232a1dbc70e69617ee7fb25acca7c088f15dc | Python | 12,703 | 353 | #!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from dataloader import TestDataset
from collec... |
631674df0cca4651b777f77e0e7eddabc4feb491c1293e317c1d04ca10d132f6 | Python | 12,704 | 288 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Given an input tractogram and a text file containing a diameter for each
streamline, filters all intersecting streamlines and saves the resulting
tractogram and diameters.
IMPORTANT: The input tractogram needs to have been resampled to segments of
at most 0.2mm. Othe... |
0c77125850c973acb7fa32628649bf238810760e225d14cb5bddff65be26eb27 | Python | 12,705 | 344 | # -*- coding: utf-8 -*-
"""Hybrid(CNN+ViT).ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1wxA4ogkPO_hmxIHZ9IehMENWrWxsKaoT
"""
from google.colab import drive
drive.mount('/content/drive')
train_dir = "/content/drive/My Drive/Plant_Disease_Dataset/tr... |
78729104f8ebdd83d8155acc6ed85aa262d06d0efdd895b47594c4e08e1b124a | Python | 12,705 | 318 | """MACE foundation models parameters for ChemGraph
Reference: https://github.com/ACEsuit/mace/blob/main/mace/calculators/foundations_models.py"""
import functools
import logging
import os
import tempfile
import threading
from contextlib import contextmanager
from pathlib import Path
from typing import Literal, Optiona... |
0019c18d87c93f0452dd2dfff02cd34c21faa03d4a3e953ad2b2422d8ca54e03 | Python | 12,710 | 320 | import h5py
from PyQt6.QtCore import Qt, QAbstractItemModel, QModelIndex
import numpy as np
import csv
class FileTreeItem:
"""
Class to define a item for a FileTreeModel object.
"""
def __init__(self, name: str, obj, mdl_type: str, MATLAB_available=False, parent=None):
"""
Initializes a... |
5c10f8dd63facb642ff090f61426b35b3c6c3a07e72839595cb04d74828b1d39 | Python | 12,712 | 346 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import math
from copy import deepcopy
from itertools import product
from typing import An... |
228875ebf16057bcffd147d008774a74979fee746e742fd571a58cb0db402ef6 | Python | 12,717 | 277 | import importlib
import argparse
import matplotlib.pylab as plt
from matplotlib.patches import Ellipse
import matplotlib.transforms as transforms
import itertools
import numpy as np
import torch
import torch.nn as nn
import scipy.stats as sst
import os
import pandas as pd
import sklearn.metrics as metrics
plt.rcParams[... |
16cb8471e61a84dcbde501074cc59083dea2124f619611df644d06a3d3f39d6d | Python | 12,718 | 353 | from __future__ import annotations
import numpy as np
import pytest
from numpy.typing import NDArray
from labelme._label_file import ShapeDict
from labelme._utils import _shape as shape_module
from .util import get_img_and_data
def test_shapes_to_label() -> None:
img, data = get_img_and_data()
label_name_t... |
0c2777bab9fe5a968922e7332afb61e7cd91cd6f0fe211948aec6c0a70676326 | Python | 12,721 | 374 | """Codex (ChatGPT subscription) login status and device-code login for the UI.
The CLI authorizes ``codex:<model-id>`` models through the login stored by
Codex; ChemGraph then validates that the active login is ChatGPT-managed
rather than an API key. This module exposes the same checks to the
Streamlit UI and drives ... |
4462286b973d1d9bc8557db02815b4419d87fe503e2bf0353dba058e39c02143 | Python | 12,732 | 302 | from typing import Optional, Callable, Tuple
import numpy as np
import tensorflow as tf
try:
import torch
except ImportError:
# if the user did not install pytorch, just do tensorflow stuff
pass
from scipy.stats import multivariate_normal
from .config import NP_FLOAT
def to_stripe_array(nparray: np.nda... |
194cc97b7cd8674e7a31bf81028f0a226c1d6d98bc32b35a21ec4ee4b91ea30b | Python | 12,735 | 272 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 3 19:59:44 2022
@author: Yoshi
"""
import os
import shutil
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from rfs_mapper import *
os.chdir("../map_generators")
from color_key_generator import *
def receptive_field_sum_analysis(path,key,cell_... |
a308a3908bdab30515e0f68f4f3ff7dfd00a35055106b4e83635dc0c5df2ef11 | Python | 12,736 | 347 | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import math
from copy import deepcopy
from itertools import produ... |
4658106ea6638371c0e60373d87d8cf71c9baf6108473e33e35706aecaa2ad29 | Python | 12,744 | 336 | #!/usr/bin/env python3
import numpy as np
import pandas as pd
import re
import gzip
import argparse
from collections import defaultdict
import subprocess
import os
import tempfile
def samtools_mpileup(bam_file, fasta, region=None, regions_bed=None, variant_ids=None,
output_extra=None, prefix=None... |
13a2ed61e3f770e0be16db2d5d3fb80fad463c979caa34c20d4b6b7b1ce98a15 | Python | 12,748 | 337 | #!/usr/bin/env python3
"""
import argparse
import os
import random
import shutil
import numpy as np
import pandas as pd
from PIL import Image
import matplotlib
matplotlib.use('Agg') # 防止弹窗
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data i... |
22e307aefdeebe0e93640ed37149185b41fba1d8164338fcfa87b435fd5dce49 | Python | 12,749 | 358 | """
Custom loss function for ECGs.
MB Vessies and RR van de Leur
"""
import torch
import torch.nn.functional as F
import pytorch_lightning as pl
from typing import Union, List
import operator
from operator import itemgetter
import numpy as np
from ecgxai.utils.exceptions import SumMeanReductionShapeMismatchException
... |
7a588bb548151ceca7f76c55c3c077032388c12b1e0a0800272d459d27329c5f | Python | 12,752 | 392 | import base64
import json
import os
import subprocess
import textwrap
import time
from collections.abc import Sequence
from functools import partial
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_cap... |
4518943012f10c08ad687c7bcc5d2a88c4769d6d4d63fd2e68d771954a39f9ba | Python | 12,756 | 335 | from collections import defaultdict
from collections.abc import Mapping, Sequence
from typing import (
Any,
Dict,
Iterable,
List,
Optional,
Tuple,
Type,
TypeVar,
Union,
)
import torch
from torch import Tensor
import torch_geometric.typing
from torch_geometric import EdgeIndex, Inde... |
fe8a9a0a5b7366a23e0b672ac74ee7676f57586b3bbce16793a80e1a392b9ea3 | Python | 12,757 | 200 |
class BH76_2():
def __init__(self):
self.weak = 1.0
self.path="/lustre/wodynski/testset_grid/bh76/"
self.molecules = ['h', 'n2o', 'n2ohts', 'oh', 'n2',
'hf', 'hfhts', 'hcl', 'hclhts',
'ch3f', 'hfch3ts', 'ch3', 'f2', 'h... |
5e78b8faf7d94626f2c0402ca06f412481fdeaf4459efb6b095fb6ebd136a5e5 | Python | 12,759 | 316 | import numpy as np
import scipy as sp
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Activation, Lambda
from tensorflow.python.keras import backend as K
from tensorflow.keras.datasets import mnist, fashion_mnist
from tensorflow.keras.optimizers import Adam
f... |
783b932734a8401db926db65e75624d0365f19837416ab2461538ce29f34205b | Python | 12,762 | 483 | # -*- coding: utf-8 -*-
"""
Interface to Imaris Files
Module to read data and write points to `Imaris <http://www.bitplane.com/imaris/imaris>`_
files.
Note:
To write points without errors make sure the original file has at least one spot object! You can create a fake point in Imaris, then save the file. The poi... |
fcc404aeda99b9ae2f11a5f883463b6b9f311e0f4f6950bab86c2207ddc220cb | Python | 12,763 | 226 | import os
import sys
import subprocess
import shutil
import nibabel as nib
import numpy as np
import pandas as pd
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Directory
from nipype.interfaces.utility... |
6ea5008f19893bac0a106d7e19e5a2f9f2459092757c48acf7f0a4cc78945e3a | Python | 12,764 | 374 | # -*- coding: utf-8 -*-
from itertools import islice
import logging
import os
import tempfile
from dipy.io.streamline import load_tractogram
from dipy.io.streamline import save_tractogram as _save_tractogram
from dipy.io.utils import is_header_compatible
import nibabel as nib
from nibabel.streamlines.array_sequence i... |
cad61624ada7db8631df9c6bca4c2f35f4d7f7d4030b707bb2b56e00d6c293e5 | Python | 12,764 | 388 | import torch
from typing import Optional
from copy import deepcopy
from contextlib import contextmanager
import torch.nn.functional as F
from torch import nn, einsum
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from enformer_pytorch.modeling_enformer import Enformer, poisson_loss
fr... |
4a8105253dbd4ada79949d8c6e1e04e0a61e0f3e2cb8c2e3517463593d0d81b8 | Python | 12,765 | 237 | import argparse
import os
import numpy as np
import h5py
import multiprocessing
import pathlib
from postprocessing_modules.axonal_delay_kernel import get_axonal_delay_kernel
from _functools import partial
from helper_functions import __file__
MODULE_BASE = pathlib.Path(__file__).parent.parent
def chunk_handler(indice... |
a27595e8ea12ec0ab6f8a84698bc7b247ced204fdaa24e3da5d5f4bfa71676c1 | Python | 12,765 | 294 | import numpy as np
np.set_printoptions(legacy='1.25')
from matplotlib import pyplot
from matplotlib import gridspec
from scipy import optimize
from PatchAnalPlots import line
SEC_PER_MIN =60
######## This function calculates averages across experiments
def exp_avg(datas, datatype=None,somethreshold=999e6):
if not... |
1834f3fcdb6ee681bfe0d9e6f280c15d290a8f931a2a1f9d6b886ecb55fd9570 | Python | 12,771 | 255 | from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
import subprocess
import os
import gzip
import contextlib
from datetime import datetime
import tempfile
import shutil
import glob
from sklearn.decomposition import PCA
import qtl.io
@contextlib.contextmanager
def cd(cd_path):... |
598916ed8d47e910f004cd17593edfa025e69913289810842d91a1bd5db13883 | Python | 12,773 | 294 | import glob
import torch
import os
os.environ["OPENCV_IO_ENABLE_OPENEXR"] = "1"
import numpy as np
import os.path as osp
from PIL import Image
from torch.autograd import Variable
import random
import struct
from torch.utils.data import Dataset
import cv2
import json
from scipy.spatial.transform import Rotation as Rot
... |
6616bed20f9e48640aed8d345d63d5a90e8b4961a7f262d8dc857da6360f9a5a | Python | 12,777 | 279 | import glob
import os
import numpy as np
import cv2
from PIL import Image
import multiprocessing.pool as mpp
import multiprocessing as mp
import time
import argparse
import torch
import albumentations as albu
from torchvision.transforms import (Pad, ColorJitter, Resize, FiveCrop, RandomCrop,
... |
1dd981fd4e97dcc73654a2d5b76468ca641cf5833e8bfa1820a3a3d8c8391bd5 | Python | 12,778 | 336 | #!/usr/bin/env python3
# general imports
import numpy as np
import sys
import matplotlib.pyplot as plt
from tqdm import tqdm
import time
# torch imports
import torch
import torch.nn as nn
# PyTorch TensorBoard support
from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
# utils imports
fr... |
3cc1ac3cf8bcd3b1693303182a5c14c6b7fa8508c48268355f39152d75520339 | Python | 12,778 | 282 | import glob
import os
import numpy as np
import cv2
from PIL import Image
import multiprocessing.pool as mpp
import multiprocessing as mp
import time
import argparse
import torch
import albumentations as albu
from torchvision.transforms import (Pad, ColorJitter, Resize, FiveCrop, RandomResizedCrop,
... |
790b8c742f75be512111c8d1531be4e0e254062bf69c1298c39d340f7f80bc20 | Python | 12,778 | 256 | """What one run of the pipeline does: which steps, and what it writes.
Only the settings. The Run button, the progress bar and the log live one level
up in :mod:`meanap.gui.panels.run`, which shares them with the queue — see that
module for why.
"""
from PyQt6.QtWidgets import (
QCheckBox, QComboBox, QFormLayout,... |
e94b155d16703dfbce0d348aa97e087025978ad96fcbb794d13d2154b7b12312 | Python | 12,779 | 342 | import fcn_megfmri
import numpy as np
import pandas as pd
import seaborn as sns
import scipy.stats as stats
import matplotlib.pyplot as plt
# get custom colormaps
cmap_seq, cmap_seq_r, megcmap, megcmap2, categ_cmap = fcn_megfmri.make_colormaps()
plt.rcParams['svg.fonttype'] = 'none'
plt.rcParams['font.sans-serif'] =... |
963c6ef8a47108a3ee58fccdc66ea1ebe6f7b29058fa38903dc0fa2ab8018673 | Python | 12,782 | 360 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
from dataclasses import dataclass, field as field_ptr_behaviour, fields, is_dataclass
from typing import Any, get_args, get_origin, List, Union
import torch
from ...model.data_misc import (
BatchedDatapoint,
BatchedFindTarget,
Batch... |
d4d6900e0dee27b1d464c57785e8e7f38da54a21818e20e87a0071034c22f109 | Python | 12,791 | 395 | """SEW-ResNet."""
import numpy as np
import torch
from torch import nn
from typing import Any
from modules.activation import LIF
from modules.blocks import (
SpikingEiBasicBlock,
SpikingEiBottleneck,
SpikingStandardBasicBlock,
SpikingStandardBottleneck,
)
from modules.conv2d import SpikingConv2d, Spik... |
22ec9da7392e1a2ca9a7a76586fc5c8db3cc26a87b2886c196e0110504655944 | Python | 12,795 | 343 | # Standard libraries
import os
from collections import namedtuple
from itertools import product
# Scientific computing
import numpy as np
import pandas as pd
import scipy.stats.mstats as zscore
from scipy import stats
from scipy.ndimage import gaussian_filter1d
# Machine learning and statistics
from sklearn.linear_mo... |
5b598ca79791c9847d2e7a2c7be442dcc58cc29404b5c81b468c7655c4b5f379 | Python | 12,806 | 381 | from collections import defaultdict
from collections.abc import Iterable, Sequence
from copy import copy
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Union
import numpy as np
import torch
from aislib.misc_utils import ensure_path_exists
from captum.attr._utils.visualizat... |
d96ab7058dd964e7f73c446b9608e0e54812478d36318192c041353ac813be15 | Python | 12,808 | 309 | import os
import numpy as np
import cv2
import torch
import yaml
from argparse import Namespace
from monai.transforms import (
Compose,
ToTensord,
ScaleIntensityd,
AsDiscrete
)
from monai.networks.nets import UNet
from torchmetrics import Dice, JaccardIndex
from monai.metrics import HausdorffDistanceMet... |
c81f828da154db3a37458d42576c9e3d567b1a300cb7834c584920f1b43d478a | Python | 12,813 | 375 | import argparse
import os
from threading import Lock
from typing import Any
from datasets import load_dataset
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from pydantic import BaseModel
from eir.setup.streaming_data_setup.protocol import PROTOCOL_VERSION
from eir.utils.logging import get_logger
logger... |
fe4213db0b37e69c054d746e9dc9af4f9a1f91c9900b197994eec9e15d719d08 | Python | 12,817 | 378 | #!/usr/bin/python3
#
import os
import sys
import argparse
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac import utils
import uac.vars as var
# remove inner circle for lspv, rspv. Removed ripv completely
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of ne... |
63a923f78aa9c5c1d1716195e2529c06fa2f5b619ff05084c04887439b98b4e8 | Python | 12,824 | 274 | import functools
import logging
from collections import OrderedDict
from typing import Callable, Hashable, List, Dict, Any, Union
from pathlib import Path
import numpy as np
from tqdm.auto import tqdm
import gc
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly, walk_coords
from b... |
047088d6b17d82b2b2ce5bc8d5a8943f2e35e87ba1cbefbed0718165560ef038 | Python | 12,825 | 326 | import torch
import numpy as np
import scipy.stats as stats
from .utils import sample_dist
from typing import Literal
image_size = 224
visual_degrees = 7
kernel_size = {'p': 21, 'm': 65} # 95% of Gaussian coverage
# Receptive fields of P and M ganglion cells across the primate retina (Kroner and Kaplan, ... |
d03226db0ce294c058fb5b506851074b77a307bdc094479513da7f1b0986e91f | Python | 12,826 | 397 | import numpy as np
import matplotlib.pyplot as plt
from statsmodels.nonparametric.smoothers_lowess import lowess
import numpy as np
from scipy.interpolate import interp1d
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
import math
import pandas as pd
import os
from scipy.interpo... |
3aa14497577be20b813bfe8d0d451cdea6f9722a825f775618da82b5d6a5e217 | Python | 12,830 | 290 | import torch
# from torch_geometric.transforms import largest_connected_components
from dgd import utils
class DummyExtraFeatures:
def __init__(self):
""" This class does not compute anything, just returns empty tensors."""
def __call__(self, noisy_data):
X = noisy_data['X_t']
E = noi... |
8e5f61e563c24c7fcbce6e12eb22756748136f590d5dfbc6409e6efaffad7faf | Python | 12,834 | 314 | #! /usr/bin/env python3
import logging
from collections import defaultdict
import numpy as np
import torch
import tqdm
from sklearn.preprocessing import StandardScaler, normalize
from utils import common_functions as c_f
from utils import stat_utils
from utils.accuracy_calculator import AccuracyCalculator
class Ba... |
c619f9e51c8a76c81b7826a84a8d68ba71cec767b2b02777ba8722566dd1ea1b | Python | 12,834 | 358 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import math
from functools import partial
from typing import Tuple, Type
import torch
import torch.nn.functional as F
from .rope import apply_rotary_enc, apply_rotary_enc_real, compute_axial_cis
from torch import nn, Tensor
from .common import... |
e167b9e0bec752641268178f3644210edeec7ab4f020c0e6ee86632799a4d99c | Python | 12,834 | 287 |
import pandas as pd
import numpy as np
import distinctipy
import matplotlib.pyplot as plt
from napari_dmc_brainmap.utils import get_animal_id
def get_primary_axis_idx(direction_vector): # get primary axis from direction vector
direction_comp = np.abs(direction_vector) # get component absolute value
d... |
d5f1ab77969789b836b59ce3c95f6c31a9a7d30cf2a6bb310219f5d47abe484d | Python | 12,837 | 395 | # -*- coding: utf-8 -*-
"""Classes for parameter and data deserialization."""
from dataclasses import dataclass
from typing import Optional
import nibabel as nb
import numpy as np
import yaml
from fmri_tools.io.surf import read_mgh
from nibabel.freesurfer.io import read_geometry, read_label
from scipy.io.matlab impor... |
f2cc165607843ffbb1dd72ff95b31bb94ba2682ba393da7757344df781959f06 | Python | 12,838 | 356 | # Copyright 2024 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
052bedaa1b6750d94fc7f4057df2caff86230487b426277893e83cab3bf3b4ce | Python | 12,839 | 241 | # -*- coding: utf-8 -*-
#
# eval.py
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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/l... |
824896bd10660f06e262011e02b4bb3be13d0e688111750698cdf62d2f07bab4 | Python | 12,842 | 341 | import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader, random_split
from torch.optim.lr_scheduler import ReduceLROnPlateau
import numpy as np
import copy
# ---------- Dataset ----------
class CommunicationDataset(Dataset):
def __init__(self, T_receiver, Y):
self.X = ... |
b7b33090e2af72e04dbb815c8f32aff41a4ed1abf9668f62b59f1bdd640ca5d8 | Python | 12,842 | 348 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
from copy import deepcopy
from itertools import product
from typing import Any, Dict, Generator, ItemsView, Li... |
3431c94f113a0e76c358ea2766a5dfb74e4d8807265c94c82321e255134e760e | Python | 12,843 | 364 | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional
import matplotlib.pyplot as plt
import napari
import napari.layers
import numpy as np
import pandas as pd
import scipy.stats
from napari.qt.threading import FunctionWorker
from napari.utils.colormaps.colormap ... |
77157a146b9e21b232b02f1eb120891968080bb905b63ab3da1e58e14d0d4b5f | Python | 12,843 | 337 | import unittest
import numpy as np
import pandas as pd
import scipy.stats as stats
import logging
from batchglm.api.models.numpy.glm_nb import Simulator
import diffxpy.api as de
class _TestContinuous:
noise_model: str
def _fit_continuous(
self,
sim,
sample_description,
cons... |
aafed0a715c2240a98137ea6b8e645bc52b9a3eaff34526ff1c3d8e5e1315fca | Python | 12,844 | 265 | # Copyright (c) 2022, Kwanhyung Lee, Hyewon Jeong. All rights reserved.
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS... |
81ab27ca2013567137040c12916feef6b8ea88672d61e0d1b4b5a512946eac9e | Python | 12,845 | 344 | ## ------------------------------------------------------------
## IMPORTS
## ------------------------------------------------------------
## ----- OS ----- ##
import os
import gc
import io
## ----- MATH / STATS ----- ##
import cv2
import heapq
import random
import natsort
import scipy.io
import numpy as np
from scip... |
e455412ef545cb8b77b6b43db0526179582e0580282054d1db98e0cb32378111 | Python | 12,846 | 399 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import logging
import urllib.parse
from abc import ABCMeta
from collections.abc import Generator, Sequence
from contextlib import contextmanager
from pathlib import Path
from time import sleep
from typing import A... |
105f4dfb9b56594dd12175f38156b8efdd06a4fa1af14f1543bdaf8ba64d86a4 | Python | 12,847 | 323 | import pytest
pytest.importorskip("fireants_fused_ops")
import torch
from time import time
from fireants.losses.mi import GlobalMutualInformationLoss
from fireants.losses.fusedmi import FusedGlobalMutualInformationLoss
from torch.cuda import OutOfMemoryError
from logging import getLogger
logger = getLogger(__name__)
... |
c0a44077c30b35eba43adb06ef4c9a39a982375fd1a1e78e83baebe641518612 | Python | 12,849 | 319 | import os
import json
import pandas as pd
import argparse
from openai import OpenAI
import concurrent.futures
import time
from tqdm import tqdm
from prompt import (
FINDINGS_TO_CONCLUSION_PROMPT_TOP1_CHINESE,
FINDINGS_TO_CONCLUSION_PROMPT_TOP3_CHINESE,
FINDINGS_TO_CONCLUSION_PROMPT_FREE_CHINESE,
FINDING... |
2b352db997b248c14334434af2166657ba4b393eee1c105051414ffc31a48507 | Python | 12,851 | 434 | # Copyright 2024 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
76aad278d7badf2fd50fdd41b8e12120c1ce9e00e3d4f66c9bd8a3c94247fa45 | Python | 12,853 | 345 | import copy
from collections import defaultdict
from pathlib import Path
import numpy as np
import obspy
import pandas as pd
from obspy.geodetics import gps2dist_azimuth
from obspy.io.mseed import InternalMSEEDError
import seisbench
from seisbench.util.trace_ops import (
rotate_stream_to_zne,
stream_to_array,... |
46e4d800606985c078e1c29d4610f463b3b303cfbb810f2a878f5a261ee3583a | Python | 12,857 | 235 | import mat73
import argparse
import numpy as np
import cebra
from discovery_mode_functions.combine_all_trials_all_brain_regions import dataset_all_sessions, discovery_sampled_population
from discovery_mode_functions.split_dataset import split_train_test_data, k_fold_split_data
from discovery_mode_functions.model impor... |
93a84d802e4a9fd9558ab398549cde8fcfa146e7f90b698f1545c52dddb05ac6 | Python | 12,857 | 318 | from enum import Enum
from typing import Dict, Optional, Tuple, Union
import torch
from torch import Tensor
from torch_geometric.explain.algorithm.utils import (
clear_masks,
set_hetero_masks,
set_masks,
)
from torch_geometric.explain.config import (
ModelConfig,
ModelMode,
ModelReturnType,
)
... |
c448baba1f28470f27a7df00ca169c2155828feac8871c7fcf55ccf416c49e5d | Python | 12,861 | 312 | # -*- coding: utf-8 -*-
"""
Created on Thu May 23 13:51:15 2019
@author: Lieke
"""
import os
import numpy as np
import pandas as pd
import time as tm
import rpy2.robjects as robjects
import tensorflow as tf
import math
import scipy.io as sio
import optunity as opt
from tensorflow.contrib.tensor_fores... |
f0b559d12219dbd40d7668334b9390df622f125407ecbfddd6b0b8b59fa9b170 | Python | 12,861 | 386 | from __future__ import annotations
import pytest
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from PySide6.QtCore import Qt
from PySide6.QtGui import QPalette
from PySide6.QtWidgets import QStyle
from pytestqt.qtbot import QtBot
from labelme._shape import Shape
from labelme._widg... |
e5d684fd757aeab0395c6dc303d76842bcc55302c26090cddd27056a6933a52a | Python | 12,862 | 357 | """Combined 3D-viewer + convergence-plot component for optimization runs.
The convergence chart and the trajectory animation used to be independent
widgets: the chart showed energies per step while the viewer looped through
the frames on its own, so a step in the plot could not be matched to a
geometry. Streamlit can... |
cab0bec19d16e0e7bf5d73886321b36901adb4c53fac04d5456c0b2a3f6a4dd7 | Python | 12,863 | 337 | #!/usr/bin/env python3
# general imports
import numpy as np
import sys
import matplotlib.pyplot as plt
from tqdm import tqdm
import time
# torch imports
import torch
import torch.nn as nn
# PyTorch TensorBoard support
from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
# utils imports
fr... |
a51a462ceed58df888c21766e6e3b128bda2d1e485c28d2a091f62632f6e5b06 | Python | 12,870 | 338 | # -*- coding: utf-8 -*-
"""Untitled12.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/16hQi93bogsBVPZaC_XTohduzrs6eGcbW
"""
# =========================================================
# run_all.py (NO TensorFlow)
# Reproducible pipeline for:
# - PCA pr... |
57c5e1950c688f5c45fa800ccdf3ba1e1d170f4530d69d565d4cb693ef641ed7 | Python | 12,872 | 351 | import numpy as np
from keras import backend as K
from innvestigate.analyzer import BoundedDeepTaylor, GuidedBackprop
import innvestigate.utils as iutils
from keras.layers import Lambda, Layer
from skimage.transform import resize
import tensorflow as tf
epsilon = 1e-20 #20
epsilon_small = 1e-20 #20
class _SoftMax(Lay... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.