sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
062d4f72e3c9d6a0c39c39c635c89259aec4f6814c3bdb4fdf343e2d298d6098 | Python | 6,840 | 159 | import argparse
import mrcfile
import sys
import torch
import numpy as np
from pathlib import Path
from skimage.transform import downscale_local_mean
from time import time
from typing import Optional
from numpy.typing import NDArray
from .ode_net import ODENet
from .particles import particles
from .gridding import Grid... |
33f5aa13fdfc89b96b3c78771f4eee96bf1c8f645b78fc53e5d6a5efa0524e1d | Python | 6,840 | 184 | """
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 argparse
import contextlib
import logging
import os
import tempfile
from pathlib import Path
fro... |
213383be2d6480706e9c0abd2b829a0a12a900a74af8eb92e52539d6c2ba2bc6 | Python | 6,843 | 227 | from pathlib import Path
import pandas as pd
import numpy as np
from collections import defaultdict
import random
from scipy.stats import multivariate_normal
from scipy.stats import wasserstein_distance
from scipy.stats import pearsonr
import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mat... |
b7daf37c26a38b59828776330df1ae6db50fddb0710e925e649b86aa875bff51 | Python | 6,843 | 175 | #!/usr/bin/env python
#!/usr/local/bin/python
from __future__ import print_function
import numpy as np
import tensorflow as tf
import speech_data
from speech_data import Source, Target
from tensorflow.python.ops import ctc_ops as ctc
# import layer
# from layer import net
import time
start = int(time.time())
display_s... |
116e9a261f8c3290ce14238bf4a2a233f4948943b6e7cdef743dc1b2a6268ea8 | Python | 6,844 | 145 | r"""
Molecular structure & drug-binding analysis for omicverse.
``ov.mol`` is the bridge from an omics result — a differential gene from
``ov.bulk``, a marker from ``ov.single``, a variant from ``ov.genetics`` —
to the **3D structure** of the target protein and its **drug context**:
*what does the target look like, an... |
12fd915e32f5fc1df5500025ef673bec5b7fb83dc03f86479697f22b7f96a609 | Python | 6,845 | 195 | #!/usr/bin/env python
# HiC-Pro
# Copyleft 2015 Institut Curie
# Author(s): Nelle Varoquaux, Nicolas Servant
# Contact: nicolas.servant@curie.fr
# This software is distributed without any guarantee under the terms of the
# GNU General
# Public License, either Version 2, June 1991 or Version 3, June 2007.
"""
Script t... |
1a8f69750e1923cbfb3b62d3a4797d07e4062072a8db8dfaf4c32f14bb5801bc | Python | 6,849 | 226 | """A training script of DDPG on OpenAI Gym Mujoco environments.
This script follows the settings of http://arxiv.org/abs/1802.09477 as much
as possible.
"""
import argparse
import logging
import sys
import gym
import gym.wrappers
import numpy as np
import torch
from torch import nn
import pfrl
from pfrl import expe... |
bf2004a8d4228ea7592244c8f57e7201586640dab9446f15ba9d92fdc251e2e7 | Python | 6,849 | 195 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
4093200f6964dd0cfdcaf339758277d153e6714728b821336ed0422e10311443 | Python | 6,850 | 177 | # Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
b7d7dff2330c6ee57df3af6e8ee8fd32abf8e59945962fbc9aa467e978e88ce4 | Python | 6,852 | 215 | import argparse
import os
import time
import numpy as np
import matplotlib.pyplot as plt
from zernike import RZern
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import pdb
import random
import numpy as np
import scipy
imp... |
9706f655d2a10d8cb84f3819bb03205568a48482f83cd4985ab7ec33265a6cff | Python | 6,854 | 193 | from typing import Any, Literal, Optional
import matplotlib.pyplot as plt
from flyvis.utils.activity_utils import LayerActivity
from ..visualization.network_fig import WholeNetworkFigure
from .animations import Animation
from .hexflow import HexFlow
from .hexscatter import HexScatter
from .imshow import Imshow
__al... |
2278360f29b382ba27a54db94d2b4c094669fd73e3d888728cf260690c0e007a | Python | 6,855 | 205 | # built-in dependencies
from typing import Any, List, Union, cast
# 3rd party dependencies
from numpy.typing import NDArray
import torch
from torch import nn, Tensor
# project dependencies
from deepface.commons import weight_utils
from deepface.modules import verification
from deepface.models.facial_recognition.pytor... |
52778a37704a804b693b7dd52db06343fa609f7de7151dc6763a0dfa54dbb86c | Python | 6,856 | 210 | """Only internally created registration clients are closed, including on errors."""
from copy import deepcopy
import numpy as np
import pytest
from deepface.modules import datastore
class RegistrationError(RuntimeError):
pass
class MemoryDatabase:
def __init__(self):
self.closed = 0
self.in... |
cdc625a62f27e34565003de76a3fd8484ebdc27a802a6bf59beba8d670d35bb4 | Python | 6,856 | 225 | import os
import tempfile
import numpy as np
import pytest
import torch
from torch import nn
import pfrl
from pfrl.envs.abc import ABC
from pfrl.experiments import (
train_agent_batch_with_evaluation,
train_agent_with_evaluation,
)
from pfrl.experiments.evaluator import (
batch_run_evaluation_episodes,
... |
44ce7e30ed9c0afb6ccd0d933ae1baa664c07ab2ccb26bf7080a7c352c688664 | Python | 6,858 | 177 | ####################################################################################################
# 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... |
bb839403c3211575839b328d090324f8293968583270594acda31cc57ead23b3 | Python | 6,858 | 167 | import torch
import random
import numpy as np
import pandas as pd
from tqdm import tqdm
from torch.optim import Adam
import torch.nn.functional as F
from torch.utils.data import DataLoader
from .model import simdatset, AutoEncoder, device
from .utils import showloss
def reproducibility(seed=1):
torch.manual_seed(... |
727d2e86cc03280828267fd54ec991c60f47041cc0fc1911bd6b9859cfd74c76 | Python | 6,864 | 163 | #!/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
"""
#%% Import Modules
import pandas as pd
import seaborn as sns
import matplotlib.pylab as plt
import warnings
import matplotlib as mpl
warnings.filterwarnings("ignore")
#... |
2c90b1da774cc35699d89beb1cdfca9036099a0eba4e492101a85da163330540 | Python | 6,869 | 209 | import unittest
from lisa.core import genome_tools
import numpy as np
class TestRegionObject(unittest.TestCase):
def test_invalid_region(self):
with self.assertRaises(AssertionError):
genome_tools.Region('chr1',10, 5)
def test_overlap_different_chr(self):
self.assertFalse(
... |
6dbd40d887a92423bd7989edde880dd945a5d688160b5fe81aeeb6e97881eeb9 | Python | 6,870 | 240 | """Electron Microscopy Data Bank API client."""
from typing import Dict, List, Optional, Any
from .base import BaseAPIClient
class EMDBClient(BaseAPIClient):
"""Client for EMDB API - 3D electron microscopy structures."""
def __init__(self):
super().__init__(
base_url="https://www.ebi... |
f1efc4f6bb7d73f348511cba001dc0a388763b5a9c81f119af2da71d063d20bd | Python | 6,872 | 201 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import pickle
import lmdb
import pandas as pd
import numpy as np
from rdkit import Chem
from tqdm import tqdm
from rdkit.Chem import AllChem
from rdkit.Ch... |
2a1f90767ae478adb18b790cc00987929c93258680f571877480a71e99900229 | Python | 6,873 | 211 | import numpy as np
import scipy.stats as stats
import sys
import scipy.spatial as SS
import math
import seaborn as sns
import matplotlib.pyplot as plt
from ..core.gp_utils import covar_to_corr
def simulate_data(
N=200,
seed=1234567,
views=["0", "1", "2", "3"],
D=[500, 200, 500, 200],
noise_level=1,... |
18a47f3210102776195c69cc62cdf0be2137135455d946cd61ef7690e6625ab7 | Python | 6,876 | 193 | from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import TYPE_CHECKING, List, Optional, Set, Tuple
from ray.data.expressions import Expr
from ray.util.annotations import DeveloperAPI
if TYPE_CHECKING:
from ray.data._internal.datasource_v2.interfaces.file_pruner import FilePruner
... |
3d360a02f465c325f98b5b580a2504cb3bd055ff6ae430b726671ee6c29fbcf0 | Python | 6,878 | 177 | import numpy as np
import torch
import torch.nn.functional as F
import sys
sys.setrecursionlimit(3000)
def find(vertex, parent):
if parent[vertex] != vertex:
parent[vertex] = find(parent[vertex], parent)
return parent[vertex]
def union(u, v, parent):
root_u = find(u, parent)
... |
c5c2be32eb61991823484aea34de82d17f05e6bd50360faa051d0c877c87d7f8 | Python | 6,879 | 184 | # from prs_comparison import get_burdens
import pickle
import pandas as pd
import sys
import os
import logging
from pathlib import Path
import click
import yaml
import zarr
import numpy as np
from prs_comparison import PHENOTYPE_MAPPING
logging.basicConfig(
format="[%(asctime)s] %(levelname)s:%(name)s: %(message)s... |
eeced7f54417bfc639337ace6a3e6d4600fc617b7b9c1562cde134f74b52d3ad | Python | 6,882 | 168 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
# from sklearn.model_selection import train_test_split
# from CNN_classifier import CNN_classifier
import json as simplejson
from t... |
347c6a6861e925863db23e9169a851ba8938a1bc61c2128176d5927d885c5608 | Python | 6,884 | 230 | import socket
import os
import sys
if sys.platform == 'linux':
CODE_DIR = '/home/kelarion/github/'
SAVE_DIR = '/mnt/c/Users/mmall/Documents/uni/columbia/assignment_errors/'
else:
CODE_DIR = 'C:/Users/mmall/Documents/github/'
SAVE_DIR = 'C:/Users/mmall/Documents/uni/columbia/assignment_errors/'
import ... |
acac8c24610dcc7db742497f8ebe6168a8bfed4de5080735b55f09568e6ec108 | Python | 6,885 | 155 | # Ultralytics YOLO 🚀, GPL-3.0 license
from copy import copy
import torch
import torch.nn.functional as F
from ultralytics.nn.tasks import SegmentationModel
from ultralytics.yolo import v8
from ultralytics.yolo.utils import DEFAULT_CFG, RANK
from ultralytics.yolo.utils.ops import crop_mask, xyxy2xywh
from ultralytics... |
17b08f7c8575f2cf726a244584b723cc394a4db66bbf9ca21f039a9c5f1798be | Python | 6,886 | 223 | # 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... |
aaf1557df0bbdea1b5899fc3028c644ade96653a82fb97c4ac4d821c8a1d3a75 | Python | 6,886 | 190 | """
a shortcut for predicting the context
"""
from sklearn.neighbors import RadiusNeighborsClassifier
# from sklearn.neighbors import NearestNeighbors
from collections import Counter
import numpy as np
import warnings
warnings.filterwarnings("ignore", message="Outlier label -1 is not in training classes.")
NULL_RESPONS... |
089db21f5140aefcee4f3c2b089bc78c74ebf733d1a37640d1e7a80647f90dc1 | Python | 6,887 | 147 | import numpy as np
import matplotlib.pyplot as plt
import os
import utils
import pandas as pd
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.serif'] = ['Times New Roman'] + plt.rcParams['font.serif']
plt.rcParams.update({'font.size':15})
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(10, 8))
plt.subplot... |
7f76300df00f220cd11f1ae11e7127d51d7379cf227cf260a70eebcd76a1015a | Python | 6,887 | 230 | # built-in dependencies
import traceback
from typing import Optional, Union, Dict, Any, Tuple, List
# 3rd party dependencies
import numpy as np
from numpy.typing import NDArray
# project dependencies
from deepface import DeepFace
from deepface.commons.logger import Logger
logger = Logger()
# pylint: disable=broad-... |
96849e7672095d922447b51e13682b4692827b9eabf5855b7e41d45c17aadfa9 | Python | 6,891 | 165 | # Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
# and Applied Computer Vision Lab, Helmholtz Imaging Platform
#
# 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 L... |
ebcc9cb8a5eb0b7b54916b4f2ee91218abf0e7f4ec6a251b8b1dc047f750ef25 | Python | 6,891 | 157 | ####################################################################################################
# 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 library is fre... |
2a07f7a83d6ac12ea4c62322e83742df5db64d26d720b3e9c6c1ed8a9e505bd2 | Python | 6,893 | 191 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Phenomenological noise model for inference."""
from copy import deepcopy
from typing import List, Optional
from numpy import log as numpy_log
from numpy imp... |
4b22780a4e0f4ebf41c5619afe21723641fe16af7caae5c9c69c047b20657345 | Python | 6,893 | 237 | from __future__ import print_function, unicode_literals, absolute_import, division
import os
import numpy as np
import json
import collections
from six.moves import range, zip, map, reduce, filter
import logging
try:
from pathlib import Path
Path().expanduser()
except (ImportError,AttributeError):
from pat... |
ca9d8fc8afb6e92f8e5a42e39efde5ef2df8febdc507a58d0bb444e091728a3d | Python | 6,894 | 202 | import os
import csv
import numpy as np
from PIL import Image
from matplotlib.image import imread
from torch.utils.data.dataset import Dataset
from utils import process_annotation
import torch
def ellipse_to_mask(a, b, theta, x0, y0, height, width):
# Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0
A = a ** 2 * np.sin(... |
ed5c734d0cf94d45a1483e24a51ede26fb617adb598032b8b25c96092b942285 | Python | 6,894 | 203 | """
Example for spikes_from_array_latency_code, here for computing the
cell-averaging constant false alarm rate algorithm from radar processing with
spiking neurons, short: spiking CA-CFAR.
The spikes_from_array_latency_code model creates one spike per element of an
array using the following latency code:
t = t_ma... |
f7277e0d8bb6fe1154c33ad432b799c4de2b542a9c1b2da354accbd4e3834d90 | Python | 6,894 | 172 | from collections import OrderedDict
import csv
from typing import List, Optional, Union
import numpy as np
from tqdm import tqdm
from .predict import predict
from GR_pKa.args import PredictArgs, TrainArgs
from GR_pKa.data import get_data, get_data_from_smiles, MoleculeDataLoader, MoleculeDataset
from GR_pKa.utils imp... |
1086e8529c217b1f1a5d258625b275b9f5c3e98057a4d74d3d7001a2d7cbbe64 | Python | 6,895 | 143 | import nipype.interfaces.ants as ants
import os
import re
from samri.pipelines.utils import TRANSFORM_PHASES
from samri.utilities import iter_collapse_by_path
def collapse_nifti(in_dir, out_dir,
**kwargs):
in_dir = os.path.abspath(os.path.expanduser(in_dir))
out_dir = os.path.abspath(os.path.expanduser(out_dir))
... |
43381577db767a136e511a8a201489ac718cfeffea67f767f38333c8c78dc14e | Python | 6,895 | 171 | import logging
from abc import ABC, abstractmethod
from dataclasses import asdict, dataclass, field, fields
from typing import Dict, Set
from ray._common.filters import CoreContextFilter
from ray._common.formatters import JSONFormatter, TextFormatter
from ray._common.logging_constants import LOGRECORD_STANDARD_ATTRS
f... |
247699f4ed271b8fd921e56679a5a842f3927e38db4056eee498fe416bc539ce | Python | 6,896 | 181 | '''
plot the results (averaged across subjects) from sim-poly.py
'''
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import os
from utils import pickle_load_dict
from stats import compute_stats
sns.set(style='white', palette='colorblind', context='poster')
model_names = ['The proposed model',... |
8a1101c1d0ebda2568b3e704de2143991b29b5d3ef1a5dd8982fc5ec003b8b50 | Python | 6,896 | 199 | # 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... |
d2639bff7c7b944a996b649886c5e85d554d93fe5a947a835ba9f3efec3aa7c2 | Python | 6,896 | 162 | #!/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
"""
#%% Import Modules
import pandas as pd
import seaborn as sns
import matplotlib.pylab as plt
import warnings
import matplotlib as mpl
warnings.filterwarnings("ignore")
... |
25ee14b16dee8f1c2bd7c50ef34acc9eae43069ed3a9b8c7929191425b4f7c88 | Python | 6,897 | 219 | import logging
from typing import Dict
import torch
from datamate import Namespace
from toolz import valmap
from torch.utils.data import DataLoader, sampler
from flyvis.connectome import ConnectomeFromAvgFilters
from flyvis.datasets.datasets import MultiTaskDataset
from flyvis.utils.class_utils import forward_subclas... |
44f634f085f5a6765518bfd7eda3a18f3125a50b0ba6349a49375f36f4ef03bc | Python | 6,898 | 197 | # 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... |
3b3ac42779447d81979f153de3d6d881c62f5389a7597d046fe63a6f5b55c6c6 | Python | 6,901 | 236 | #------------------------------------------------------------------------------
# Libraries
#------------------------------------------------------------------------------
import torch
import torch.nn as nn
from .base_model import BaseBackbone
#-----------------------------------------------------------------------... |
4122069af0c063533a35ed74ac7447e2e3f25e6e1fec90e62d282c328d66bccc | Python | 6,906 | 140 | import cv2
import numpy as np
import scipy.io as scio
def neighbor_label_list(i, j, label_matrix, binary_img, neighbor_hoods):
nb_label_list=[]
if neighbor_hoods == 'NEIGHBOR_HOODS_4':
if i > 0:
label_up = label_matrix[i-1, j].copy()
pixel_up = binary_img[i-1, j].copy()
... |
02e401f88275a140f1ee99e035ffc77990e33bfda34e79d85ff80e9472fefd34 | Python | 6,907 | 204 | """
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 pytest
import torch
from fairchem.core.common.parallelism.graph_partition import (
Partitio... |
ccf39f7805c3e0bd492395720404820fb775aa8d45ae8281a21ac8ffc8a61db1 | Python | 6,907 | 226 | """A training script of TD3 on OpenAI Gym Mujoco environments.
This script follows the settings of http://arxiv.org/abs/1802.09477 as much
as possible.
"""
import argparse
import logging
import sys
import gym
import gym.wrappers
import numpy as np
import torch
from torch import nn
import pfrl
from pfrl import exper... |
8f9895f58251821cc65d923c8990a50f9275b4db5d6c775a3b9bcc6eceef08f8 | Python | 6,909 | 181 | #
# Copyright (c) 2022, NVIDIA CORPORATION.
#
# 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 ... |
bb4b1815743ed846c15e751d1ed8f8d6b6420d07deda009624516b6f8a5eb8d4 | Python | 6,912 | 154 | from lisa.core.lisa_core import LISA_Core
from lisa.lisa_public_data.genes_test import FromGenes
from lisa.core.data_interface import PACKAGE_PATH, REQURED_DATASET_VERSION, INSTALL_PATH
from lisa.core.lisa_core import CONFIG_PATH as base_config_path
import numpy as np
from scipy import sparse
from lisa.core import geno... |
b36437b46d76240ccfe28c1b921b336240ce8022e8f0a82bf545ad3fbbfc7c15 | Python | 6,913 | 196 | from typing import List, Tuple
import ray
import ray._private.services as services
import ray._private.worker
from ray._common.network_utils import build_address
from ray._private.state import GlobalState
from ray._raylet import GcsClientOptions
from ray.core.generated import common_pb2
__all__ = ["global_gc"]
MAX_ME... |
a0a01e84daa2bd12d3cbee88f68c2dd8eac0f09bdb9fb94c129969b8b17ee544 | Python | 6,914 | 154 | from lisa.core.lisa_core import LISA_Core
from lisa.lisa_public_data.genes_test import FromGenes
from lisa.core.data_interface import PACKAGE_PATH, REQURED_DATASET_VERSION, INSTALL_PATH
from lisa.core.lisa_core import CONFIG_PATH as base_config_path
import numpy as np
from scipy import sparse
from lisa.core import geno... |
b2fd6e8ca206fc1f990fc32d2660e54ddc5314dbd063dda85d984b2ef0ac6a61 | Python | 6,915 | 166 | import numpy as np
from itertools import compress
import pandas as pd
import os
def norm_to_one(ref, pseudo_min):
ref_index = ref.index
ref_columns = ref.columns
ref = ref.to_numpy()
g = ref.shape[1]
phi = ref / np.sum(ref, axis = 1, keepdims=True) * (1 - pseudo_min * g) + pseudo_min
... |
0ff13e0e1a62e04420db885050ad58f8639032a8513d496cbac0a0735fdd18b5 | Python | 6,917 | 199 | # Copyright 2025 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, ... |
3a0ff4135ee0704efe7fdbe5981fbb337b474b1c7ed7218498ab0e670ce8686e | Python | 6,919 | 202 | ####################################################################################################
# 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... |
6fe0b5e8d125dd1566237083ce11c34c27c40170efb7d5f1f4e6e06b29ab015e | Python | 6,920 | 193 | import os
from datetime import datetime
from enum import Enum
from typing import Dict, List
from ci.ray_ci.configs import DEFAULT_ARCHITECTURE, DEFAULT_PYTHON_TAG_VERSION
from ci.ray_ci.linux_container import LinuxContainer
from ci.ray_ci.supported_images import (
get_architectures,
get_default,
get_platfo... |
50b11921f7fe16359bb30a29b391a642018131a521766b157e137a4d9b3ee4c5 | Python | 6,921 | 172 | from collections import defaultdict
from datetime import datetime
import os
import pandas as pd
from tqdm import tqdm
import csv
import utils
def get_user_dx_and_outcome(indir, patient_set, icd9_to_ccs, icd10_to_ccs, icd_to_ccw, coding, criterion, ND_code_pkl):
print('get_user_dx_and_outcome...')
user_dx = de... |
17280ce42d3c39172bba568bf9fe5fc6e4126e88333d819f2446187a9f8915fa | Python | 6,924 | 201 | import logging
import numpy as np
import torch
from einops import repeat
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from ntd.utils.kernels_and_diffusion_utils import generate_samples
log = logging.getLogger(__name__)
def conditional_ajile_imputation_experiment(
... |
8a28e602080c62d5c5accf25d6a020ae25780abc3cc7aa575208d1a8e097404b | Python | 6,925 | 159 | #from stable_diffusion.scripts.txt2img_custom import txt2img as sd
from glide import txt2img as gl
import json
import argparse
from multiprocessing import Manager
from multiprocessing.pool import Pool
from progress.bar import Bar
from tqdm import tqdm
from functools import partial
import os
#from pytorch_lightning impo... |
47f4e592bdc3706293a1ed3877af0a322e64458dcd74a8f137211dadc3740d3b | Python | 6,929 | 202 | """
From https://github.com/ehoogeboom/e3_diffusion_for_molecules/
"""
import logging
import os
import torch
import tarfile
from torch.nn.utils.rnn import pad_sequence
charge_dict = {"H": 1, "C": 6, "N": 7, "O": 8, "F": 9}
def split_dataset(data, split_idxs):
"""
Splits a dataset according to the indices gi... |
92c1a0ffb51a4773d519226bc2ddc228d1e200c395b325ec6e079e6185718c3f | Python | 6,929 | 145 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
# loading database file
LABEVENTS = pd.read_csv("/home/maruthikumar.mutnuri/physionet/files/mimiciii/data/LABEVENTS.csv.gz", sep = ',', compression = 'gzip',
... |
552c8f1e48a1b6b1e80499385ebb2177e01162901beee575306e7dadfba11ef3 | Python | 6,931 | 179 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 12:11:13 2020
@author: istone
Functions for initializing the parameters of a hidden Markov Model (\theta = {A,\phi,\pi}) or GLM-HMM (\theta = {A,w,\pi})
using different distributions. Can easily be extended to include support for custom distribu... |
ed2dcf994e4b1ad089dc310b3009ece484a9046ab2a6d759c1f9ed990fd57ce9 | Python | 6,931 | 138 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
6177a72d0b43eeb2e75f9dffce7136a4361f6636ad6ea7b4b00061559bb32c5b | Python | 6,933 | 139 | from mdgru.helper import define_arguments
__author__ = "Simon Andermatt"
__copyright__ = "Copyright (C) 2017 Simon Andermatt"
import logging
# logging.basicConfig(level=logging.INFO) #- this statement would cuas dupplicate logs
import os
import numpy as np
import sys
from mdgru.data.grid_collection import GridDataCol... |
ab286b18141baa5d0e82e39bca233b7e6e3193292fe87962780dbfcd2f9554be | Python | 6,933 | 170 | import torch
class PretrainGAT(torch.nn.Module):
def __init__(self, node_dim, n_head, pair_dim):
super().__init__()
self.node_dim = node_dim
self.n_head = n_head
self.head_dim = node_dim // n_head
# * to alpha
self.query = torch.nn.Linear(node_dim, self.head_dim ... |
0e458c33104e7be55ccccff813b68cdf8e2e3911d027dd6fde19f22e44dfc4fe | Python | 6,935 | 171 | import sys
import torch
class PretrainGAT(torch.nn.Module):
def __init__(self, node_dim, n_head, pair_dim):
super().__init__()
self.node_dim = node_dim
self.n_head = n_head
self.head_dim = node_dim // n_head
# * to alpha
self.query = torch.nn.Linear(node_dim, sel... |
0c4ab91613a05b81a316010dde412310281b313b9adffebcd2586e8cbfb48978 | Python | 6,937 | 182 | import os
import shutil
import subprocess
import sys
# import tempfile
# import importlib
import random
import string
import json
from functools import partial
from multiprocessing import Pipe, Pool, Process
from pathlib import Path
from tqdm import tqdm
import numpy as np
def read_file(filename):
""" return ... |
7b7a05ec6808d4c63215fea2ce5790e7989dd3778fdbcc3f0db21e231a52ecd0 | Python | 6,939 | 194 | import numpy as np
import matplotlib.pyplot as plt
import math
from matplotlib.ticker import FixedLocator
plt.rc('font',size=15)
point=0 # Critical value for transitions
upstate=1 # value of bigger stable state
downstate=-1 # value of smaller stable state
def Fsign(data): ... |
8478ff068135f11d9f98de60f1204480df2193cde392b28dcc4e2b394f288493 | Python | 6,943 | 150 | import scanpy as sc
import numpy as np
import torch
import torch.nn.functional as F
from typing import List
from torchmetrics.functional.classification import multiclass_f1_score, multiclass_accuracy, multiclass_precision, multiclass_recall
def aggregate_eval_results(scores: List[dict]):
scores_new = {}
for k... |
308b9a31188fdf8811c707871df3d2e0df88017ab32cf0d37ea72f35c8641105 | Python | 6,944 | 204 | import pandas as pd
from data_profiling.config import Settings
from data_profiling.report.formatters import fmt_numeric
from data_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
)
from data_profiling.report.presentation.frequency_table_utils import freq_table
from d... |
460d053346d180797a607f68f19362e953d9d90eef0566fb009cb1ca85eedbec | Python | 6,944 | 196 | r"""Layer B — enzyme function / EC-number prediction from sequence.
``enzyme_function(seq)`` predicts Enzyme Commission (EC) numbers.
Engines
-------
``"clean"``
`CLEAN <https://github.com/tttianhao/CLEAN>`_ — contrastive ESM-1b model,
the SOTA open method. No PyPI package; used when a local checkout +
w... |
8bedd526953a1cadab7a344e2c1223bc7ae196409df006be57a0600c9efb3ff0 | Python | 6,945 | 168 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
# from sklearn.model_selection import train_test_split
# from CNN_classifier import CNN_classifier
import json as simplejson
from t... |
936b63d06d90b58eace7a8c045d088a33c1efc55843d6a81bce3ce15bcb734f5 | Python | 6,947 | 166 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
# Adrien Fleury <adrien.fleury@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.co... |
9a44847d681abe5fd589cf62bf9110a224c3ff6180f1b172ff2faa1b2f3986af | Python | 6,947 | 172 | import numpy as np
from lib.qc_surface import boundary_chords, compute_topology, face_geometry
from lib.surface_quality import (
SurfaceProjector,
closest_points_on_triangles,
flip_edges,
improve_quality,
split_boundary_chords,
)
from test_qc_surface import disk, grid
def capped_disk(n=8, seed=0):... |
b6496a74e11a232113d40b1ec713423bb7e5ad529f931388401a65f8d886f9ea | Python | 6,947 | 142 | import os, datetime, logging, copy
import pandas as pd
from gensim.models import word2vec, KeyedVectors, Word2Vec
from misc.save_files import write_w2v_model, read_DocTermDict, read_w2v_model
from misc.abb_med_disease import gen_abb_med_disease
from misc.dictionary_extension import DocumentTermDictionary
from Data_Ma... |
f98807d105644d6dacb6d4dbb57fb0621de9a3909c201e441e0beef1cb8cb427 | Python | 6,947 | 231 | """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"... |
ca6a7cda905fdec0c431532e20f585aa9946b03cff4c3e1cd787520e86ac55e9 | Python | 6,949 | 161 | from enum import Enum
from logging import Logger
from typing import List
import numpy as np
from src.handlers.general import ParamSchedulerHandler
from src.networks.vqvae.baseline import BaselineVQVAE
from src.networks.vqvae.baseline_2d import BaselineVQVAE2D
from src.networks.vqvae.single_vqvae import SingleVQVAE
fr... |
908feca99822a017a1808c537b8506d894fdf78d435a370b4a8d65bd66adc940 | Python | 6,950 | 190 | # Code to segment tumor regions from WSI using ResNet18 model
#Load Libraries
import openslide
import os,sys
import glob
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from PIL import Image
import scipy
import skimage
import scipy.ndimage
import random
import torch
import tables
from sklearn... |
c842bd1725599020309490b290ce478e9e8fe79097f7851c11c3b1db48bc3a3a | Python | 6,950 | 250 | # -*- coding: utf-8 -*-
"""
Created on Tue May 21 11:31:41 2024
@author: jpv88
"""
import warnings
import numpy as np
import pandas as pd
from random import sample
from tqdm import tqdm
class DCISIv:
def __init__(self, f_t, ISI_v, N=(1, float("inf")), tau=2.5, tau_c=0):
self.f_t = f_t
self.I... |
e9fe4949593c786966aeffc2bc0a834215aa4c7fb0d2804c76f1215437ad5c3e | Python | 6,950 | 178 | import gzip
import os
import tarfile
import math
import os
import matplotlib.pyplot as plt
from enum import Enum
max_length = 1400
pLDDT_row = "ATOM"
pLDDT_atom = "CA "
pLDDT_atom_column = 2
pLDDT_amino_acid_column = 3
pLDDT_position_column = 5
pLDDT_amino_acids = {"SER", "THR", "TYR"}
pLDDT_value... |
1f3cd579091dc7aa9864e17e741dd5f5af96f2257519233a862a90a37338fad9 | Python | 6,953 | 181 | import math, torch
from ..base import Transform, as_range, randint, randn, uniform
from ..ops import add_noise, butter_gain, fft_filter
def time_axis(x, fs):
return torch.arange(x.shape[-1], device=x.device, dtype=x.dtype) / fs
class GaussianNoise(Transform):
"""Add white Gaussian noise, independent per le... |
4d7ed57fdd9268769c3c311a096dc5bc7de944fff32ee82951537e170f8a298d | Python | 6,956 | 176 | import math
import torch
from torch import nn
class DotProductAttention(nn.Module):
def __init__(self, dropout, **kwargs):
super(DotProductAttention, self).__init__(**kwargs)
self.dropout = nn.Dropout(dropout)
def forward(self, queries, keys, values):
d = queries.shape[-1]
sco... |
126f9f398d1e4e1f74a51ab2a45d87bb0c5c157660cecbbe15799e21af838109 | Python | 6,960 | 159 | import inspect
from typing import List, Optional, Tuple, Union
import numpy as np
import PIL
import torch
import torch.utils.checkpoint
from ...models import UNet2DModel, VQModel
from ...schedulers import (
DDIMScheduler,
DPMSolverMultistepScheduler,
EulerAncestralDiscreteScheduler,
EulerDiscreteSched... |
acacb9bcc84f82e89d6923da7852b2c2ff9c9eedf6b3dee264df7944231cbadd | Python | 6,960 | 233 | """A training script of TRPO on OpenAI Gym Mujoco environments.
This script follows the settings of https://arxiv.org/abs/1709.06560 as much
as possible.
"""
import argparse
import logging
import gym
import gym.spaces
import gym.wrappers
import torch
from torch import nn
import pfrl
def main():
parser = argpa... |
bbd0a303f20c31fc029446ebb8bedc01fd63811e90ac02604145ae39af7d4cec | Python | 6,960 | 208 | """
Runtime availability checking for MCP tools.
First-batch tools are all low-dependency (no GPU, no network, no external
binaries). The checking infrastructure is defined here so that later phases
can plug in real probes.
"""
from __future__ import annotations
import os
import shutil
from typing import Dict, List... |
e8785937472dac552a2300937cf5c13ac4fa6f78c9dddf3c7f33069a425e747b | Python | 6,960 | 132 | # coding: utf-8
"""
# # SCRIPT: IDENTIFY EEG-BASED REPLAY ONSETS IN TASK
# # PROJECT: FMRIREPLAY
# # WRITTEN BY QI HUANG 2022
# # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY
"""
# In[1]: import relevant packages
import os
import sys
import warnings
import numpy as np... |
459fb18540623435539942e584a25da9c0ddbbb809c0bed33fe4e0b917e349b0 | Python | 6,961 | 178 | ####################################################################################################
# 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... |
e71d905a6dc7f5e177765f2ce57c266eee3cebfb52637a1a210384f47cb39d9a | Python | 6,962 | 162 | from typing import Optional
import numpy as np
import pandas as pd
import scanpy as sc
from scipy import sparse
from scipy.spatial import distance_matrix
import anndata
from .._optimal_transport import cot_sparse
from .._optimal_transport import cot_combine_sparse
from .._optimal_transport import uot
from .._optimal_t... |
47840c9e5c64c2d36e663b65beca88e33a7366e4830e4db68a2b2c6c59e71906 | Python | 6,963 | 199 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
96ece0cd91e12a85ba73400f75658b2a95e8fe54611572b3be51a25782777535 | Python | 6,963 | 163 | ####################################################################################################
# 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... |
ed1c86459fa60c8873846533695fa69c70f0d372b48bfe5643f627c7228d2242 | Python | 6,964 | 168 | import argparse
"""
HELPER SCRIPT TO COUNT QUAST MISASSEMBLIES THAT HAPPEN OUTSIDE KNOWN SVs.
"""
def read_quast_file(file):
"""
Extracts misassembly regions from QUAST file, usually located in /QUAST_output/contig_reports/all_alignments_$$.tsv
:param file:
:return:
"""
total_count = 0
reloc... |
f39129700665384a243169f5ac9b19dc0e543ad300ddfa98194ae6760bad6d27 | Python | 6,967 | 196 | from posixpath import split
import torch
import torch.nn as nn
import torchvision
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import scipy.io as scio
from torch.utils.data import Dataset
... |
8f4a26ff2634a64af8ced30e8e89d42f501364b6e50eb6d7de137c006fc91062 | Python | 6,968 | 177 | import os
import cv2
import tifffile
import numpy as np
import matplotlib.pyplot as plt
import random
from cnn_archs_pytorch import unet_v, unet_v2, hourglass_wores, hourglass_wres
def load_data(data_path, all_gt_img_data, all_noisy_data, max_proj):
gt_img_path = os.path.join(data_path, 'gt_imgs')
noisy_img_p... |
91a3602e64be27b056a9951794b66865cd24177ab683a197f759429f0a24e3ff | Python | 6,968 | 216 | # Copyright 2023 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, ... |
00edb0bc89f2370180ec2abfefe5190dcfce9fc81425b12ea06d46792d58e493 | Python | 6,969 | 227 | import random
from collections import defaultdict
from typing import Dict, List, Optional
import pytest
import ray
from ray.air import ResourceRequest
from ray.air.execution import FixedResourceManager, PlacementGroupResourceManager
from ray.air.execution._internal.actor_manager import RayActorManager
from ray.air.ex... |
c95e27b9b0ca6fc7819d0f3aaf58a1ea057df70dc1ef914c55dfea520c3c91f4 | Python | 6,969 | 233 | """
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 csv
import io
import pickle
from typing import TYPE_CHECKING, ClassVar
import numpy as np
impor... |
0b56fd3ff4ac218e007f98e1dd0b8a558c303a957c4fedb74ab2413e61f69473 | Python | 6,971 | 225 | # built-in dependencies
import os
# 3rd party dependencies
import pytest
import cv2
import numpy as np
# project dependencies
from deepface import DeepFace
from deepface.modules import verification
from deepface.commons.logger import Logger
logger = Logger()
threshold = verification.find_threshold(model_name="VGG-... |
5c0411f2d3b48f782fa59f088c32516d8c7b23da7219d3131d8e6f74703cd137 | Python | 6,974 | 162 | 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... |
2bc8a4714c1211662b921c4491c2fee64f09f98301734087d26cacde047ef699 | Python | 6,975 | 187 | """
Module to define multi-view nodes.
A multi-view node is simply a node that is defined for several views. For example, the weights W or the data Y, but not the latent variables Z.
Types of multi-view nodes:
- Multiview_Variational_Node: variational nodes present in all views
- Multiview_Constant_Node: multiview nod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.