sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b9132bf4aecf46a0a0fabe90edf248b7499b1460c455657b19ea3965371652e2 | Python | 8,155 | 237 | """
An implementation of Context dependent GRU.
the gru uses the implementation from:
https://github.com/emadRad/lstm-gru-pytorch/blob/master/lstm_gru.ipynb
"""
import math
import torch
import torch.nn as nn
import numpy as np
from utils import to_pth, to_np
from torch.nn.functional import softmax
class CGRU_c2h(nn.Mo... |
9ba4bc6fe5e74246778dfd5eb67255cafd12b41b7c1d2ec9b5be72c662aec0ae | Python | 8,160 | 258 | # -*- coding: utf-8 -*-
#
# HiC-Pro documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 15 13:26:13 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
305b66cb25162c9fd7ab9e4e715c4aa7505c97894e32e24c82fe6bf79d4be8ed | Python | 8,162 | 237 | ####################################################################################################
# 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... |
025a13aaeb632bf47cd93952e0b3a42c79a95572337a1be8fd96ff8b915acefc | Python | 8,164 | 215 | #
# 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... |
2b8be8deb14f58600df01aa9e7507669f98570cfce24adae2aa104120d29d92b | Python | 8,166 | 226 | import torch
from torch import nn, optim
from torch.utils.data import DataLoader, Dataset
import numpy as np
from skimage.segmentation import clear_border
from skimage.morphology import closing
from skimage.measure import label
import os
import DUnet
from clean_pdb import clean_pdb
import pybel
import openbabel
import... |
80cb3837fdc102502c84b7d4c7628559615aa3812bce183c073f455044ed62c5 | Python | 8,171 | 234 | import torch
import torch.nn as nn
from functools import partial
import clip
from einops import rearrange, repeat
from transformers import CLIPTokenizer, CLIPTextModel
import kornia
from stable_diffusion.ldm.modules.x_transformer import Encoder, TransformerWrapper # TODO: can we directly rely on lucidrains code and s... |
bfa755edce7c6aada51b4d33d82cbbb9dc2c950b230f628909cd0e53fd27ee64 | Python | 8,172 | 238 | """cutadapt wrapper for amplicon primer trimming.
Wraps the real ``cutadapt`` CLI (https://cutadapt.readthedocs.io) —
install via ``pip install cutadapt`` or ``conda install -c bioconda cutadapt``.
The function follows the same shape as :func:`omicverse.alignment.fastp`:
takes ``(sample, fq1, fq2)`` tuples, writes tr... |
f78a9e4271bef1b9b9a0da6de300a7f85abe7872c7a4d89b7f06d4a15cf752c9 | Python | 8,176 | 262 | """
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 dataclasses
import pytest
import torch
from fairchem.core.units.mlip_unit.api.inference import... |
831fd79ea6f94111674326af4927bb87c15a81df6737fd7d559c0abde92569ea | Python | 8,178 | 224 | #!/usr/local/bin/python
"""
***********************************************
- PROGRAM: compareBED.py
- CONTACT: Bryan lajoie (bryan.lajoie@umassmed.edu)
***********************************************
"""
from __future__ import print_function
from __future__ import division
import numpy as np
import scipy... |
2f932806cd7eb4b1d5886ed743c112681fc4d2c9e630dfae2b564bc5b8b36ece | Python | 8,182 | 189 | # 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.
from __future__ import absolute_import, division, print_function
import os
import pandas as pd
import numpy as np
from rdkit import Chem
from ..utils import logger... |
52736ebdef91fed550f43efabc93e6907c1f3df46ef80d63ecbc54248dd86a6f | Python | 8,182 | 243 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
import torch.distributions
import numpy as np
import random
import os
from sklearn import preprocessing
from .pos_encoding import positional_encoding
device = 'cuda' if torch.cuda.is_available() else 'cpu'
###########################... |
783770095dddba4afe96804ce7889b4a0bb1b8016f1636d132aabf99160559fc | Python | 8,184 | 234 | # Vendored from `decoupler` (https://github.com/scverse/decoupler) by
# omicverse for in-tree GPU acceleration work. Original copyright by
# the decoupler authors, redistributed under decoupler's GPL-3.0
# license. Cross-module imports rewritten from `decoupler.*` to
# `omicverse.es.*` (see scripts/vendor_decoupler.py)... |
d85867efead79ab1f678ac1f47b7b63c8ee70d406bc54bb92552ecb414d79807 | Python | 8,185 | 226 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# ========================================... |
6139d874deb76f1a67a6b9a63acd2410237fbdf636be9d77e5468f5df03039be | Python | 8,187 | 236 | #!/usr/bin/env python3.7
"""Defines Map class.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing instructions.
The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent
Description:
OVERVIEW
... |
68b9ebf785a9aa413660adeee806d8d26def3c670362a9db30288ab8bb4cbfe2 | Python | 8,191 | 257 | # type: ignore[reportAttributeAccessIssue]
import math
import numpy as np
import pytest
from stl.mesh import Mesh
from . import utils
def test_rotation():
# Create 6 faces of a cube
data = np.zeros(6, dtype=Mesh.dtype)
# Top of the cube
data['vectors'][0] = np.array([[0, 1, 1], [1, 0, 1], [0, 0, 1]... |
1423ffd667f9fbdacfc59185bb8ba5c409af26c83c2ac272b840f5517b59551b | Python | 8,192 | 186 | """Diff a Read the Docs PR preview against /en/master, page by page.
An RST-to-MyST conversion is meant to be format-only, so the rendered HTML
should be equivalent. A green build proves every reference resolved; it does not
prove the page still renders the same thing. Several ways to change the render
leave the build... |
17c12a4188a06d481f7dcd3ae4a487085bf83068d3391084c3b8934f8ee9f493 | Python | 8,194 | 198 | from typing import Dict, List, Optional, Tuple
from ray._common.pydantic_compat import PYDANTIC_INSTALLED, BaseModel
if PYDANTIC_INSTALLED:
from pydantic import field_validator
# TODO(aguo): Use these pydantic models in the dashboard API as well.
class ProcessGPUInfo(BaseModel):
"""
Infor... |
38703cbb6412cd2294b18f9b6f450542eb7cfebfab6a1fce01f7183dbbbddb1f | Python | 8,194 | 227 | import numpy as np
import torch
import time
pi = np.pi
def P(x, gamma):
return 0.5 * (1 - torch.sin(gamma * x)) * (1 + torch.tanh(pi ** 2 - 2 * pi * x))
class VO2:
def __init__(self, N, width_factor=1):
self.N = N
self.width_factor = width_factor
self.w = 7.19357064e+00... |
195ec87053f2b3fa0bb30e6a69b8242e0d9427b21342995a4597cef7dbf4103f | Python | 8,197 | 232 | import numpy as np
import pandas as pd
from sklearn import metrics
import scanpy as sc
from sklearn.decomposition import PCA
from .._pymclustr import fit_pymclustr
def mclust_R(adata, num_cluster, modelNames='EEE', used_obsm='emb_pca', random_seed=2020):
"""Cluster an AnnData embedding with the pure-Py... |
541227ef211ab54286378f0611f7ed873878e6a88353abf736ae0a09b6de8fb0 | Python | 8,197 | 240 | # 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, sof... |
aa1a396cdbe363cbfea38d26c16d1fdfda7bbc703a36e263f7873aae2dc1ff27 | Python | 8,197 | 214 | """High-level SAMap runner used by ``ov.single.samap_integrate``.
Orchestrates the vendored SAMap: build per-species SAM objects from AnnData,
translate BLAST protein IDs to the dataset gene symbols (via the Ensembl peptide
FASTA + BioMart ``ensembl_gene_id -> external_gene_name``), then run SAMAP on a
precomputed BLA... |
2fe74506d1216e658eae8f4e74d511f78c9b6a79e0194ada8a4d7fda4a338817 | Python | 8,200 | 219 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import datumaro as dm
from django.conf import settings
from django.db import transaction
from rest_framework import serializers
from cvat.apps.consensus.intersect_merge import IntersectMerge
from cvat.apps.consensus.models import ConsensusSettings
f... |
8d88b4f61de95bbd368342ca2df987cd8e24dea39e7f22db77a2ceb51105b03e | Python | 8,202 | 186 | import argparse
import os
import pickle
from typing import List
import numpy as np
import torch
import torch.utils.data as torch_data
from torch.utils.tensorboard import SummaryWriter
import torch.nn as nn
from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct
import lib.dataset_config_parser.data... |
b2e9b510e03a27588bcb5fb1a7e04c80ab1b71264837b67fd1472381ca27ecdf | Python | 8,211 | 288 | # type: ignore[reportAttributeAccessIssue]
import io
import locale
import os
import pathlib
import subprocess
import sys
import warnings
import numpy as np
import pytest
from stl.utils import b
from stl import Mode, mesh
FILES_PATH = pathlib.Path(__file__).parent / 'stl_tests'
def test_ascii_file(speedups):
fi... |
18d1d652b928f4492f512fa0f33f4887a4549a4adae6a2457ed79a8c857eb902 | Python | 8,212 | 237 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
For the selected k, plot the 2D dFC or LE states to display with and without limits.
Output:
'k'+statetype+'_unscaled.jpg' Plot containing auto-scaled dFC or LE 2D states with color bar for own scaling.
'k'+statetype+'.jpg' Plot containing cross-k scaled dFC or LE 2D s... |
9046afff4292862be90dbd9ee399def8611b485b4efd410f096e114bd4b54751 | Python | 8,212 | 215 | from __future__ import annotations
from typing import Optional, Union, Sequence, List
from warnings import warn
import numpy as np
import jax
import jax.numpy as jnp
class Sites:
"""
Contains the information of both real space and Hilbert space. The
geometrical coordinates of the sites and the Hilbert spa... |
e4fbce387f2c76f37bfaffe21400a9aea0d9a1b87906fa1029d61e6d6a0f71fc | Python | 8,214 | 204 | """Perform SMC sampling for endstate correction"""
import logging
from typing import List
import numpy as np
from mdtraj import Trajectory
from openmm.app import Simulation
from scipy.special import logsumexp
from tqdm import tqdm
from endstate_correction.constant import kBT, temperature
logger = logging.getLogger(... |
40f527d2f86a79c09c9f853d390664319656293ab9a45caf3775c57d5b75cba4 | Python | 8,216 | 191 | #
# 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... |
09c8ea3389ae4265352f9eb629208b3911f8fb19552577f01d044c689264b77b | Python | 8,218 | 249 | from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
# from fluid.core.nn.init import ICNR
class UNetDownBlock(nn.Module):
def __init__(self, in_size, out_size, padding, batch_norm, dis_mark=False):
super(UNetDownBlock, self).__init__()
self.in_size = in_size... |
ba7322f97fcafee0302ae34cb3d1a3b73019cde629837089078195c69d3d9b04 | Python | 8,222 | 237 | import json
import logging
import os
import time
from typing import TYPE_CHECKING, List, Optional
from urllib.parse import urljoin
import numpy as np
import pyarrow
import requests
from ray.data._internal.datasource.databricks_credentials import (
DatabricksCredentialProvider,
build_headers,
request_with_... |
c518a15d06a2eb67c046224e9004d5f9f73bbc86b738ea4055dd3ab185ea3f37 | Python | 8,223 | 263 | """
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 functools
from contextlib import suppress
import torch
import torch.nn as nn
from fairchem.cor... |
0cb417401a212156a239cc802948844dfed56ded9a465fa7468ab9a1c3a4ee99 | Python | 8,225 | 206 | #!/usr/bin/env python3.7
"""Defines the Configurable class.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing instructions.
The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent
"""
import json
... |
d5d0f85938cac3366043272b411c4e317771b8d828b54a99322ce01c280c3cc5 | Python | 8,225 | 219 | ####################################################################################################
# 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... |
f9cfd0e74b4757f8d40113eca1725f67edd5f2516c7ce68321b21f3204c7d3da | Python | 8,226 | 220 | #!/usr/bin/env python
"""
Calculates non-duplicate primary-aligned binned coverage
of a chromosome from an input BAM file
"""
# Import libraries
import argparse
from subprocess import call
import pysam
import pybedtools
import gzip
import shutil
import os
# Define exception class for invalid coverage modes
class I... |
9535d9aea456aed2008b0f489b7be7a3d353a3e92ceface9dcaaa24d2af4dc8d | Python | 8,227 | 183 | import os
import sys
import argparse
import ast
import csv
import cv2
import json
import time
import torch
sys.path.insert(1, os.getcwd())
from SimpleHRNet import SimpleHRNet
from misc.visualization import check_video_rotation
def main(format, filename, hrnet_m, hrnet_c, hrnet_j, hrnet_weights, image_resolution, sin... |
ec8b8806fb377ca40e43d2f3b3dd20c4e7d049bf45f64aade9450de32b1e9958 | Python | 8,229 | 239 | # 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 torch
from torch import nn
import torch.nn.functional as F
class GHM_Loss(nn.Module):
"""A :class:`GHM_Loss` class."""
def __init__(self, bins=10, a... |
2ef694e993d13801ad3a222c3070b32b8ec018009b65da92fa02b3990ba68ab0 | Python | 8,230 | 221 | import copy
import logging
import operator
import threading
import time
import traceback
from typing import Any, Dict, Optional
from ray.autoscaler._private.node_provider_availability_tracker import (
NodeProviderAvailabilityTracker,
)
from ray.autoscaler._private.prom_metrics import AutoscalerPrometheusMetrics
fr... |
3f087d883e6507c7d843a0b1b6fa48ab9e83cd8bd771f4a42e227b7e1ab774cf | Python | 8,231 | 221 | import warnings
from logging import getLogger
import numpy as np
import torch
import pfrl
from pfrl import agent
from pfrl.utils import clip_l2_grad_norm_
from pfrl.utils.mode_of_distribution import mode_of_distribution
from pfrl.utils.recurrent import one_step_forward
class REINFORCE(agent.AttributeSavingMixin, ag... |
56eb27529a0db8114a230627839f84def3cf39ed789cb0e493acf85308ee09da | Python | 8,231 | 251 | import os
import pickle
from typing import List
from typing import Tuple
import tensorflow as tf
import DECIMER.config as config
import DECIMER.Efficient_Net_encoder as Efficient_Net_encoder
import DECIMER.Transformer_decoder as Transformer_decoder
print(tf.__version__)
# Set GPU
os.environ["CUDA_VISIBLE_DEVICES"] ... |
c75c515ae423176f730999c97bbe24495cacb54b013ca8574e6508541ccd5628 | Python | 8,234 | 182 | import os,time,pickle
import numpy as np
import torch
from timm import scheduler as schedulers # do not delete!
from os.path import join
from tqdm import tqdm
from torch.nn import DataParallel as DP
from tools import *
from sleep_models.heads import HeadPost
import warnings
warnings.filterwarnings("ign... |
443687d744fc3ea04ec84ee14575fa793fa5e7453e5ac0e37d6fc1334d5e84a4 | Python | 8,236 | 266 | import random
from typing import Any, List, Optional
import pytest
import ray
from ray.air import ResourceRequest
from ray.air.execution import FixedResourceManager, PlacementGroupResourceManager
from ray.air.execution._internal import Barrier
from ray.air.execution._internal.actor_manager import RayActorManager
from... |
a4f6b70f8b03f59fdfcba673e5d94892b322bdf523215d51e2a1effb03cc808a | Python | 8,236 | 227 |
# coding: utf-8
from model import *
from attention import pHLA_attns_draw_save
from mutation import *
from utils import Logger, cut_peptide_to_specific_length
import math
from sklearn import metrics
from sklearn import preprocessing
import numpy as np
import pandas as pd
import re
import time
import datetime
import... |
7ce65a1bfd879de10c9a85e720d0b1d7c1a5526a38debce606c921930044175e | Python | 8,237 | 262 | """Ensembl API client."""
import logging
from typing import Any, Dict, List, Optional
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class EnsemblClient(BaseAPIClient):
"""Client for Ensembl REST API.
Ensembl is a genome browser for vertebrate genom... |
c55f04567e4f94356f9f90e1bbd2ff90e8f61f48b7fcece4fcba8e21de9414fa | Python | 8,238 | 214 | import sys
import json
import torch
import pickle
import argparse
import numpy as np
from tqdm import tqdm
from lop.algos.bp import Backprop
from lop.algos.cbp import ContinualBackprop
from lop.nets.linear import MyLinear
from torch.nn.functional import softmax
from lop.nets.deep_ffnn import DeepFFNN
from lop.utils.mis... |
1b4b88ded93a21555671feb3433948d47827134e8324d4254f4e9509be27f26e | Python | 8,239 | 226 | r"""Vendored access to `ProteinMPNN <https://github.com/dauparas/ProteinMPNN>`_.
ProteinMPNN has no PyPI package, so on first use we ``git clone`` it into the
synbio weights dir (``OMICOS_SYNBIO_WEIGHTS``, default ``~/.omicverse/
synbio_weights``) — the repo bundles its own model weights, no separate
download. We dri... |
2ea6a936bb65442adbe32bb521e3e9c32465f1097d5bf9f662a29bd63443e942 | Python | 8,239 | 262 | """Ensembl API client."""
import logging
from typing import Any, Dict, List, Optional
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class EnsemblClient(BaseAPIClient):
"""Client for Ensembl REST API.
Ensembl is a genome browser for vertebrate gen... |
57260516301a4808be50f2bbc80427a81641b5c3eb6df22489f329ad6fe18ca2 | Python | 8,240 | 264 | """
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
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import TYPE_CHECKING,... |
05eaa31cbf5b3e13929c00f9f2feb6aff136a535bf80371bea8ebddf2ff2ad0c | Python | 8,241 | 229 | from __future__ import division
from .. import gpu_utils
from ..distributions import *
import numpy as np
# Import manually defined functions
from .variational_nodes import MultivariateGaussian_Unobserved_Variational_Node
# TODO:
# - integrate into Z node using ix
# U_GP_Node_mv
class U_GP_Node_mv(MultivariateGauss... |
7827bbeb6a20db35b79b93e9de802a03032a53ba3ae330a25823cedeaaf19593 | Python | 8,242 | 204 | from typing import TYPE_CHECKING, Iterable, List, Optional
import pyarrow as pa
from ray.data._internal.datasource_v2.common.file_pruners import (
FileExtensionPruner,
PartitionPruner,
)
from ray.data._internal.datasource_v2.interfaces.file_indexer import FileInfo
from ray.data._internal.datasource_v2.interfa... |
b4c0f7f02bfe928bcd07941878b4d7090efc3b901f8cfca488a613816ae186f7 | Python | 8,242 | 241 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
Cluster a bed of structural variants based on reciprocal overlap.
Variants are clustered with the single-linkage algorithm, using a minimum
reciprocal overlap to determine whether two variants are linked. If multiple
variants from the same sample are clustered toge... |
b7ef5276635cb54f2c399a590c0225a4e5ac4496276a2ee5ec4cc172ded221ed | Python | 8,243 | 205 | # -*- coding: utf-8 -*-
### ------------------------------ IMPORTS ------------------------------- ###
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from train.feature_settings import param_list, cross_ch_param_list
from train.feature_settings i... |
ec6d943d4f9c74bee4dd07cb7b9494acb9edc14c5f69d581bb7ce964a33ca967 | Python | 8,245 | 181 | ####################################################################################################
# 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... |
2c06f50ce67bbc0f1b99ed40cb12a93c54035b5c46b4c7cceb6c396793d3f87b | Python | 8,251 | 270 | # -*- coding: utf-8 -*-
"""Dynamic Offloading of ANN Model Algorithm Analysis - in (Smart home dataset) Code .ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1jnm95PnRKGMB3IK0Qr7b-Q1ZF9W0yvGn
"""
import pandas as pd
data=pd.read_csv("cloud final1.csv")
... |
76abbd8b0d90c9a0e51316b8ed7d7dfc08ea4dd51407301a74a08a23c6a06301 | Python | 8,254 | 219 | import numpy as np
import h5py
import os
import rasterio
def h5refl2array(refl_filename):
"""
Extract metadata from h5 object and reflectance values
returns: metadata and a numpy array
"""
hdf5_file = h5py.File(refl_filename, 'r')
file_attrs_string = str(list(hdf5_file.items()))
file_attrs_... |
c62eb05ff2da0b6e2aaaf0c130008515bd4681327f4dcb01dab5e5cf65f5bf63 | Python | 8,258 | 220 | import pickle
import pytest
import numpy as np
import quantities as qt
from copy import deepcopy
from mozaik.models import Model
from parameters import ParameterSet
from mozaik.sheets.vision import VisualCorticalUniformSheet3D
from mozaik.tools.distribution_parametrization import (
load_parameters,
PyNNDistribu... |
e50df7bfc5d1a7b9b0b43a8a107e04c2df6e167dcb93fbd587baf491899fc715 | Python | 8,260 | 201 | # -*- coding: utf-8 -*-
# Development work, e.g. for higher level functions.
# These functions are not intended to work on any machine or pass the tests.
# They are early drafts (e.g. of higher level workflows) intended to be shared among select collaborators or multiple machines of one collaborator.
# Please don't ed... |
24be2fbdd24667ee4cc833617509164fa8020ed83ccc12ad9748941fa6fcf571 | Python | 8,262 | 233 | import argparse
import pandas as pd
import pickle
import numpy as np
#from pybayesprism import prism
from .prism import Prism
parser = argparse.ArgumentParser(description = 'Python Implementation of BayesPrism')
parser.add_argument('-n', dest = 'ncores', help = 'CPU cores')
parser.add_argument('-x', dest = 'file_x'... |
b7e03deaf4edf6a042da061440f9d09e77d441e60b9daa4465025db87378e585 | Python | 8,262 | 189 | import argparse
import pickle
from typing import List, Tuple
import numpy as np
import torch
import lib.data_utils.data_util as du
import lib.data_utils.dynamic_data_util as ddu
import lib.dataset_config_parser.dataset_config_parser as dcp
from autoencoder.autoencoder import Neurips2017_Decoder, Neurips2017_Encoder
f... |
f5732dcfb2a0007c5758602ecf495190521b322b077791f36e3af6551c52a9af | Python | 8,262 | 209 | import logging
import os
from functools import lru_cache
from typing import List, Optional, Tuple
from ray._private.accelerators.accelerator import AcceleratorManager
from ray._private.ray_constants import env_bool
logger = logging.getLogger(__name__)
# Ray uses ``FURIOSA_DEVICES`` to track which Furiosa NPUs are as... |
dea1b571c1c913309bc663e448bdba2eb5d983383aa8133ce3a4ca23c02fa65a | Python | 8,265 | 192 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
numpy version: 1.23.3
scipy version: 1.9.1
pandas version: 1.5.0
matplotlib version: 3.6.3
seaborn version: 0.11.0
pingouin version: 0.5.3
"""
#%% Import Modules
import os
import glob
import numpy as np
from scipy.interpolate import RegularGridI... |
f82543fbf533433ff59bf55744dd6f412251446fe1e4e8d9bbc5340375d4b6ed | Python | 8,265 | 213 | r"""Shared plumbing for :mod:`omicverse.mol.md` — dependency gates, OpenMM
platform selection, and provenance helpers.
Nothing heavy is imported at module scope: ``openmm`` / ``mdtraj`` /
``pdbfixer`` are pulled in *inside* functions so ``import omicverse.mol``
stays free even without the ``[md]`` extra.
"""
from __f... |
9a3aa1b04ad68dac91ba48453166d3ed3dbfdaafe90c403d55c6a04682f6f19f | Python | 8,267 | 217 |
'''
Module used to create the microscope objects used in the simulated experiments
'''
import numpy
import pickle
from sklearn.model_selection import ParameterGrid
from tqdm import tqdm
# from . import tools
from pysted import base, utils
from pysted.microscopes import DyMINMicroscope, RESCueMicroscope
from . imp... |
33ee860554458e2fe2939c7508cc6bcfdaf9a0406bf534db96a2ec2351df892e | Python | 8,282 | 212 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
# Copyright (c) 2022, NVIDIA CORPORATION. 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.a... |
596f3ad78f69e488148e64f4bf501d7a8c404628fb0b82fe1c79c2629626a6cf | Python | 8,285 | 223 | """
This command-line program can perform two operations:
1) predict mouse paw locations in a video using a deep neural network and
2) label a video for visualization purposes, based on its prediction results.
Prediction results are stored as HDF5 and CSV file in the same folder where
the corresponding v... |
6c1cfc42b86496ddd09f0cb0faae09ca1446791ff2bee2a444ade6962f147911 | Python | 8,285 | 262 | #!/bin/python
import argparse
import re
import pysam
import gzip
ME_ALT = ':ME'
DUP_SVTYPE = 'DUP'
VAR_GQ = 'varGQ'
MULTIALLELIC = 'MULTIALLELIC'
UNRESOLVED = 'UNRESOLVED'
HIGH_SR_BACKGROUND = 'HIGH_SR_BACKGROUND'
BOTHSIDES_SUPPORT = 'BOTHSIDES_SUPPORT'
REVISED_EVENT = 'REVISED_EVENT'
EV = 'EV'
EV_VALUES = [None, 'R... |
9ddc284bd560b6f83970172fca4b547f18f2468d573b0c7607b4299f7dee5366 | Python | 8,286 | 218 | from pynndescent import NNDescent
import numpy as np
from sklearn.utils import check_random_state
from umap.umap_ import fuzzy_simplicial_set
import torch
from ..._optional import normalize_torch_device
# Try to import PyG KNN
try:
from ...pp.pyg_knn_implementation import pyg_knn_search
PYG_AVAILABLE = True
e... |
1296bbda71721919b9eadc92b63216ad3898ee0cc08c0f6db34717a001f092fd | Python | 8,287 | 219 | #!/usr/bin/env python
# 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 a... |
5cfe0291cb5a0d5dbc64e3601095a44626875edb204ac1598ef65a1fbe0c8ccd | Python | 8,291 | 263 | # built-in dependencies
import os
# 3rd party dependencies
import cv2
import pandas as pd
# project dependencies
from deepface import DeepFace
from deepface.modules import verification
from deepface.commons import image_utils
from deepface.commons.logger import Logger
import pytest
import numpy as np
logger = Logger... |
e77d9e049661321798f213b9c7e98b58945214ad94ab11c5c1ee930bfaacbc86 | Python | 8,291 | 235 | """Classes defining the voltage initialization, voltage and current dynamics."""
from typing import Callable, Dict
import torch
from torch import nn
from flyvis.utils.tensor_utils import AutoDeref, RefTensor
__all__ = ["NetworkDynamics", "PPNeuronIGRSynapses"]
activation_fns: Dict[str, nn.Module] = {
"relu": n... |
475955e26bbef61282f4cf968cc446f0d967e7a927dcc100a74958a94a6001ae | Python | 8,293 | 265 | import sys
import os
import numpy as np
import scipy.sparse as sp
import torch
import pandas as pd
import scanpy as sc
import anndata
import io
import random
import itertools
import scipy
import anndata as ad
from numpy import inf
from scipy import sparse
import math
def accuracy(output, labels):
... |
9c596af37789aa8806523e5f8559fce59b01fb5a71aaa1772859bf55512c79f2 | Python | 8,297 | 220 | import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import wandb
from ldctbench.hub import load_model
from torch.autograd import Variable
from tqdm import tqdm
import ldctinv.utils as utils
from ldctinv.data.LDCTMayo import LDCTMayo
from ldctinv.vae.critic import Critic
from ld... |
ab3f886bd0b78e4c2c6e5e9d5aae161d61584547ea49479778fd729b8661b77e | Python | 8,298 | 232 | from pathlib import Path
import numpy as np
import pytest
import xarray as xr
from PIL import Image
from siapy.core.exceptions import InvalidFilepathError
from siapy.entities import Pixels, SpectralImage
from siapy.utils.plots import pixels_select_lasso
def test_spy_open(configs):
spectral_image_vnir = Spectral... |
de1f4e641be5ede97187478f10e86de250d98c76d7697138cfebb556460e01e8 | Python | 8,298 | 226 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
a0cc02f562500244f8c8c2c9c5e05faf4bcc8d59f332e632b285f6f02716b558 | Python | 8,300 | 230 | # Importing required modules
from calendar import EPOCH
from random import seed
import warnings
import gc
from sklearn.model_selection import train_test_split
from tqdm import tqdm
from torchvision import transforms
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm
from efficientnet_pytorch import ... |
ccff8f51f81735b5df6944ce3ec760982cbcfa138e024cc30a5d70a5a4c89533 | Python | 8,303 | 260 | # plot_columns.py --- Plot columns from an observable file
# Copyright (C) 2008-2013 Wouter Boomsma
#
# This file is part of Phaistos
#
# Phaistos is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... |
4e075e1b68566b17ffff93e8ccc000d5dc919877bdfc63cc2325fbdaf24cc50c | Python | 8,305 | 211 | '''
Example of MBEANN in Python for solving the double pole balancing problem.
Details of MBEANN could be found in the following:
K. Ohkura, et al., "MBEANN: Mutation-Based Evolving Artificial Neural Networks",
ECAL 2007, pp. 936-945, 2007.
'''
import math
import os
import pickle
import random
import time
im... |
2f5303e29bae20bf80e8d6ebb11653a0d70cefa79d2ff7bf212109bce4c0f0ea | Python | 8,308 | 197 | import os
import numpy as np
import matplotlib.pylab as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import matplotlib.pyplot as plt
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils.data import DataLoader
... |
73b79b43a53fbaa2a681052f3533b554da9efb6b2dd4e12c129a4575a0e67813 | Python | 8,309 | 226 | from enum import Enum
import logging
import random
import sys
import numpy
from sklearn.manifold import MDS, TSNE
from matplotlib import pyplot as plt
import seaborn as sns
M: int = 15
N: int = 5
K: int = -1
class Occurrence(Enum):
ONE = 1
REST = 2
ALL = 3
tissues: list[str] = []
... |
79df4888d51a04097a993648392e1e3d5702160742a5dbe2ac4fb2afa4bcc5e4 | Python | 8,309 | 213 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
1da00134940086879c94a4388b402a7af9ab7a4f281d0ef84266e28498ec544d | Python | 8,311 | 186 | import logging
from collections import defaultdict
from typing import Dict, List, Optional
from ray._private.event.event_logger import EventLoggerAdapter
from ray.autoscaler.v2.utils import ResourceRequestUtil
from ray.core.generated.autoscaler_pb2 import (
ClusterResourceConstraint,
GangResourceRequest,
R... |
e00c6d9af4e3ef2c6058d04c9952d92917b4591c4797c0f61258451574618a95 | Python | 8,312 | 231 | import logging
import socket
import threading
from http.cookies import CookieError, SimpleCookie
from socketserver import ThreadingMixIn
from types import ModuleType
from typing import TYPE_CHECKING, Dict, List, Optional
from wsgiref.simple_server import WSGIRequestHandler, WSGIServer, make_server
from ray._private.au... |
3267344b25fccf1f14ffa14130a4ac49e36f2c19c1c9513447ce44ead3e54418 | Python | 8,315 | 193 | # This script has been made in order to quickly start analysing the MEG-LFP Dataset refering to this article: doi...
# For example purposes, preprocessing has been implemented only for a specific: subject, session, task, acquisition.
# One would need to adapt the following code in order to make analyse on the whole dat... |
cf47c2f7b83e8388a4a71747b29a52ab9a0b4969297fdfd697fdc6feb8c3b7b5 | Python | 8,317 | 254 | from __future__ import annotations
import abc
from typing import (
TYPE_CHECKING,
Any,
Optional,
)
from ray.data._internal.execution.util import memory_string
if TYPE_CHECKING:
from ray.data._internal.execution.interfaces import RefBundle
class BundleQueue(abc.ABC):
@abc.abstractmethod
def ... |
0d6e2d4a67a5ec590cf48864e726113898dc8a49b9b2477528727c719db860c6 | Python | 8,324 | 247 | # type: ignore
# pylint: disable-all
# -*- 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 30: Importing and using external hardware-aware trained models.
This example demonstrates how to import ... |
2232492bf1d3b930854ec11a0a5a5fa4deff1e25a71c2657e9a37fa9e83f495d | Python | 8,337 | 220 | import pandas as pd
import numpy as np
from anndata import AnnData
from .helper import intersect, find_marker, extract_exp, process_anndata
from scipy.stats import pearsonr
from scipy.stats import spearmanr
from sklearn.metrics.cluster import adjusted_rand_score
import scanpy
def pearson_cal(spatrio_map: pd.DataFrame,... |
96416122fe8c02691022adfa3ec107dadd6636191bf54cbb5036bca7ecaf2a2b | Python | 8,339 | 135 | #from pybayesprism import prism
import numpy as np
import pandas as pd
def step1(bk, sc, cell_type, cell_state):
r_bk = pd.read_csv("./compare/step1_r_bk.csv", index_col = 0).astype('int32')
r_sc = pd.read_csv("./compare/step1_r_sc.csv", index_col = 0).astype('int32')
r_cell_type = list(pd.read_csv("./com... |
e7448d649e794ff7722c91ffe232bde260e0b95b34beefd3c85d5e301f50d00e | Python | 8,339 | 189 | import torch as th
import torch.nn as nn
from tqdm.auto import tqdm
from .dataloader_nogcn import DatasetNoGCN
from .utils import normalize, sparse_mx_to_torch_sparse_tensor, as_float_ndarray
import os
import numpy as np
import matplotlib.pyplot as plt
from .utils import batch_func
from .collate import collate
def tra... |
8b39a7bcdb24440ae6f8bbc82420cfacf5ba40e163ca7b80dfcd86ffa2152bd2 | Python | 8,340 | 225 | """ Subclasses of the tensorflow.keras.Model class.
These objects should be hidden from the user
"""
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import tensorflow as tf
import logging
tf.get_logger().setLevel(logging.ERROR)
from apnet.layers import DistanceLayer, FeedForwardLayer
#################
tar... |
12220fc22afbff515f7a8a261aeabb764c07b623e8c6e65aea4443df81f1626b | Python | 8,342 | 170 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2' # reduce TF verbosity
os.environ['CUDA_VISIBLE_DEVICES']='0' #'-1' for CPU only
import argparse
import pickle as pkl
from Dataset import Dataset
from model import *
import time
start_time = time.time()
tf.keras.backend.set_floatx('float64') #to avoid numerical... |
4405aff2d8bcc08d86cd0b98d169336caa3354d4a9d63fdf265c0629802f65d7 | Python | 8,344 | 246 | from typing import Dict, Optional, List, Any, IO, Union
import logging
import copy as cp
import numpy as np
from scipy.spatial.distance import euclidean
import pandas as pd
import h5py
from argschema.argschema_parser import ArgSchemaParser
from neuron_morphology.transforms.tilt_correction._schemas import (
Input... |
97346a1e3afd013711be3260c965a37a727567f6ef7c0a576ffc61e8c11b5c2b | Python | 8,345 | 235 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 12 15:57:00 2019
@author: ju-bar
Peak fitting
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
from scipy.optimize import curve_fit
import emilys.functions.... |
c9acad7e1b377333fddf1a62d265e006c2a716fb49ef9fd210f20965b4a61b9b | Python | 8,348 | 177 | 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... |
d916a6eefc4300ed24cfb4d31e75f406f57a267ce95620fa347cec123975a896 | Python | 8,351 | 215 | r"""Layer B — enzyme turnover-number (k_cat) prediction.
``enzyme_kcat(sequence, substrate_smiles)`` predicts a turnover number in 1/s.
This is the protein-side input to the A↔B hinge: its output feeds
:func:`omicverse.synbio.ec_model` to rebuild an enzyme-constrained metabolic
model, so "edit the enzyme → re-solve th... |
f607adda9d2bc012a3d2f07dd341dd64541a344a2886d11343f285b927904595 | Python | 8,351 | 285 | from functools import partial
from math import atan2, cos, pi, sin
from os import makedirs
from os.path import isdir
from pathlib import Path
from time import time
from typing import Any
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
import squidpy as sq
from anndata import ... |
fddc89a88a01a2970ab9d4c917c318434a21b65bc036031630368199e33a715c | Python | 8,352 | 258 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 21 21:43:47 2024
@author: Leyang Xue
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
from utils import kcorePercolation as k... |
f9f322d1b4493184c859378e0b85a69638e93c5a9089c007f43dc703fb48bd42 | Python | 8,356 | 206 | from typing import List, Tuple
import numpy as np
from scipy import signal as sgn
import torch
def check_mutual_exclusive(masks:dict):
"""Checks that the masks do not overlap (are mutually exclusive).
Args:
masks (dict): Dictionary containing all the masks
Raises:
ValueError: If the masks... |
e1f34570a0a17819393d86150c5b5863b21dff29335235f05534e3aace0d9c02 | Python | 8,364 | 275 | from __future__ import print_function, unicode_literals, absolute_import, division
import os
import numpy as np
import json
import collections
import platform
import random
from six.moves import range, zip, map, reduce, filter
from .six import Path
def is_tf_backend():
from .tf import keras_import
K = keras_... |
7ec9bdedb7b72b675d16ecc9992fe1b39d1e00c5724bb69af7dc635666e92512 | Python | 8,371 | 189 | ####################################################################################################
# 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... |
8847444badabdf1f1ee304b9734392ed069e7e7f83e71837e039faf85cb1c5d8 | Python | 8,373 | 206 | import sys
import json
import torch
import pickle
import argparse
import numpy as np
from tqdm import tqdm
from lop.algos.bp import Backprop
from lop.nets.conv_net import ConvNet
from lop.nets.conv_net2 import ConvNet2
from lop.algos.convCBP import ConvCBP
from torch.nn.functional import softmax
from lop.nets.linear im... |
3cbc5c7f4c5beadf9cf4bf4592bda8374c5e17584f4849719351ebb12eac6bab | Python | 8,378 | 287 | import mrcfile
import os
from os.path import join, basename
import subprocess
from shutil import move as mv
from glob import glob
import numpy as np
from contextlib import contextmanager
@contextmanager
def cd(newdir):
"Context manager to temporarily change the working directory"
prevdir = os.getcwd()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.