sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
acd618cb49cdb86561cc5cb371b89162ffbee6b07effc4d86d831365d3ecb8ba | Python | 8,378 | 259 |
import pdb
from scipy.io import loadmat
import numpy as np
import torch
from data_assimilation.oracle import ObjectStorageClientWrapper
from data_assimilation.particle_filter.base import BaseForwardModel
from latent_time_stepping.utils import (
load_trained_AE_model,
load_trained_time_stepping_model
)
impo... |
4d79432e114ebdb172a4c2c536b832eb5eaea29bd5fe9743465662b676f4b2b0 | Python | 8,379 | 211 | from matplotlib import pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
from pylab import *
from scipy import optimize
from pyprind import prog_percent
import numba
from numba import jit
import random
from luminance_analysis.utilities import *
from luminance_analysis.plotting import *
@jit(nop... |
afbe0c3932edf2ebd1fa5ba4325d92a11839d27e1784ae1875cb705d893c0c31 | Python | 8,379 | 251 | """
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.
Evaluate force MAE on the public OMol25 validation set.
This script can be run in three modes:
- prepare: selects unique ωB97M-V structures and... |
3ea7a526422f457a4055ce1c7c29982fb44de0fd46fa4356fb31d01fc96e695a | Python | 8,381 | 220 | from __future__ import division
from .. import gpu_utils
from ..distributions import *
import scipy as s
import numpy as np
# Import manually defined functions
from .variational_nodes import MultivariateGaussian_Unobserved_Variational_Node
# Z_GP_Node_mv
class Z_GP_Node_mv(MultivariateGaussian_Unobserved_Variational... |
782d35cbbc33ac71fd96c268c241989c83a29a306be93b488c1d5d62e97edc09 | Python | 8,381 | 190 | # Copyright 2022 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... |
22b099bf8ad9b0ba8238bdd9ec0b65dd36cb9f0bae5408766f0aa81d30041b43 | Python | 8,385 | 212 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Conversion script of legacy checkpoints (pre v0.8) to the new format."""
# pylint: disable=too-many-locals, too-many-statements, too-many-branches
from typi... |
ab1d5b8b39ae5550a4c96747e09d82a3023e43bd50415870be8d8b8f500c7651 | Python | 8,386 | 191 | """
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 os
from typing import Literal
from pymatgen.entries.compatibility import MaterialsProject2020Co... |
2d14c252eae4c8de9a093e0463eea26697043e2dfd7dc9aae4a68ac03ab3115b | Python | 8,389 | 222 | r"""WSI IO and tiling — thin wrappers around :mod:`wsidata` / :mod:`lazyslide`.
All meaningful logic lives upstream; this module exists so users do not have
to learn the LazySlide API surface to use ``ov.space.histo``. When you need
the full LazySlide control plane, drop down to ``zs.pp.*`` / ``zs.tl.*``
directly on t... |
eea708b27cc8b87040baf50aa8fb887f4867c6cbd0b6c62ef31845d91d97f54f | Python | 8,390 | 222 | r"""Typed result objects for :mod:`omicverse.mol.md`.
:class:`MDSystem` is a simulatable system (topology + forcefield-built
``openmm.System`` + coordinates); :class:`MDTrajectory` is a handle on a
produced trajectory plus the metadata needed to reproduce it.
Both carry a ``provenance`` dict — engine versions, forcef... |
c69d64561aba6ebd7f9c18d58a0c1e20391cbb779cbc140453aa5b842793caca | Python | 8,392 | 238 | '''eval trained models on the valid files'''
import os
import glob
import time
import pickle
import torch
import argparse
import torch.nn as nn
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import itertools
from tqdm import tqdm
# from model import CGRU as Agent
from model... |
da203f8d79727dfa9cb72be69df1762e8176dae6238aa5f18f2f478d053d8429 | Python | 8,395 | 278 | """UCSC Genome Browser API client."""
import logging
from typing import Any, Dict, List, Optional
import json
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class UCSCClient(BaseAPIClient):
"""Client for UCSC Genome Browser REST API.
The UCSC Genome... |
f5528ac051308d1b3ca352e95c30d5592d65614e15bffe01c5adc0b59d5c3505 | Python | 8,396 | 263 | # Modified from https://github.com/open-mmlab/mmdetection/tree/3.x/
import os.path as osp
from argparse import ArgumentParser
import numpy as np
from mmengine.fileio import load
def print_coco_results(results):
def _print(result, ap=1, iouThr=None, areaRng='all', maxDets=100):
titleStr = 'Average Precis... |
5317a1bea72f52fd7cd73a9c31a744f07935ea980c85e608e879edeef859c5eb | Python | 8,397 | 278 | """UCSC Genome Browser API client."""
import logging
from typing import Any, Dict, List, Optional
import json
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class UCSCClient(BaseAPIClient):
"""Client for UCSC Genome Browser REST API.
The UCSC Geno... |
9cc2cda29174bccdb295f60052fa59a032b3ccdd40630bdc5b01bcb894187e33 | Python | 8,398 | 159 | import json
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
from general_utilities.simulate_malfunction import jitter_trials, shuffle_triggers
from general_utilities.data_helper_function import find_nearest_ind, create_epochs, compute_t_stat, compute_fsize
fr... |
9e56e3ad8dd437fca728d9d8ae257a37f923eb640d703fda53a955f91d4c25ce | Python | 8,400 | 214 | #
# 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... |
6c70ca1ecaa30c484593870afd29725f681b04b58c43d881217d8f7558e18c07 | Python | 8,401 | 235 | import json
import math
import multiprocessing as mp
import os
import pickle
import sys
from itertools import repeat
import numpy as np
import torch
from rdkit import Chem
from torch_geometric.data import Data, InMemoryDataset
from tqdm import tqdm
from .molecule_contextual_datasets_utils import MolVocab, atom_to_voc... |
111b5fabb07bdaea5d52d5341120e9d828371927709168951ca79973adc9f7c3 | Python | 8,404 | 206 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
c0f7cdaf7aaf005a7275e46662a40f6070f4702a5ec2403b79fb1773491c6773 | Python | 8,406 | 254 | import sys
from glob import glob
import skimage
from skimage import measure
import nibabel
import numpy
import os
from math import floor
import argparse
#
def remove_inner_surface(img_data,mask,treshhold=0):
"""
Replace inner data of the given volume with a smoothed, uniform masking to avoid generation
of inner surf... |
9a6ea9bf56efd0271a854d3317c43bae9857685cacb2baeb1a38b24f75ba9595 | Python | 8,410 | 187 | #!/usr/local/bin/ipython -i
from mozaik.experiments import *
from mozaik.experiments.vision import *
from mozaik.experiments.optogenetic import *
from mozaik.sheets.population_selector import RCRandomPercentage
from parameters import ParameterSet
from copy import deepcopy
def create_experiments(model):
return [
... |
712b2fb549418ae5fcf16141295a2dcc087dca565c22cdfadf02c12c38827e8f | Python | 8,412 | 273 | import ray
from ray.dashboard.memory_utils import (
MemoryTable,
MemoryTableEntry,
ReferenceType,
SortingType,
decode_object_ref_if_needed,
)
"""Memory Table Unit Test"""
NODE_ADDRESS = "127.0.0.1"
IS_DRIVER = True
PID = 1
OBJECT_ID = "ZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZg=="
ACTOR_ID = "fffffff... |
af4e7f89bca778596f61e92eb2d7f729a3c6e10018ebd3e12975df01e27fd922 | Python | 8,413 | 166 | from time import time
import numpy as np
from batchgenerators.augmentations.crop_and_pad_augmentations import crop
from batchgenerators.augmentations.utils import pad_nd_image
from batchgenerators.dataloading.data_loader import DataLoader
from batchgenerators.dataloading.multi_threaded_augmenter import MultiThreadedAu... |
043829242de2c38b1944c21bbc5be453c02fb8d50893b052a9d0b5867037d0db | Python | 8,415 | 209 | # --------------------------------------------------------
# SimMIM
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# Modified by Zhenda Xie
# --------------------------------------------------------
import os
import torch
import torch.distributed as dist
i... |
f72d32a66a44822dcebd8ed91f5becf56167836a28e831c4b6d42dafe46d9b61 | Python | 8,415 | 242 | # 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... |
c32839f93dd21dcd263bd20a8b482f9aeec4c4380538a63f8fc7ada86d21588f | Python | 8,417 | 249 | r"""Layer C — DNA design: codon optimisation (DNAchisel) and PCR primer design
(primer3).
Given a protein or coding sequence, produce a host-optimised DNA sequence
respecting codon usage, GC content and forbidden restriction sites; then design
validated primer pairs to amplify it. Both are CPU-only.
"""
from __future... |
13cec7c24b8751c0bdb313d6d236243eb7592dbb615bb1c5612c428d6db51d7f | Python | 8,418 | 276 | # -*- 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 15: hardware-aware training of analog RNN model.
This experiment performs hardware-aware training of an analog RNN on
a simple temporal seque... |
39bf199a6061747abb73112044acee1a44e4a6a523dda5f95210725c7b09cf3e | Python | 8,418 | 211 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
df77e12a26aa3056b1f0e99c635d3bd587dcee566d7c45a71e3c7ef3ab8d1d0d | Python | 8,418 | 238 | """Utils for pandas DataFrames."""
import hashlib
import re
import unicodedata
import warnings
from pathlib import Path
from typing import Any, Optional
import pandas as pd
from pandas.core.util.hashing import hash_pandas_object
def warn_read(extension: str) -> None:
"""Warn the user when an extension is not sup... |
185d80223dfa06e73c322008ccf4ae174aee095b2b325ef6966cbbda398e590f | Python | 8,419 | 229 | import numpy as np
import torch
import torch.nn as nn
from torch_geometric.nn import ChebConv
from src.tools import string_to_list
class LRUnivariate(nn.Module):
"""Univariate multi-layer perceptron model.
Each node is treated independantly, thus it is equivalent to learning a different MLP
for each node... |
596667fae3656c6c723631a4dc4e9aff095c87b5582a08c9c49e5d3e5b15b613 | Python | 8,420 | 222 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from http import HTTPStatus
from typing import ClassVar
import pytest
from cvat_sdk.api_client.api_client import ApiClient, Endpoint
from cvat_sdk.api_client.exceptions import ForbiddenException
from deepd... |
beddfb3d86a41007c08b2cfd9238d5fbf431632d3824805154f8f8945a694624 | Python | 8,420 | 233 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import gzip
import sys
import os
import math
import numpy as np
TP='tp'
FP='fp'
FN='fn'
def parse_args():
parser = argparse.ArgumentParser("Produce a BED based on VCF calls")
parser.add_argument('--tp_vcf', '-tp', dest='tp_vcf', requi... |
16a3ce28cc856c46a9426e6fb6e26b268587abb728a23261875947a1b6c33252 | Python | 8,424 | 252 | import logging
import zarr
import sys
from pathlib import Path
from typing import Tuple
import click
import numpy as np
import pandas as pd
import yaml
from tqdm import trange
from deeprvat.deeprvat.associate import load_one_model
logging.basicConfig(
format="[%(asctime)s] %(levelname)s:%(name)s: %(message)s",
... |
e419360d6e3c6fa9adc7fab82a7b9bfffd19a832394ab52526f9ca488b8ee5f7 | Python | 8,425 | 205 | import argparse
import pickle
from typing import List
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 lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct
from lib.da... |
1740b941c0c66718e1a4e65eaff5c7edd885c196dafe513c34a4fd662bf61738 | Python | 8,430 | 235 | import numpy as np
from utils import random_ortho_mat
class PEKNN():
'''a prediction error based 1NN
if PE is high, it make a decision between
- assigns new input to the cloest exisiting cluster
- or create a new cluster
else, it assigns new input to the previous cluster
'''
def __i... |
28ac119d32e90aad66589c5821810732488b4e035f55cfc4592cf631564e4949 | Python | 8,430 | 283 | #Code to evaluate ResNet-Cox model
# Load libraries
import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.models import DenseNet
import PIL
import matplotlib.pyplot as plt
import cv2
import numpy as np
import sys, glob
import time
import math
impo... |
9b4351b2a10fb39ccc91fbb068505accb976dc31c4a6578677b7d30287c4b68f | Python | 8,432 | 237 | """Automatic K selection for CellCharter via clustering stability.
Implements the ClusterAutoK algorithm from the CellCharter package:
for each candidate K, runs clustering multiple times and measures
pairwise stability (Fowlkes-Mallows score) between adjacent K values.
The K with highest stability is selected.
"""
f... |
a5ced7f09782f050bb68ecba01dd8cac1738a363ceb16ae17c2123f4cf9cf057 | Python | 8,435 | 252 | ####################################################################################################
# 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... |
bee64f11dd369bf9df1e4f77a6416cca3e8bf3ba2ef4248cdce78f3b2a18b652 | Python | 8,435 | 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 1: simple network with one layer.
Simple network that consist of one analog layer. The network aims to learn
to sum all the elements from one ... |
e1aa43e14c9a6f5af931395c6d0188dca1e0669a99571e7bcade00f096b5d844 | Python | 8,436 | 180 | ####################################################################################################
# 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... |
374259417fc70c1f24dfa92f32abbc2b5348dacd0ebc61a967d7aabaa7b1996c | Python | 8,437 | 225 | #!/usr/bin/env python
from __future__ import print_function
# batteries
import os
import sys
import gzip
import bz2
import argparse
import logging
import csv
import urllib.request
import codecs
from collections import OrderedDict
class Graph(object):
def __init__(self, graph_dict=None):
""" initializes a ... |
f3e816eec62dfb983d093f5eb20988e28b1edf99a07737b39ef02e2ae04f17f4 | Python | 8,442 | 251 | """
From https://github.com/ehoogeboom/e3_diffusion_for_molecules/
"""
import numpy as np
import logging
import os
import urllib
from os.path import join as join
import urllib.request
from src.datamodules.components.edm.process import process_xyz_files, process_xyz_gdb9
from src.utils.pylogger import get_pylogger
... |
2ba8a9325f7bed4b9ff95e0250ea9c6ddd0ef0b18d7fe2f798e215a23665b846 | Python | 8,443 | 275 | import numpy as np
import scipy.stats as stats
from scipy.special import gammaln
from scipy.optimize import newton, brentq
from lib5c.util.mathematics import gmean
from hic3defdr.util.printing import eprint
from hic3defdr.util.progress import tqdm_maybe as tqdm
def logpmf(k, m, phi):
"""
Log of the PMF of t... |
ed22b341c391c75c66b8825924bfb709c047600bfe23014c22b3c239c103b0bf | Python | 8,448 | 252 | """
Plot a latent mean projection.
"""
__date__ = "July 2019 - December 2020"
try: # Numba >= 0.52
from numba.core.errors import NumbaPerformanceWarning
except ModuleNotFoundError:
try: # Numba <= 0.45
from numba.errors import NumbaPerformanceWarning
except (NameError, ModuleNotFoundError):
pass
import matplo... |
d45bc48b72274d78cadba8fe64336ff10d64558988bf0c6be56c61abf0fe33c6 | Python | 8,449 | 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... |
773b8a3cc91ae93d493c81828130a9cadba8dab35d242c0ee07c7d5258067a7d | Python | 8,454 | 212 | import copy
import json
import numpy as np
import random
import time
import torch
import matplotlib.pyplot as plt
from glycowork.ml.model_training import EarlyStopping, disable_running_stats, enable_running_stats, training_setup, Poly1CrossEntropyLoss
from glycowork.ml.models import init_weights
from candycrunch.model... |
da4f52c141f10ec0276b1b00b68d873f3d4f1e9845f5ad71a5dd92c3b760b601 | Python | 8,456 | 238 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# Imports
import matplotlib.pyplot as plt
... |
a0b7b58188e6faf45b6717fc8074e373ddbbb6a26d3d867b6b0ea32856f08160 | Python | 8,458 | 191 | # -*- coding: utf-8 -*-
"""
# SCRIPT: CREATE BINARIZED MASKS FROM SEGMENTED FUNCTIONAL IMAGES
# PROJECT: FMRIREPLAY
# WRITTEN BY LENNART WITTKUHN, 2018 - 2019
# REVISED BY QI HUANG 2022
# CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY
"""
# In[1]: IMPORT RELEVANT PACKAGE... |
db47f317841d2fc8aafeb7bc7b2cf6013b98ecf130ae8d07d6a91e343eaf67d7 | Python | 8,460 | 256 | import os
import sys
import tempfile
from types import ModuleType
import pytest
from ci.ray_ci.doc import cmd_check_api_discrepancy as cmd
from ci.ray_ci.doc.mock.mock_module import MockClass, mock_w00t
_MOCK = "ci.ray_ci.doc.mock.mock_module"
_CANONICAL_W00T = f"{mock_w00t.__module__}.{mock_w00t.__qualname__}"
_CAN... |
1e71ae1ec9a07d48262c6d7ade94db29066539bb4484bc13d604c5a5fffa567b | Python | 8,462 | 249 | # Author: Xiangtai Li
# Email: lixiangtai@sensetime.com
# Date: 2020/7/1
# Partial Order Pruning: for Best Speed/Accuracy Trade-off in Neural Architecture Search (CVPR2019)
from __future__ import print_function, division, absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
from network.... |
a47927af5ecb03e243b7111e6798594a55bc61a444123e1cd971a217941fffca | Python | 8,463 | 205 | ####################################################################################################
# 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... |
b74aa44b36868f29bb31bf55f65224355b78520653e31f30ae8279d33bd68a6d | Python | 8,469 | 204 | """
Stub model wrappers for registered foundation models without local runtimes.
"""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Optional
import numpy as np
from anndata import AnnData
from .base import ModelExecutionBlockedError, SCLLMBase
... |
e37c2116b75b630d0ba4cb6c1bfde1398ec36f2d1e783f0cbad21d4f392fd7c4 | Python | 8,469 | 237 | """
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 os
import numpy as np
import pytest
import torch
from ase import Atoms, db
from ase.io import r... |
cdbbd844ad689f264eeac9e8b30e3069542a55091f87c77809f0d2593a1f2df5 | Python | 8,470 | 262 | import logging
import os
import subprocess
import sys
import time
from unittest.mock import MagicMock, patch
import pytest
import ray
from ray._common.test_utils import wait_for_condition
from ray._raylet import GcsClient
from ray.autoscaler._private.fake_multi_node.node_provider import FAKE_HEAD_NODE_ID
from ray.aut... |
efa1fc276ddf2397072d60b261bd1f2e0b744b181484123bfab816f97c59d617 | Python | 8,478 | 199 | # Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
# William Peebles and Saining Xie
#
# Copyright (c) 2021 OpenAI
# MIT License
#
# 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 wi... |
b8f55961ad0ed8b136381f314a1e7aa8323ea0378eeaa9454d249d37ccd593d8 | Python | 8,479 | 200 | import torch
from typing import Dict
from typing import Tuple
import torch
from funasr.losses.label_smoothing_loss import LabelSmoothingLoss
from funasr.models.predictor.cif import mae_loss
from funasr.models.predictor.cif import CifPredictorV2
from funasr.models.encoder.sanm_encoder import SANMEncoder
from funasr.mo... |
3c355e6ca8dfddac1ee8354331a6708e5f1316337b6eff4b807f40492e1a6df2 | Python | 8,480 | 291 | import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
from scipy.cluster.hierarchy import leaves_list
# Optional marsilea import for enhanced visualization
try:
import marsilea as ma
import marsilea.plotter as mp
from matplotlib.colors import Normalize
MARSILEA_AV... |
4d2bf39127f89fca566729da3533ea6e4c6785591473274f48e6f7438430f5f4 | Python | 8,481 | 208 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import numpy as np
import scipy.stats as ss
import pandas as pd
import sys
from .pesr_test import PESRTest, PESRTestRunner
class SRTest(PESRTest):
def __init__(self, countfile, common=False, window=50, ins_window=50, medians=None):
self.countfile ... |
171f499ba69464ec943147a0eec051455ee975690ca6bf2dc2822995e6452a74 | Python | 8,482 | 148 | # -*- coding: utf-8 -*-
"""Main script for rolling-shutter DiffuserCam reconstruction with neural space-time model."""
import os
import numpy as np
from absl import app
from absl import flags
from jax.config import config
import jax
import jax.numpy as jnp
from flax import linen as nn
import calcil as cc
import imagei... |
ce8a29d978d6b6e537aecd5be0f53bd47fdee41b733b45b34346a4d9ae2cef71 | Python | 8,483 | 178 | ####################################################################################################
# Copyright (c) 2019, 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 free softw... |
b69b18c72e1ea9451fea478c26bbf62127137f2696f079f056c4ce228476cdc1 | Python | 8,484 | 237 | import os
import pickle
import torch
from torch.utils.data import DataLoader, Dataset
from datasets import load_from_disk
from .collators import DataCollatorForMultitaskCellClassification
class StreamingMultiTaskDataset(Dataset):
def __init__(self, dataset_path, config, is_test=False, dataset_type=""):
... |
8aeb97b6178315252d296df0b43f4742d71f1c85137583acc406c6f9cf0f8ac7 | Python | 8,486 | 236 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Identify the ENSEMBL canonical transcript for each protein-coding Gencode gene.
ENSEMBL determines the canonical transcript based on the following hierarchy
(definition obtained from http://www.ensembl.org/Help/Glossary?id=346):
1) Longest CCDS translation with ... |
7f533ce87423eca0c067b3a23347cce70b57965c4cb1e679b165d803201870bc | Python | 8,489 | 241 | # 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 logging
import os
import numpy as np
from unicore.data import (
Dictionary,
NestedDictionaryDataset,
AppendTokenDataset,
PrependTokenDataset... |
aebed054f90c30c893b4d7c0a22fa32d92b59b22e8228e9d8848b5f93e621261 | Python | 8,490 | 248 | ####################################################################################################
# Copyright (c) 2020 - 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... |
e6dea754f81f67f684913f56dec8701f45e00adda5a40a8da8fb71c7b7de6b97 | Python | 8,492 | 277 | # flake8: noqa
# __normal_example_start__
import torch
import ray
@ray.remote
class MyActor:
def random_tensor(self):
return torch.randn(1000, 1000)
# __normal_example_end__
# __gloo_example_start__
@ray.remote
class MyActor:
@ray.method(tensor_transport="gloo")
def random_tensor(self):
... |
2e7eb8aac068e2cac0eb3d55f4965edd2ee226515f131729d7da4b6888172a34 | Python | 8,493 | 205 | """Graph prep + embedding initialisation — faithful to umap-learn 0.5.7.
Everything here runs on CPU/NumPy/SciPy (it is cheap, deterministic, and
matching the CPU path here matters more than speed): graph dedup/prune,
``make_epochs_per_sample``, spectral / random / pca / array init, and the
mandatory ``[0, 10]`` resca... |
a3653a0641b326cbb384b28e5738f68cf03845444eff82253c3a81c81b969bb0 | Python | 8,494 | 184 | import argparse
import cv2
import glob
import os
import numpy as np
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.utils.download_util import load_file_from_url
from realesrgan import RealESRGANer
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
def main():
"""Inference demo for Real-ESRGAN.
... |
5649e395d3e657264b34e368c1781e0e92b04638998444c42fb7b4519e0c8c7f | Python | 8,495 | 311 | """This script trains a NeuralNetClassifier on MNIST data, once with
skorch, once with pure PyTorch.
Apart from that change, both approaches are as close to eachother as
possible (e.g. performing the same validation steps).
At the end, we assert that the test accuracies are very close (1%
difference) and that skorch ... |
fc095a09e3bc5201ae4c7d5dacf2d4c2a6407402e23d499385928fff16aaa350 | Python | 8,495 | 254 | """Web tool handlers: fetch, search, and download.
Extracted from ``tool_runtime.py`` during Phase 3 decomposition.
These are pure functions with no ``ToolRuntime`` or ``AgentContext``
dependency — they only use stdlib networking.
"""
from __future__ import annotations
import os
from typing import List, Optional
d... |
39e2d16216a87c1bce75ea496c147c61008c275f13bf88bb1eea623b79b6d00f | Python | 8,496 | 179 | import numpy as np
from batchgenerators.examples.brats2017.config import brats_preprocessed_folder, \
brats_folder_with_downloaded_train_data, num_threads_for_brats_example
from batchgenerators.utilities.file_and_folder_operations import *
try:
import SimpleITK as sitk
except ImportError:
print("You need t... |
5a9f60480fc93c7625cd9f2f97ea2d06be085aa5fcbed32b553620c89004c7f6 | Python | 8,496 | 263 | """Functions related to SVD."""
# Copyright (c) 2024 Valentin Goldité. All Rights Reserved.
# Inspired from https://github.com/scikit-learn (BSD-3-Clause License)
# Copyright (c) Scikit-learn developers. All Rights Reserved.
from typing import Optional, Tuple, Union
import numpy as np
import torch
from torch import T... |
cf01b2b8c9d13b100b69bbd6dc5ea424ffd128e9253241098f85bfac47798512 | Python | 8,496 | 23 | from pathlib import Path
import pandas as pd
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
if __name__ == "__main__":
file_name = cache_file(
"nza_01_DBC.csv", "https://www.opendisdata.nl/download/csv/01_DBC.csv"
)
df = pd.read_csv(file_name, low_memo... |
e0a2a07cc5e440267c9353b9a546d629d5e70fb8fdc43a9ee6d873ef39306573 | Python | 8,497 | 198 | from email.policy import default
import bpy
from datetime import datetime
#Import class definitions
from . ClassDefinitions import NeuronAnalysis
from . ClassDefinitions import ExplodingBits
from . ClassDefinitions import ManualLength
from . ClassDefinitions import WriteNWB
from . ClassDefinitions import SpineSlicer
f... |
bf6bbbda33d60d01e1565e2091a6ee8da0c565a8c5bc8bdd3c0277ae46b8e59d | Python | 8,501 | 219 | #!usr/bin/env python
from svtk.baf.BAFpysam import *
import argparse
from collections import deque
import numpy as np
import pandas as pd
import pysam
import sys
##########
def preprocess(chrom, start, end, tbx, samples, window=None, called_samples=None, outlier_sample_ids=None):
"""
Report normalized BAFs in... |
d1e8682dc14474d6188e8b431fdad9793e71f535f7d785b1027008e0f039680e | Python | 8,501 | 233 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import os
import uuid
from datetime import datetime, timedelta, timezone
import clickhouse_connect
from django.conf import settings
from rest_framework import serializers, status
from rest_framework.response import Response
from rest_fram... |
119a35f669850d432c4eb337529c0fb58989a59022702fe40af8fb1b518a9e50 | Python | 8,503 | 306 | """ Utilities (mainly the FeatureWriter class) used by the feature extractor
executable to format and write outputs.
"""
import os
import copy as cp
import logging
import warnings
from typing import (
Optional, Any, Dict, List, Iterable, Callable, NamedTuple, Union
)
import h5py
import pandas as pd
import numpy... |
376bf8984ef794ce5aaaa2f4c1e092964bc423683f98be55a796ee105673f610 | Python | 8,503 | 214 | r"""Layer B — protein sequence & backbone design.
* :func:`inverse_design` — ProteinMPNN inverse folding: given a backbone (PDB),
sample sequences predicted to fold to it. Runs on CPU (slower) or GPU.
* :func:`denovo_backbone` — de-novo backbone generation with RFdiffusion
(optional / heavy; gated behind an actio... |
0b439096f682cfc9b36103bc2d7ccb1600c16871094380b2f26aed4ade254fc3 | Python | 8,504 | 251 | """Direct chunk export and completed-shard merge integration."""
import json
from types import SimpleNamespace
import numpy as np
import pytest
import yaml
from mozaik.meta_workflow import experanto_export as workflow
from mozaik.tools.experanto_merge import merge_experanto_shards
def _read_yaml(path):
return ... |
1076fe91cebd5c3d100d33235332c832ace2fdfd5cdedcdaa8b774beee5dba52 | Python | 8,504 | 237 | from __future__ import annotations
from types import MappingProxyType
from typing import TYPE_CHECKING
from warnings import warn
import numpy as np
from anndata import AnnData
from scipy.sparse import issparse
from ..._settings import EMOJI, Colors
from .._highly_variable_genes import check_nonnegative_integers
from... |
6d8a286d925bc9a1c5e0064b18e0bbc655220d99ae9fd5190884e40d1215d0e1 | Python | 8,504 | 195 | import torch as th
import torch.nn as nn
from tqdm.auto import tqdm
from .anvi_dataloader_nogcn import ANVIDatasetNoGCN
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... |
9de3322ddc1e036d10e30a15266d88afc0a2cddf729cf1c25fbc7c92b8d1ee69 | Python | 8,505 | 276 | import numpy as np
import pandas as pd
import dabest
cond_means = {'control': 0, 'test': 2}
scale = 1
n_data = 64
data_dict = {
cond: np.random.normal(loc=cond_means[cond], scale=scale, size=(n_data,))
for cond in cond_means.keys()
}
df = pd.DataFrame(data_dict)
df['ids'] = np.arange(n_data)
df.head()
# Lo... |
14ce2307f0fae09df3894e8e33b4ab4cdf294edf4079a423063c88f018a57a52 | Python | 8,508 | 161 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
import seaborn as sns
from sklearn import svm
# define a function to calculate precision, recall, F1 score, and queue rate
def calculate_metrics(threshold, true_labels, predict_probabilities):
predictions = (predict_prob... |
15553beeedcf61b3a4a7e52480e340bbda9c4d3bb3c85c00dd5e11c2f7aacbcf | Python | 8,508 | 219 | """Convert aggregator ``RayEvent``s into the ``TaskEvents`` storage model.
"""
from typing import List, Tuple
from ray._raylet import TaskID
from ray.core.generated import gcs_pb2
from ray.core.generated.common_pb2 import FunctionDescriptor, TaskInfoEntry, TaskType
from ray.core.generated.events_base_event_pb2 import ... |
c13c317cd89172c9a3aacdb4941e9a84e1ebf2e92336f42f402d4dd7c732033c | Python | 8,508 | 285 | """IO tool handlers: filesystem read/edit/write, glob, grep, notebook.
Extracted from ``tool_runtime.py`` during Phase 3 decomposition.
These are stateless handler functions that receive the ``AgentContext``
(and optionally a plan-mode checker) as explicit parameters.
"""
from __future__ import annotations
import js... |
0ebb961390626805b8d23752a2bde13289fc1f938e91f38d216845b1a88e22d0 | Python | 8,509 | 224 | """GPU port of umap-learn's ``fuzzy_simplicial_set`` (smooth_knn_dist +
membership strengths + fuzzy set union). All ops run in torch on the device
of the input KNN tensors; nothing leaves GPU.
Algorithm reference: McInnes et al. UMAP §3 + the ``umap.umap_`` source.
We track the same defaults as umap-learn: ``local_co... |
5e97cda7611e95da55956352dc6968a32334888d779f694901e5b197ff1a2baa | Python | 8,510 | 232 | from numpy.random import seed
seed(1)
import tensorflow as tf
tf.random.set_seed(1)
import random
random.seed(1)
import tensorflow as tf
import csv
import numpy as np
import SimpleITK as sitk
import matplotlib.pyplot as plt
from numpy import argmax
import pandas as pd
import tensorflow.keras.backend as K
... |
555072e1ef99786445f87ab29128bb5863d59feff065b942d494d236ac479249 | Python | 8,513 | 251 | import copy
from collections import deque
from collections.abc import Mapping, Sequence
from typing import Dict, List, Optional, TypeVar, Union
from ray.util.annotations import Deprecated
T = TypeVar("T")
@Deprecated
def merge_dicts(d1: dict, d2: dict) -> dict:
"""
Args:
d1: Dict 1.
d2: Dict... |
a798070bab07cf23dc358ee60e7b774dc22078f1d4b177a23c72337c039ec7c5 | Python | 8,514 | 221 | import matplotlib.pyplot as plt
import numpy as np
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import numpy as np
from sklearn.decomposition import PCA
def plot_RT_histogram(rts, DI=None, bins=None, ax=None, cmap=None, lw=1, legend=None):
"""
rts: r... |
6e77afa0b5882fa0a6610be445197c7d5ab51aa49561f12e760cb2d38bc2daf8 | Python | 8,515 | 159 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
import seaborn as sns
from sklearn import svm
# define a function to calculate precision, recall, F1 score, and queue rate
def calculate_metrics(threshold, true_labels, predict_probabilities):
predictions = (predict_prob... |
39c2c071bb17a669ab7c112fdde7892f173d70d9289e04b278b823c3fbb1e818 | Python | 8,518 | 222 | ####################################################################################################
# Copyright (c) 2020, 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 free softw... |
15cf6ffb97b47955b9435b21b1ca0319dea453ab8ae995d4cd91e365ba42cfb0 | Python | 8,519 | 208 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is to process DRUG-seq reads after tagging the bam file with well and molecular barcodes.
Input: BAM file with reads that have been filtered, polyA and SMART adapter trimmed, and tagged with the following:
- XW: well barcode
- XM: molecular barcode (UMI)
... |
13e85adcc367369dbc40568ecd7075941be335e5a9de8826443f1d08f06cd10b | Python | 8,524 | 195 | ####################################################################################################
# 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... |
3e5778dcca04e63fc88f45bee12711b8c50ade5356ad1033737661431e4a9aff | Python | 8,524 | 245 | """STRING API client."""
import logging
from typing import Any, Dict, List, Optional
from urllib.parse import urlencode
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class STRINGClient(BaseAPIClient):
"""Client for STRING database API.
STRING (Se... |
b520e7efb77e67b90be2a82fb2051f901de74c2ef1253ac4135401f21633e020 | Python | 8,529 | 199 | ####################################################################################################
# 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... |
bed184c91e3c5908f6b6853929cb5996af7165580bc5bc6a6b65e51c25c827b0 | Python | 8,531 | 266 | """Interface to control the cell-specific stimulus buffer for the network."""
from typing import Any, Callable, Dict, Optional, Protocol, Type, Union, runtime_checkable
import numpy as np
import torch
from numpy.typing import NDArray
from torch import Tensor
from flyvis.connectome import ConnectomeFromAvgFilters
__... |
cf5c285c6f158a1f1644a5c46b7b0599f7a064204ca01f3b4eff8a5a215a62ab | Python | 8,532 | 224 | import logging
import os
import csv
from typing import List, cast
import numpy as np
from deprecated.classic import deprecated
from transformers.models.bert.tokenization_bert import BertTokenizer
from utils.logger_utils import get_custom_logger
logger = get_custom_logger(__name__, level=logging.INFO)
class PaddingIn... |
210b9c4376e4e717d259373b7cef6264e063e60a2c667a55097b1eb3264fc5c1 | Python | 8,533 | 244 | ####################################################################################################
# Copyright (c) 2020, 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 free softw... |
9d069978fdf1d250d3f7e8be9e1f73ca90a299eeb29de85f7ce67087666529f9 | Python | 8,533 | 202 | #----------------------------------------------------------------------------------------------------------------------
# Author: Brandon S Coventry, PhD Wisconsin Institute for Translational Neuroengineering
# Date: 20260716
# Purpose: Implement a Bayesian circular multiregression using angle data
# Revision Histo... |
9d6516acc9fc2c161054fe2afc514b5f308ab748332eef1402018f26bba886da | Python | 8,534 | 216 | # built-in dependencies
import unittest
# 3rd party dependencies
import cv2
import numpy as np
import pytest
# project dependencies
from deepface.commons.logger import Logger
# grpc is an optional dependency, install it with `pip install "deepface[grpc]"`
grpc = pytest.importorskip("grpc", reason="grpcio is not inst... |
46447574d94ab76676a8a550b043158bb322fbbfe7651d882251e958fb93a048 | Python | 8,535 | 189 | import numpy as np
from sklearn.preprocessing import normalize
import matplotlib.pyplot as plt
from scipy.stats import linregress
from matplotlib.collections import LineCollection
from .binning_and_plotting import bin_data
from matplotlib.colors import ListedColormap
import seaborn as sns
# domain_boundary_label='d... |
d32915e0c6f1905e740c5d5e4096f07ab419720f795460dcecc1fad9618f06f1 | Python | 8,535 | 167 | import os
import psycopg2
import numpy as np
def convert_coords_str(coords_str: str, resolution=None):
"""Convert a comma seperated string of coordinate pairs"""
vals = coords_str.split(',')
if resolution:
resolution = float(resolution)
else:
resolution = 1.0
x = np.asarray(vals[... |
e0c853438b7dd136c8b882d022841bff3f5bb4d881e83d9c5c4f6bc11dbc7d6d | Python | 8,536 | 272 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# skorch documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 13 11:29:12 2017.
#
# 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
# aut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.