sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
33e596233c96de0029fde24f77b9d71889f0a68e5d9222b4e4bee7ed76a68f22 | Python | 6,978 | 217 | from __future__ import division, print_function
from six.moves import xrange as range
from nose.tools import with_setup, assert_raises, assert_equal
import itertools
from scipy.linalg import block_diag
import numpy as np
where = np.flatnonzero
from lavaburst.core import algo
from lavaburst import scoring
A = 10*bl... |
9ec2f271487ca646b63bdae142d2a164f06ce81924047e3e94469b4687be8b62 | Python | 6,979 | 161 | import tempfile
import torch
from diffusers import IPNDMScheduler
from .test_schedulers import SchedulerCommonTest
class IPNDMSchedulerTest(SchedulerCommonTest):
scheduler_classes = (IPNDMScheduler,)
forward_default_kwargs = (("num_inference_steps", 50),)
def get_scheduler_config(self, **kwargs):
... |
fe153a96b949e64a8626839eb8a54980a2b4c8f3864548c3a2f1ea1f0c45eda7 | Python | 6,979 | 142 | import os, sys, re, enchant, logging
sys.path.append(os.getcwd())
import nltk
try:
from nltk.tokenize import TweetTokenizer
from nltk.stem import WordNetLemmatizer
from nltk.corpus import wordnet as wn
from nltk.util import ngrams
except:
nltk.download()
import pandas as pd
import numpy as np
fr... |
565ea62684817d0fe723a0d5550270e11af15432d650a11c86e9ae2a6dac2c7e | Python | 6,981 | 189 | import os
import pickle
import numpy as np
import pandas as pd
from scipy.ndimage import gaussian_filter1d
from utils.stats import get_point_biserial
from utils import pickle_load
HUMAN_BOUNDARIES_FPATH = '../data/high_level_events/seg_data_analysis_clean.csv'
PRECOMPUTED_DIR = '../data/precomputed_hb'
MOVIE_POST_STR ... |
af74f598ceee40583072980076594e5160bbea1f700bfebc5362c057270e18b2 | Python | 6,981 | 164 | import torch
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.functional as F
from sklearn.m... |
10ea5652aa939cefe111033b794bdaa9b8e252741b725d529e6c53b8b0bf5db1 | Python | 6,983 | 164 | import torch
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.functional as F
from sklearn.m... |
1eea0e90e4db4103a7cd600bf865d0ad35f38e2deea6f7147d177188b911ac40 | Python | 6,984 | 183 | # -*- coding: utf-8 -*-
"""
Template-based prediction.
==========================
In this tutorial, we show how to better predict new contrasts for a target
subject using many source subjects corresponding contrasts. For this purpose,
we create a template to which we align the target subject, using shared information... |
95d871cc344005f4d3d1235c0a0a69068e40af9627f9983bac44968e0801bf09 | Python | 6,985 | 191 | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 ag... |
d6f1d4a6c821e95d87da658d304a0859f53e64b8cb133c23bd710251f1b2cc24 | Python | 6,985 | 212 | import os
import torch
import time
import argparse
import numpy as np
import pandas as pd
import torch.nn as nn
from tqdm import tqdm
from sklearn.metrics import mean_absolute_error
from torch.utils.data import DataLoader, Dataset
from torch.utils.data import Dataset, random_split
import torch.nn.functional as F
parse... |
b613b4767feec455612d6d95787fb6604321e3e1f552d60af184e8ef9e86ac67 | Python | 6,989 | 207 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
1ea4b51db2492779e94fde6fd2b4844d431827dcf91ce22d58e04221f0535f73 | Python | 6,994 | 170 | import torch
import logging
from torch import nn
from os.path import exists
from agent.data.entities.config import MODELS_CACHE_PATH
from agent.classifiers.evaluation.evaluation_mgmt import get_evaluation_measures
from agent.classifiers.utils.random_mgmt import set_random_seed
from agent.classifiers.ffnn_classifier i... |
80d2f31103f4cf999805fc0bbc580a3fc10bf086faac1dbfc6bbefb7fd278b9f | Python | 6,994 | 184 | import math
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import sys
sys.path.append('/data/ldap_shared/home/s_lyr/code/er-network-segmentation/models/DeepLap')
from models.DeepLab.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
import ssl
ssl._create_default_https_context = ssl._cr... |
8f99fd1917bb00c1a6e7a8b8c226a5e84ff9f58dc7b0e34a1810919a45c29762 | Python | 6,995 | 183 | # -*- coding: utf-8 -*-
#
"""
"""
import pandas as pd
import pysam
from .annotate_intersection import annotate_intersection
from .classify_effect import classify_effect
from .nearest_tss import annotate_nearest_tss
import svtk.utils as svu
def annotate_gencode(sv, gencode):
# Annotate Gencode hits and predicte... |
b670afd46c90c0447bc01d44e9bbcee306580f3d09e785786750045194a23f28 | Python | 6,995 | 217 | import logging
import os
import tempfile
import warnings
import numpy as np
import pytest
import torch
from torch import nn
import pfrl
from pfrl.agents import a3c
from pfrl.envs.abc import ABC
from pfrl.experiments.evaluator import run_evaluation_episodes
from pfrl.experiments.train_agent_async import train_agent_as... |
2eaf6a6453b888d55cc5e1da8290ca411e3e4dbd81257446bfd6a96ca922d7aa | Python | 6,996 | 192 | # Copyright (c) 2017-present, Facebook, Inc.
#
# 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... |
f66c370511faa2810552eb5b7c820f9fe559f12c230b708f050d411640ab1241 | Python | 6,996 | 218 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Tests: UMA Hessian inference — analytical (autograd) Hessian vs
numerical finite-difference Hessian, Hessian symmetry, and
the... |
30227fd45d9a8e0137628cf7f44c342f32d3ce158313751ce4b97561ea58733b | Python | 6,998 | 199 | # -*- coding: utf-8 -*-
# @Time :2024/6/17 17:17
# @Author :MENGLong Li
# @File :ABAQUSForResult.py
# @Software:PyCharm
import numpy as np
#from abaqus import *
#from abaqusConstants import *
from scipy.spatial import KDTree
import os
pop = 4 # 内部节点个数为1-4个
n = 4 # 每个节点选择最近的4-1个节点作为杆
LengthX = 4 # 点阵结构X边长为4
... |
3f2eb1e62773cd07b96745a69882b9d9f1eb43e2154c1a5b4377c844437095a7 | Python | 6,998 | 229 | """InterPro Protein Families and Domains API client."""
from typing import Dict, List, Optional, Any
from ..base import BaseAPIClient
class InterProClient(BaseAPIClient):
"""Client for InterPro API."""
def __init__(self):
super().__init__(
base_url="https://www.ebi.ac.uk/interpro/api... |
220e4639c7dc0a4c22a50ade0f2fb51d0dac5d1fc9eedccfa4b25c16ae557425 | Python | 6,999 | 200 | import torch
import torch.nn.functional as F
from math import exp
import numpy as np
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def gaussian(window_size, sigma):
gauss = torch.Tensor([exp(-(x - window_size//2)**2/float(2*sigma**2)) for x in range(window_size)])
return gauss/gauss.su... |
89f070b8be99c6bd432964d62ccb7508af623468f0581dad95ceb8985b71b136 | Python | 7,004 | 161 | import numpy as np
import matplotlib.pyplot as plt
#from cellpose import models
#from cellpose.io import imread
import sys
import glob
import re
import parse
import os
import time
import shutil
import skimage.io
import filecmp
import pickle
import atexit
#from stardist.models import StarDist2D
#from csbdeep.utils impo... |
9348a847b53e0cfbe667d617ef835efc451ead12e533a9ca18f09108ae43fb50 | Python | 7,010 | 156 | import csv
import os
############
ratio_dict = dict()
ratio_dict['400x'] = 1
ratio_dict['100x'] = 4
ratio_dict['25x'] = 16
############
def remove_white_background_v3(input_img, PADDING, folder_path):
# Reset variables
remove_rows_top = 0
remove_rows_bottom = 0
remove_cols_left = 0
... |
1a523a53a27f9f6b19dff3fa9c543e7bff04835cb460e845b2fcff9d438303f4 | Python | 7,011 | 255 | """
Implementing "a network with a merge and a split" in https://github.com/synsense/sinabs/issues/181
"""
import torch.nn as nn
from sinabs.activation.surrogate_gradient_fn import PeriodicExponential
from sinabs.layers import IAFSqueeze, SumPool2d
dcnnl_map_2 = {
0: {
"input_shape": (2, 34, 34),
... |
4db68133bbac97e076b6b431fbd7f2de2879b374d6bed5a8e17f69dbb3afaabd | Python | 7,012 | 225 | import numpy as np
# import itertools
from copy import deepcopy
from utils import to_pth, to_np
from itertools import groupby, chain
context_types = ['null', 'truth']
dtypes = ['int', 'float']
class ContextualBandit():
"""Short summary.
Parameters
----------
n_machine : type
Description of p... |
178d6281f6e0f482893a0c7942f1207d285242a8132aa1c878770b3ba5479993 | Python | 7,013 | 201 | import csv
import gzip
from pathlib import Path
from xml.sax.handler import ContentHandler, feature_namespaces
import humanize
import plyvel
from defusedxml import sax
from . import utils
class UniRefHandler(ContentHandler):
def __init__(self, save_folder: Path, threshold: int, console):
super().__init_... |
a1098ac8833a7e49ab87221a897e3023c2a7961b5a40f5759f7eb41e809d917f | Python | 7,013 | 190 | import os
import os.path as op
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from dipy.tracking.streamline import orient_by_rois
import dipy.stats.analysis as dsa
from dipy.io.image import load_nifti, load_nifti_data
from dipy.io.streamline import load_tractogram
from fsub_extractor.utils.syste... |
bc3f3e5fb49dd612b662e5a2104fa08ebd2221401f34e5d5032c579b9fd26e76 | Python | 7,013 | 199 |
import pdb
import numpy as np
import torch
from data_assimilation.particle_filter.base import BaseParticleFilter
import matplotlib.pyplot as plt
class BootstrapFilter(BaseParticleFilter):
def __init__(
self,
**kwargs
) -> None:
super().__init__(**kwargs)
self._upda... |
07205e5675de4511f790222d2fbaeddf0eac3dab36d43a2c072d1e935d06a208 | Python | 7,015 | 173 |
import gym
import numpy
import random
import os
from gym import error, spaces, utils
from gym.utils import seeding
from matplotlib import pyplot
from collections import OrderedDict
import gym_sted
from gym_sted import rewards, defaults
from gym_sted.utils import SynapseGenerator, MicroscopeGenerator, get_foreground,... |
b35f34b0caa18035211f7b88f45568b376afd486c499f3aaa05ca384da13a938 | Python | 7,017 | 160 | #!/usr/bin/env python
# coding: utf-8
import torch.nn as nn
import torch
import numpy as np
import sys; sys.path.append('../analysis')
class Env(nn.Module):
def __init__(self, arg):
super().__init__()
self.__dict__ .update(arg.__dict__)
def reset(self, goal_radius=None, target_posit... |
e07059e63c78752e3d92da6a6f8256c211a9be130c8ae4701865cbabee245b7e | Python | 7,017 | 204 | import torch
from pfrl.agents import dqn
from pfrl.utils.recurrent import pack_and_forward
def _apply_categorical_projection(y, y_probs, z):
"""Apply categorical projection.
See Algorithm 1 in https://arxiv.org/abs/1707.06887.
Args:
y (ndarray): Values of atoms before projection. Its shape must... |
5597fa24cf218a086e0e1ac331f5122d1b22f8bc931d487dcaa9a468107f5383 | Python | 7,018 | 189 | import tempfile
import unittest
import numpy as np
import torch
from diffusers import ScoreSdeVeScheduler
class ScoreSdeVeSchedulerTest(unittest.TestCase):
# TODO adapt with class SchedulerCommonTest (scheduler needs Numpy Integration)
scheduler_classes = (ScoreSdeVeScheduler,)
forward_default_kwargs = ... |
2b7c9cfa0bd572a482172014d61bb6099b298a3a9874e7d9a939104120ee675b | Python | 7,020 | 171 | """Provide the functions for non-equilibrium switching."""
import os
import pickle
import random
from typing import Tuple
import numpy as np
from mdtraj import Trajectory
from openmm import unit
from openmm.app import Simulation
from tqdm import tqdm
from endstate_correction.constant import temperature
from endstate_... |
2f0c98d5559c5e9a2ca083d3aecc0eeda4f9f4a4b58e173b82ef23ab81a71fd9 | Python | 7,021 | 172 | import os
rdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
import sys
sys.path.append(rdir)
from settings import RESULTS_DIR
from helpers.path_helpers import local_results_file
import scipy.stats as ss
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
nboots = 1000 # for sig te... |
b4df0a91d4713bf64cd7308215a37adf21d141cd79f27cee3f41d2c504a2723d | Python | 7,021 | 235 | import numpy as np
import warnings
def pca(X, no_dims, use_gpu=True, verbose=False):
"""
This function performs PCA embedding.
Now supports GPU acceleration via MLX (Apple Silicon) or torch_pca (CUDA).
Parameters
----------
X : array-like
N by D matrix. Each row in X repre... |
a1104dd7f77a451cbbfa90a09ae67bd1e73b541c923c66e40a235796ea8e8415 | Python | 7,023 | 184 | import logging
import os
import subprocess
import sys
import time
from typing import Optional
import ray
from ray._common.network_utils import build_address
from ray._common.ray_constants import (
LOGGING_ROTATE_BACKUP_COUNT,
LOGGING_ROTATE_BYTES,
)
from ray._common.utils import env_integer, try_to_create_dire... |
3096ab385578a8ca2bffe720d04e49304d48da4a22eaa62fbd3ec5155dadc035 | Python | 7,025 | 202 | #!/usr/bin/env python3
"""Post-process Sphinx linkcheck output into a confirmed-broken link report.
The ``doc: linkcheck`` step runs ``make -C doc linkcheck_all``, which writes a
machine-readable ``output.json`` (one JSON record per line). That step is
``soft_fail``, so a broken link never fails the build. This script... |
8679a59f6f0abd2c66cecbe1aa0f01f490d7a4c93e3c0c38541833d2a58f20b5 | Python | 7,025 | 177 | """
Summary of active vs. passive delta dprime for each target pair
category
"""
import os
rdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
import sys
sys.path.append(rdir)
from settings import RESULTS_DIR
from helpers.path_helpers import local_results_file
import pandas as pd
import numpy as np
impo... |
a680c167a6e98e9f58522be5a4f80ee43bebc6b8094f05021c251c5d215e78f3 | Python | 7,025 | 219 | import os
import sys
from typing import List
import pytest
from ray.autoscaler._private.prom_metrics import AutoscalerPrometheusMetrics
from ray.autoscaler.v2.instance_manager.config import NodeTypeConfig
from ray.autoscaler.v2.metrics_reporter import AutoscalerMetricsReporter
from ray.autoscaler.v2.tests.util import... |
ab8c4f737c67f81c4549c9a398abc2e03a84ba4519f670f3cc7d65d7a46ed131 | Python | 7,025 | 160 | import numpy as np
import networkx as nx
import copy
prs = ["2.0", "4.0", "4.5", "5.0", "5.5", "6.0", "7.0", "8.0", "10.0", "15.0", "20.0", "22.0", "24.0", "25..0", "26.0", "26.5", "26.5-2", "27.0", "28.0", "28.0-2", "29.0", "30.0", "32.0"]
ntraj = 200
ring_min = 3
ring_max = 10
for ps in prs:
count = 0
for ... |
e83cea82c6b11c57526b554286e934c8885f2fe84c7a491dbe14faae8054f1cd | Python | 7,027 | 206 | # encoding: utf-8
"""
This module provides an object oriented interface for pattern matching
of files.
"""
from . import util
from .compat import Collection, iterkeys, izip_longest, string_types, unicode
class PathSpec(object):
"""
The :class:`PathSpec` class is a wrapper around a list of compiled
:class:`.Patter... |
4b54358da12d068799d8df2cbd3f86cd1da4d85cfecbb2d034b766721f12de9a | Python | 7,033 | 214 | from types import SimpleNamespace
import networkx as nx
import numpy as np
import pytest
from lib.surface import (
TERMINAL_ORDERS,
assign_boundary_terminals as assign_with_info,
get_boundary_loop,
)
def assign_boundary_terminals(*args, **kwargs):
labels, _ = assign_with_info(*args, **kwargs)
ret... |
e57d7d9e07109cbb03784356d2c890393e9836a57d976007679a6ea0f0cd1727 | Python | 7,034 | 89 | """ File processing procedure / Processus de traitement des fichiers """
import os
import sys
import colorama
import numpy as np
import pandas as pd
from libs.drawing import draw_bloc
from libs.signal_processing import apply_filters, get_epochs, get_power, get_trials
from libs.signal_processing import parse_EDF, chec... |
55698ee3129c0e19e1586c1065e3afc410b1e3d000db673938a6a6fbe20b14ed | Python | 7,036 | 232 | import random
from tkinter import W
import brainrender as b
import numpy as np
from brainrender.actors import Point
from brainrender import _utils
#Find cell coordinates
import csv as c
file = open("CN_neuron_coordinates_allcells.csv")
csvreader = c.reader(file)
# Skip first line to get to get to data
next(csvreade... |
a8896c7d6cf62c9715a32efddc3bfcce1f9e1d7fdf2b756fd8a76bf9c8461067 | Python | 7,037 | 218 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard imports
import time
import joblib
from pathlib import Path
# Third-party imports
import numpy as np
import pandas as pd
from sklearn import model_selection
# Intern... |
e0e86e85da56d9a11ca1202fc21ea4dc0ff516f08aa8335eefa6fb437a62806e | Python | 7,037 | 191 | # Source: https://github.com/ndrplz/ConvLSTM_pytorch
import torch.nn as nn
import torch
class ConvLSTM2DCell(nn.Module):
def __init__(self, input_dim, hidden_dim, kernel_size, bias):
"""
Initialize ConvLSTM cell.
Parameters
----------
input_dim: int
Number of ... |
afbbc09aa3ef02ae7ae143acaba55ec91c9c1c30c9db0e005a35971c2e0264ea | Python | 7,038 | 256 | """Mouse Phenome Database API client."""
from typing import Dict, List, Optional, Any
import requests
from ..base import BaseAPIClient
class MPDClient(BaseAPIClient):
"""Client for Mouse Phenome Database API."""
def __init__(self):
super().__init__(
base_url="https://phenome.jax.org"... |
f81b059c9c0fd6e86347e3f9fbf651456b5e855938e6029c46803ab9d31c9386 | Python | 7,038 | 204 | _base_ = [
'../_base_/datasets/rtts_coco.py', '../_base_/schedules/schedule_1x.py',
'../_base_/default_runtime.py'
]
# model settings
model = dict(
type='CascadeRCNN',
data_preprocessor=dict(
type='DetDataPreprocessor',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375]... |
a878708d13426308c609eb49a0a796b131c2cabd999d59d47ce0c76165e5d3ff | Python | 7,041 | 261 | #!/usr/bin/env python
"""Benchmark ASCII STL read with and without speedups.
Downloads the Stanford Dragon PLY model on first run,
converts to ASCII STL, then times reads.
Usage:
python benchmarks/benchmark_ascii_read.py
python benchmarks/benchmark_ascii_read.py --iterations 10
python benchmarks/benchmark... |
2e23d74f09e056600805f5449efe342e2102e0c5ea971488c5c583bf2824c1ec | Python | 7,043 | 193 | import time
import logging
from datetime import date
import re
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
from agent.data.entities.config import ROOT_LOGGER_ID
from agent.crawlers.twitter_crawler import get_tweets
from agent.crawlers.utils.scraping_utils import get_paragraphs
from agent.crawl... |
422be82ce6e5bbf88bcb30e3ec73e5f800fa5b14fb116c7f617480e6f7e7bd05 | Python | 7,045 | 204 | _base_ = [
'../_base_/datasets/duo_coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
# model settings
model = dict(
type='CascadeRCNN',
data_preprocessor=dict(
type='DetDataPreprocessor',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12... |
521245c33c0bead4d81f5c82872ace79677ceac5f3adf4571378d7a1b17d9303 | Python | 7,047 | 126 | import zipfile
from nnunetv2.utilities.checkpoints import resolve_checkpoint_file
from nnunetv2.utilities.file_path_utilities import *
def export_pretrained_model(dataset_name_or_id: Union[int, str], output_file: str,
configurations: Tuple[str] = ("2d", "3d_lowres", "3d_fullres", "3d_casc... |
84803723bd124bfa72acb8ddac1765b8940394815b17b90fb76766662978e3bb | Python | 7,051 | 195 | """Concrete ``DataSourceV2`` for ORC files."""
from __future__ import annotations
import copy
from typing import TYPE_CHECKING, List, Literal, Optional, Union
import pyarrow as pa
from typing_extensions import override
from ray.data._internal.datasource_v2.common.file_reader import FileFormat
from ray.data._interna... |
ab1a06973ad77f50813690e1023514ee639497e98b31918edb14c078c22b265f | Python | 7,051 | 204 | _base_ = [
'../_base_/datasets/ruod_coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
# model settings
model = dict(
type='CascadeRCNN',
data_preprocessor=dict(
type='DetDataPreprocessor',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.1... |
3d99cccc421da60d5d231e0eef624a53f3baa4c77776a37b8e568fb5bfc11303 | Python | 7,053 | 222 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# various utility functions
# pylint: skip-file
# type: ignore
import os
import random
import numpy as np
import torch
import torch.nn.functional as F
import t... |
d787fa32444a7789fcada35c955d5a608085d44e28500c51bdf37a59d9f9bf8d | Python | 7,053 | 198 | # Copyright 2021 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... |
85a1cb1e48af30cb4f830381e0dbdb8d48ece84be7de0e3d52f2150b566f01e7 | Python | 7,055 | 201 | # Modified from https://github.com/Li-Chongyi/Zero-DCE/blob/master/Zero-DCE_code/model.py # noqa
# This work is licensed under Attribution-NonCommercial 4.0 International License. # noqa
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmengine.model import BaseM... |
fe6f9ee7da14de9df0f4e824ae9f6480c93b9d9af6754571d04fe5743e8d240e | Python | 7,059 | 241 | # **************************************************************************
# *
# * Authors: J. M. de la Rosa Trevin (delarosatrevin@gmail.com)
# *
# * 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 Fo... |
5e0b93c65cdacd7fad3d01e89df1d8ce8b67282a259524172f8bbf9b98aaee59 | Python | 7,061 | 166 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
c513074e59b83f8c63ee2c716275c82c18804ec8f94e50ddae190d0e55ef0d6f | Python | 7,062 | 156 | __author__ = "Simon Andermatt"
__copyright__ = "Copyright (C) 2017 Simon Andermatt"
import numpy as np
from mdgru.helper import argget, compile_arguments
from mdgru.model_pytorch.mdrnn import MDGRUBlock
from mdgru.model_pytorch.mdrnn.mdgru import MDRNN
from mdgru.helper import collect_parameters, define_arguments
fro... |
9b6a428a7000e3a7d36567b1d1031931a51eaebbe51046d1cacf460cf09d49ee | Python | 7,065 | 194 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
seaborn version: 0.11.0
matplotlib version: 3.6.3
numpy version: 1.23.3
nibabel version: 4.0.2
"""
#%% Import Modules
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from mpl_too... |
3e5197f58dc91ee560705d5fe78a0653bc8c184dd0ff10ebcfa311b039cc66ef | Python | 7,066 | 222 | import os
import os.path as osp
import warnings
from math import pi as PI
import ase
import numpy as np
import torch
import torch.nn.functional as F
from torch.nn import Embedding, Linear, ModuleList, Sequential
from torch_geometric.data.makedirs import makedirs
from torch_geometric.nn import MessagePassing, radius_gr... |
79e19463950e4f71eb9cde1245dc66c6543bced961d55ede55ffff3593a348a6 | Python | 7,066 | 153 | """
Helper script to convert the output of training/cc_training_data.py (train.pkl: labelled model inputs with their candidate
sets; pretrain/<project>.pkl: unlabelled ones) into CandyCrunch-ready training pickles: X/y tuples for training_script.py,
per-sample candidate masks and the pretraining inputs. Adjust the pat... |
6e97ffaeab3cef0f5fd4d7b9535b4def2d0234dbc9fc21346a4c790b03d6d7eb | Python | 7,067 | 209 | # built-in dependencies
import os
import json
# 3rd party dependencies
import numpy as np
import pandas as pd
import pytest
from deepface import DeepFace
# project dependencies
from deepface.commons.logger import Logger
from deepface.modules.database.weaviate import WeaviateClient
weaviate = pytest.importorskip("wea... |
7233a8ba0f3b008d9ee8525e678c0c59f359d337f4e4592c93984aa087d9c4dc | Python | 7,068 | 283 |
import time
import numpy as np
from discontinuous_galerkin.base.base_model import BaseModel
from discontinuous_galerkin.start_up_routines.start_up_1D import StartUp1D
import matplotlib.pyplot as plt
import pdb
import scipy.stats
from matplotlib.animation import FuncAnimation
import ray
class PipeflowEquations(Bas... |
5c9a0bc86fe50589a83527aacf1011307e23c40312b6f0b26dd12a8d826cdb13 | Python | 7,074 | 230 | import random
from tkinter import W
import brainrender as b
import numpy as np
from brainrender.actors import Point
from brainrender import _utils
#Find cell coordinates
import csv as c
file = open("CN_neuron_coordinates_allcells.csv")
csvreader = c.reader(file)
# Skip first line to get to get to data
next(csvreade... |
49fd1e87ca7994b0de0d6c1e6d92f6c7db795af6e5d9b4845b54633bd3ad500e | Python | 7,076 | 193 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
seaborn version: 0.11.0
matplotlib version: 3.6.3
numpy version: 1.23.3
nibabel version: 4.0.2
"""
#%% Import Modules
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from mpl_too... |
04581f8afc442d5793497f730042dca0d068ce50b3db92dae2bb030eab9add12 | Python | 7,078 | 166 | """Real droplet-scRNA-seq datasets for the ``ov.pp.ambient`` tutorial.
Each loader downloads a dataset asset from the ``omicverse-data`` GitHub
release (``ambient-v1``) on first use, caches it under ``dir``, and
returns it ready for the ``ov.pp.ambient`` ambient / contamination-RNA
removal workflow (SoupX / DecontX / ... |
17f771ca1b44afc306c3ba1aa83d91e8666206e2a292f1e8c55beb930248a700 | Python | 7,078 | 235 | # coding=utf-8
import io
import re
from collections import defaultdict
from itertools import chain
from typing import List, Optional, Type, Union
class Feature:
"""
A class of genomic features defined by a half-open interval. Locations are 0-based.
"""
DUMMY_NAME = "."
@staticmethod
def ... |
971c7d453a0c5b58ceff618d005fae5fdee69fccfdc2f25065f66d7554bad120 | Python | 7,078 | 177 | r"""Dynamic FBA — time-resolved fermentation from a genome-scale model.
Flux Balance Analysis gives a single steady-state snapshot; **dynamic FBA**
(dFBA, the *static-optimisation* approach of Mahadevan *et al.* 2002) turns it
into a batch-fermentation time course. At each time step the substrate uptake
bound is set f... |
a03a13162725beca7eda548c7f5e29667f210d69dcd72e9bc0c6d23dbebf7e8c | Python | 7,078 | 165 | import numpy as np
import scipy.special as sp_spec
# Parameters import: DIFFERENT FROM THE OTHER --> IMPORT ALSO FITTED P!
def pseq_params(params):
if 'P' in params.keys():
P = params['P']
else: # no correction
P = [-45e-3]
for i in range(1,11):
P.append(0)
return para... |
acfcf6eeadd9f2fbeba9a18e4e27b6912288f57f22e5f47b3d957fad0e114583 | Python | 7,078 | 137 | import CLEAR_settings
import numpy as np
import matplotlib.pyplot as plt
from skimage.measure import label, regionprops
from PIL import Image
from skimage import measure
from rectpack import newPacker
from shapely.geometry.polygon import LinearRing
from shapely.geometry import Polygon
from PIL import Image, Im... |
a8a2bbd9986fb13596484d008e3898bd9e1bb07da61f5d14de294b26823c1da0 | Python | 7,080 | 236 | # -*- coding: utf-8 -*-
import numpy as np
import sys
import abc
from .figure_manager import reset_camera, scf, gcf
from vtkplotlib._get_vtk import vtk
from vtkplotlib import _vtk_errors, nuts_and_bolts
def abstract_property(func):
return property(abc.abstractmethod(func))
def _abc_assert_not_abstract_method(... |
3593fe87995368969b51d4a3a316216b2430baedebb8bfe33e1bdd4e5b40a02a | Python | 7,082 | 158 | """
Format longitudinal clinical data.
Input:
patient_info.csv
feature_dictionary.csv
data.csv
patient_visit_info.csv
Output:
Feature matrices (column: feature, row: visit) of patients
* Of note: features are continuous value
"""
import pandas as pd
import numpy as np
fro... |
246dcc7bc4de8f1792bbddf15fbe5dd1514c4a814808dc6359d6689d1f437fc8 | Python | 7,083 | 246 | from django.core.cache import cache
from infer.tasks import rapppid, intrepppid
from infer.models import ProteomeTask, ProteomeResult, ProteomeResultStats, get_all_task_result
from infer import models
import sentencepiece as sp
import numpy as np
from torch import nn
import random
import os
import json
import torch
f... |
ee6669655f579426adbf9b883242cde6d40888329c98a97205c4c036f416cfe1 | Python | 7,083 | 127 | import pathlib
path = pathlib.Path.cwd()
if path.stem == 'tmb_survival':
cwd = path
else:
cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')]
import sys
sys.path.append(str(cwd))
from model import utils
from matplotlib import pyplot as plt
from lifelines import CoxPHFitter
import numpy as np
import... |
df3a13d6b03ca2c06a94f1c5f7cae49abf7cc2583dcce1db1c24ca93b445c7fb | Python | 7,084 | 239 | import numpy as np
import matplotlib.pyplot as plt
import pickle
import matplotlib as mpl
import matplotlib.colors as mcol
import settings
import os
from utils.utils import colorline
from utils.grid_funcs import traj
from numba import jit
from tqdm import tqdm
from Produce_mainfigure_summary import compute_total_from_f... |
760b49216c7dff8918e6058dd1c2d48042aa3742fc6ede3ee480d950be07780f | Python | 7,085 | 243 | from sys import stderr
from contextlib import contextmanager
from scipy import sparse
import numpy as np
from collections import defaultdict, OrderedDict
def ragged_array_to_sparse_matrix(indices, values, col_length):
return sparse.hstack([
sparse.csc_matrix(
(val_column,
(index_col... |
4e54db0fd5ace09f05e1e448394ff01be97ef025fcf84079b7561059f29df372 | Python | 7,090 | 211 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 07 17:48:00 2019
@author: ju-bar
Linear least square algorithms.
This code is part of the 'emilys' repository
https://github.com/ju-bar/emilys
published under the GNU General Publishing License, version 3
"""
import numpy as np
import numba as nb
@nb.njit(nb.int32(nb.... |
9d6d74735a9a6947e543c6ad29d57ba56022d75c20868d2f72d6a03596f38bef | Python | 7,092 | 224 | import sys
import pytest
from ray._raylet import JobID, TaskID
from ray.core.generated.common_pb2 import (
FunctionDescriptor,
Language,
TaskAttempt,
TaskStatus,
TaskType,
)
from ray.core.generated.events_actor_task_definition_event_pb2 import (
ActorTaskDefinitionEvent,
)
from ray.core.genera... |
355b0899fbd25cafbde5f744a14df33754daf5e022c33c3d71b672edb6a9494e | Python | 7,095 | 190 | import argparse
import datetime
import pickle
import sys
import time
import numpy as np
import os
import pandas as pd
from torch.utils.data import DataLoader, Dataset
from torchnet import meter
import torch
from sklearn.model_selection import train_test_split
from model_prefeature import AIMP
from prep... |
7007204524d97f50944e35a72f5a8fd01eabb98af0a32cdaf9bfa319be11eb91 | Python | 7,095 | 175 | """Lightweight source verification and quality scoring utilities.
This module provides heuristics to score and optionally verify references.
Network checks are disabled by default; enable with OV_DR_VERIFY_NETWORK=1.
"""
from __future__ import annotations
from typing import Dict, Iterable, List
import os
import re
... |
8f1bc76139a3c837ab1c56e4fc867eb80bd7c6551f7a16ae1d9bed0792dc6b32 | Python | 7,095 | 228 | from __future__ import annotations
import json
import os
from dataclasses import asdict, dataclass, field
from anndata import AnnData
from huggingface_hub import ModelCard, ModelCardData
from ._template import (
template,
)
@dataclass
class HubMetadata:
"""Encapsulates the required metadata for `popV` hub ... |
de503bbc2ee6c67170d296e6dd20c78b52e371560cfc58fb57c0b5f01b714bc4 | Python | 7,095 | 155 | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class SegNet(nn.Module):
def __init__(self,output_c = 1):
super(SegNet, self).__init__()
batchNorm_momentum = 0.1
self.output_c = output_c
self.conv11 = nn.Conv2d(3, 64, kernel_si... |
da3acefb18cd43f82717d77e031a2755242d2e1f0cc163581e0788bd3db7b9fc | Python | 7,096 | 202 | #!/usr/bin/python
import subprocess
import os
import re
# The directory where the final results will be print to
portal_directory = '/gpfs/bbp.cscs.ch/project/proj83/visualization-SSCXDIS-178/portal/trial-3-06.03.2021'
# The synaptic pathways directory
root_synaptic_pathways_directory = '/gpfs/bbp.cscs.ch/project/pr... |
65cafcbbd7fdf480d5314a680cec4ff1ec48565ff340af6c3a136eecbc19b7ec | Python | 7,099 | 202 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Implementation of SFNet ResNet series.
# Author: Xiangtai(lxt@pku.edu.cn)
# Date: 2020/7/1
import torch.nn as nn
import torch
from network.nn.operators import AlignedModule, PSPModule
from network import resnet_d as Resnet_Deep
from network.nn.mynn import Norm2d, Upsampl... |
d7e85465d02e34b8a70e6ed6625a7ec89a565fdbe57e23c0114a91a24fe5dbc7 | Python | 7,100 | 248 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Triton kernel wrappers using torch.library.triton_op.
These wrappers make kernels visible to torch.compile while keeping
tensor allocation vis... |
043a40a7fc240ee0605de3cb0cf21119e00e64d4eeb35c2798581a050c796414 | Python | 7,106 | 176 | import sys
from parameters import ParameterSet
from mozaik.models import Model
from mozaik.connectors.meta_connectors import GaborConnector
from mozaik.connectors.modular import (
ModularSamplingProbabilisticConnector,
ModularSamplingProbabilisticConnectorAnnotationSamplesCount,
)
from mozaik import load_compon... |
e1d8d4f70e4d2a5fc8cd986569914425691d7299086e16c7d0c41636218af117 | Python | 7,107 | 152 | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
import random
import os
def main():
# for TOOL in ["SPLAM", "SPLICEAI"]:
COLORS = ["#2ca02c", "#ff7f0e"]
TOOLS = ["splam", "SpliceAI"]#, "SpliceAI-10k-Ns"]
TARGETS = ["Donor", "Acceptor"]
output_files = ["p... |
16b9c18c50784b09a2526a8a3d7705cea81eac58530123f23335b770275c5ef8 | Python | 7,110 | 202 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""aihwkit example 32: weight programming options
Showcases four different weight programming options:
1. SinglePairConductanceConverter - conventional mod... |
d6b17a78d70128c34aa8d963677df432caab7c0376e3fe123f773ac3702d84a7 | Python | 7,111 | 162 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Functions to convert a given model to a quantized counterpart"""
from copy import deepcopy
from torch.nn import Module, Linear, Conv2d
from aihwkit.nn.conv... |
bdc49426c86612a943183e3cdc4ce4daa800fc4f10b092ccc718e44aebc9aaf5 | Python | 7,112 | 201 | from bwa.bwa import BWAMem, index_ref, which_bwa, compile_refs
from ngs_mapper.data import reads_by_plat
from ngs_mapper.reads import compile_reads
import ngs_mapper.bam
import os
import sys
from os.path import *
import log
import tempfile
import shutil
from subprocess import PIPE
logger = log.setup_logger(__name__, ... |
2674d607c4068bb12744f027ce0754639984c22c613e60cf954097a3c180fa97 | Python | 7,114 | 178 | # Copyright (c) 2017-present, Facebook, Inc.
#
# 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... |
59d89bbd342e067d3e545c8bfdeba842c3a6b1a3dcc5041f222809661fbe7906 | Python | 7,116 | 183 | r"""Known-drug / bioactivity lookup for :mod:`omicverse.mol`.
:func:`known_drugs` answers "does my omics target already have approved
drugs or bioactive compounds?" by querying **ChEMBL** — its
mechanism-of-action table (the clean "known drugs" set) and, optionally,
its broader bioactivity records.
"""
from __future_... |
a32d81204b5e75a24e834dda80ec5fded6f1bc5ab750fe9b3947d3862f059c6e | Python | 7,116 | 161 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
f1c0c44e5b3bc47fccab8c0a95ab952e5f6ee030d3f464cecba8771ca22cf090 | Python | 7,116 | 146 | import pandas as pd
from src.commons.process_dataframe import insert_new_col, insert_new_col_from_two_cols
from src.commons.process_number import cal_SEM
def get_percent_triplets(percentpairs):
if percentpairs == 1:
return 0
elif percentpairs == 0.5:
return 0.5
elif percentpairs == 0:
... |
6a669d47f70b9b1dc3b18dc3139a6516c0226fddf5455c5d4e24937c1d599038 | Python | 7,117 | 161 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
8264bdda30969f072e74d60c25a62f68803276a9dde4c36ffce938daf7cb1ff8 | Python | 7,119 | 209 |
# --------------------------------------------------------
# SimMIM
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Zhenda Xie
# --------------------------------------------------------
from functools import partial
import torch
import torch.nn as nn
import tor... |
75e4b3ceaf8a3bd86701447b63aeb3990fe23447f8717d9e508fad493c18ee09 | Python | 7,120 | 237 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""aihwkit example 27: Post-training input range calibration.
NOTE: You need to run example 25 first and save the model to RESULTS (see ex. 25).
"""
# pylint: d... |
e12c3681079c97ffd38fffc969034b518f6b67c7238169a4f97a804a7264099d | Python | 7,120 | 195 | """Preprocessing for single-extracellular-vesicle (single-EV) proteomics.
Single-EV proteomics produces an EV x protein matrix (vesicle ~ cell, protein
marker ~ gene). The standard single-cell stack transfers, but the
normalization step must branch on the *value type* of the assay:
* ``count`` — PBA / DBS-Pro seq... |
f614dcd655c209f5f4b412d77abb9313409dbdeb8dea798fe46fb74d028cc77f | Python | 7,120 | 244 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import torch
# =============================================================================
# Constan... |
82df162c61d8b2b480867ccc7e2546acf4ee5a982636cdcb75978fcce31f7d1c | Python | 7,123 | 189 | r"""
This module contains various utility functions often useb by analysis code.
"""
import numpy
import quantities as qt
import mozaik
import mozaik.tools.units as munits
from mozaik.controller import Global
from mozaik.storage.queries import *
from mozaik.tools.mozaik_parametrized import *
from neo import AnalogSign... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.