sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4bd35fb8e6b7f6f3a27a63414d3697f73ca8b3ccc3bc6bfd4b1203b0c4dfce7d | Python | 35,148 | 994 | from typing import Iterable, Union, Tuple, List
from warnings import warn
import pandas as pd
import numpy as np
import gc
from scipy.sparse import csr_matrix, find, issparse, hstack
from scipy.sparse.linalg import eigs
#import mellon
import scanpy as sc
from .core import run_palantir
from .validation import _vali... |
07d38a4a04864457da4dd62c9cfab852b85ab81b38f5725f06325394193ad1b6 | Python | 35,177 | 1,037 | """
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 math
from pathlib import Path
import torch
import torch.nn as nn
from fairchem.core.models.uma... |
32ed1be9b97b9e369d7f267128b4d2cf44342d9e14154ee522345e90c9a9e392 | Python | 35,210 | 959 | import io
import math
import os
from collections.abc import Mapping, Sequence
from functools import partial
from typing import IO
import numpy as np
import pytest
from cvat_sdk.api_client import models
from PIL import Image
from pytest_cases import fixture, fixture_ref, parametrize
import shared.utils.s3 as s3
from r... |
80d50a6fe1a87f9cfc8fc34041cb22b4c75f3a72f8c5fa9c1d00e409e74d21a7 | Python | 35,270 | 770 |
import gym
import numpy
import random
import os
import queue
import pysted.base
from gym import error, spaces, utils
from gym.utils import seeding
from matplotlib import pyplot
from collections import OrderedDict
import gym_sted
from gym_sted import rewards, defaults
from gym_sted.utils import SynapseGenerator, Micr... |
468fe3d3a96dc1880a68e4bc273afdd1b0134b5e206f3f65b1c596d7dce67258 | Python | 35,280 | 898 | import scanpy as sc
import os
import torch
import time
import torch as th
import torch.distributed as dist
import numpy as np
class scDiffusion(object):
def __init__(
self,
adata,
device='cuda:0'
):
from ..utils import check_dependencies
check_dependencies(
... |
81423a161dbec608b3883a7f6455c75cfe79545b16fdd6a7420fee4c8087c2f0 | Python | 35,287 | 909 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Copy force trainer from https://github.com/Open-Catalyst-Project/ocp/tree/6cd108e95f006a268f19459ca1b5ec011749da37
"""
import logging
import ... |
a9f7ad06630acf5a77573464bdaba36515a7d69a8a87b52e479ed53ae195db86 | Python | 35,326 | 1,158 | """Plot functions for the profiling report."""
import copy
from typing import Any, Callable, List, Optional, Tuple, Union
import matplotlib
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.collections import PolyCollection
from matplotlib.colors import C... |
58002198041768d996aef63b19f21226f452c84f6a7d845e3ef2698b4c7af872 | Python | 35,353 | 899 | from __future__ import annotations
import warnings
from dataclasses import dataclass
from inspect import signature
from typing import TYPE_CHECKING, TypedDict, cast
from datetime import datetime
import numba
import numpy as np
import pandas as pd
from anndata import AnnData
#from fast_array_utils import stats
from .... |
530982bff6285bbeb7110b329daa1d7e74c371d8ab78a8b19f69a44b047c81a4 | Python | 35,377 | 869 | import argparse
import hashlib
import itertools
import random
import json
import logging
import math
import os
from contextlib import nullcontext
from pathlib import Path
from typing import Optional
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
from torch.utils.data import Dataset
from ac... |
86d78f2461c5fe5851c09d097daf511f89b0451f2dd35fdf33bec8cdb831ddfa | Python | 35,377 | 1,151 | # simplified version of the figure script.
# %%
import numpy as np
import pandas as pd
import support_funcs as sf
import seaborn as sns
from importlib import reload
from matplotlib import pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
... |
af76c764884d77bd419cf40638999be8e36cbdd053cbb3644389c155fefa2f3f | Python | 35,384 | 686 | import nipype.interfaces.ants as ants
import os
from nipype.interfaces.fsl import ApplyMask, GLM, MELODIC, FAST, BET, MeanImage, FLIRT, ImageMaths, FSLCommand
from nipype.interfaces import fsl
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError
def structural_rigid_affine(template="/Users/marksm/Gi... |
d9077874cb777383dd96587e8b0fc92bf5c4f00a1d4429ff4cd99e6ee8221bcc | Python | 35,413 | 941 | #!/usr/bin/env python
#Lexi Morrissey, Mahony Lab @ Pennsylvania State University
#Contains methods for read allocation procedure of Allo.
from Allo import predictPeak
import math
import random
import os
import contextlib, io
import logging
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
from tensorfl... |
ac5022de946b72f47fd1c2ff1030be8d94bce3da83f9a9fca2a5ecaae9a789fe | Python | 35,441 | 844 | import argparse
import hashlib
import math
import os
import random
from pathlib import Path
from typing import Optional
import numpy as np
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
from accelerate import Accelerator
from accelerate.logging import get_logger
from accelerate.utils import... |
0a4a0ea7e879b1b0e26de7d9670f6ed49ac8de76fa0fbbb3be07ebd986f562fe | Python | 35,462 | 910 | #!/usr/bin/env python3
import argparse
import os
import sys
import re
import math
import warnings
import time
import struct
from collections import defaultdict
import pandas as pd
import numpy as np
import hicstraw
import cooler
from mustache import kth_diag_indices, parseBP, read_bias, read_pd, read_hic_file, read_co... |
dcca128298075e759e4ec4bf764d71a360b7f6da421aeecd522302414d260182 | Python | 35,462 | 928 | # Copyright 2026 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, ... |
1d1ac3c84294febf396a69a210d6d4e892d38cf9d8dd3fb1c70d7f43134a3703 | Python | 35,498 | 906 | import logging
import random
import time
import uuid
from collections import Counter, defaultdict
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
import ray
from ray.air.execution._internal.event_manager import RayEventManager
from ray.air.execution._internal.tracked_actor import Tracke... |
ea3c6a4c963cac539ae8b0a799557914f4a6d275fdff98fa295ea64c83cc077b | Python | 35,560 | 800 | """Ray constants used in the Python code."""
import json
import logging
import os
import sys
from typing import Optional
from ray._common.utils import env_bool, env_float, env_integer # noqa: F401
logger = logging.getLogger(__name__)
def env_set_by_user(key):
return key in os.environ
# Whether event logging... |
98e7695340497f6e50a7c978bf8ca83a4c98fadcd4862cda7b1a70eeb5552cfe | Python | 35,577 | 1,113 | # 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, ... |
c0d5a1ea1dfb17957c38f5dccff0231cdfa687cb2ac29a62b8d287c5e9400d9c | Python | 35,593 | 970 | import logging
from contextlib import contextmanager
from itertools import product
from pathlib import Path
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as nnf
from datamate import Directory, Namespace, root
from tqdm... |
be39f370331b7d96ca97cbd1cb653249ac7301c085ba9c1f07bcd83384bcef2d | Python | 35,596 | 857 | # biolgca is a Python package for simulating different kinds of lattice-gas
# cellular automata (LGCA) in the biological context.
# Copyright (C) 2018-2022 Technische Universität Dresden, Germany.
# The full license notice is found in the file lgca/__init__.py.
"""
Classes for one-dimensional LGCA. They specify geomet... |
cc0901d262f8423affc80aa87db0e66cf3b0e64e5726efa6c3c186caa4a16e0a | Python | 35,608 | 871 | import numpy as np
def mahalanobis(X1, X2, S1, S2):
r"""Compute Mahalanobis distance between two cluster centers.
Parameters
----------
X1 : numpy.ndarray
Coordinates of the first center.
X2 : numpy.ndarray
Coordinates of the second center.
S1 : numpy.ndarray
Covarianc... |
4f283062d25c6e0dc97fdb3582dc9e3d41eee26b8ae7aff9021cd3da0f1938bd | Python | 35,637 | 994 | import csv
import gzip
import os
import time
from base64 import urlsafe_b64encode
from collections import defaultdict
from hashlib import sha1
from os.path import isfile
from pathlib import Path
from random import randint, random, sample, choices, shuffle
from random import seed as set_seed
from typing import Dict, Tup... |
2029d53be295fbcd3d319aa2d747d1874501e620cd0b1d74adf969297004956e | Python | 35,670 | 995 | import inspect
import json
import multiprocessing as mp
import subprocess
import os
from helpers import (get_fmriname, get_readoutdir, get_realdwelltime,
get_relpath, get_taskname, ijk_to_xyz)
class ParameterSettings(object):
"""
Paths to files and settings required to run DCAN HCP. Cl... |
2e1edf2b7470d64e09af7fc3c3616f19ad7940bb17783a864735352ad0b03ad5 | Python | 35,675 | 863 | # -*- coding: utf-8 -*-
"""
Run a whole Randomized Experanto experiment from one command.
python run_parameter_search_experanto.py run_experanto.py nest param_experanto/defaults \\
--data-root /path/to/dataset --n-trials 2 --n-chunks 5 \\
--mozaik-env /path/to/venv/bin/activate
builds the chunk li... |
1c42cfcbf6750df31b64ffbd615a358d496ff5dbe8af929972e4c533a76b0a3d | Python | 35,738 | 730 | # 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... |
0f95f0fb59d5547240734dc9d4f04432bded1de05a328a71afe47472860d48bd | Python | 35,764 | 889 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. 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/LI... |
e10112c1303264c41df1f281f7e246eeab8f83945a779b7cd410496f084e9845 | Python | 35,765 | 685 | from setup import *
def get_acq_final_days(df, criteria, correct_amount, session_length):
"""
This function returns the last days for the Acquisition test. The function grabs all the rows that meet the minimum
correct trials amount and the maximum session length amount. Then it calculates the first ... |
9270890afce20101439c8b850a23cfade7072e26ef81da655b3c983726231af9 | Python | 35,777 | 959 | from __future__ import annotations
from datetime import datetime
from pathlib import Path
from time import time
from .._registry import register_function
from .._settings import Colors, EMOJI
from ..report._provenance import tracked, note
class _gsmap_runner:
"""Small gsMap workflow runner for OmicVerse spatial... |
7e25cf0b4527603dd35f15f0986a9dea8a6fe33ac7e5a85b5f5c1f5d5b0c4fef | Python | 35,816 | 924 | #
# 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... |
62c199de518a69758d6d4ebd55d0f8c5fa3822560176456ef02dd94bf2617273 | Python | 35,821 | 814 | from typing import List, Tuple, Optional
import numpy as np
import scanpy as sc
import pandas as pd
import os
def construct_gem_expressions(adata: sc.AnnData,
gem_expr_key: str = 'X_gem',
scale_gem_expr: bool = True,
layer_key: Optiona... |
90a8532d017db0f5e720460375ee484409d68a00b54bf400f5dcc4cf2ea5a1ef | Python | 35,845 | 997 | import csv
import gzip
import os
import time
from base64 import urlsafe_b64encode
from collections import defaultdict
from hashlib import sha1
from os.path import isfile
from pathlib import Path
from random import randint, random, sample, choices, shuffle
from random import seed as set_seed
from typing import Dict, Tup... |
f29f46b40e41301923173342ad3042ed1fcb7d6ad2fe7f1b57f02f3ccfd2d462 | Python | 35,846 | 817 | """Kafka datasource for bounded data reads.
This module provides a Kafka datasource implementation for Ray Data that supports
bounded reads with offset-based range queries.
Message keys and values are returned as raw bytes to support any serialization format
(JSON, Avro, Protobuf, etc.). Users can decode them using m... |
a7b76172cd469cb17425646859595f1609022c5c1814b8c307881e7e76d7b471 | Python | 35,853 | 982 | """
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.
modified from torch_geometric Data class
"""
from __future__ import annotations
import copy
import logging
import re
from collections.abc imp... |
976baa810f54984d4ec4062adbc09d1bf14e2f1ab729357c00603cc722bd4017 | Python | 35,877 | 1,018 | """This is the module that is in charge of Ray usage report (telemetry) APIs.
NOTE: Ray's usage report is currently "on by default".
One could opt-out, see details at https://docs.ray.io/en/master/cluster/usage-stats.html. # noqa
Ray usage report follows the specification from
https://docs.ray.io/en/master/clus... |
52e1b64f4d398fd288fcf65e9d952d7b48f916e066f03b23182741c1d2dc6443 | Python | 35,938 | 946 | import pandas as pd
import random
import numpy as np
import torch
#from deepforest import CascadeForestClassifier
from sklearn.neighbors import NearestNeighbors
from scipy.linalg import solve
from sklearn.neighbors import KDTree
from scipy.optimize import nnls
import anndata
import os
from collections import defaultdi... |
af2d85c601cacb770371d0005c42917b46af23df8ae61f69cb83a60b7bae9929 | Python | 36,015 | 795 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip
from ..utils.tf import keras_import, keras, tf
Input = keras_import('layers', 'Input')
Model = keras_import('models', 'Model')
# from tensorflow.keras.layers import Dropout
from .blocks import unet_block... |
94055cf2be91c37edb7eee937f50004ac18840d0cb68f587d9dbf55941d51b51 | Python | 36,125 | 714 | # 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... |
37be004e8411967d0fcb0b2e2ab87a58edfc6e021c660600b9cd4a3625884e9e | Python | 36,143 | 1,126 | import numpy as np
import matplotlib.pyplot as plt
import os
import settings
import scipy.special as sc
from numba import njit, jit
from scipy import interpolate
from tqdm import tqdm
from utils.data_handler import load_data, get_dirs, clean_data
from typing import Tuple
from utils.utils import (
convert_to_rhombus... |
e5e0815083492cb1f4bd1a938043ceddb3453cb30c311c20808cfe79d54ceca7 | Python | 36,151 | 806 | """Module providing a encapsulation of pySTAGATE."""
import torch
from torch_geometric.loader import DataLoader
from tqdm import tqdm
import torch.nn.functional as F
import scanpy as sc
from anndata import AnnData
import numpy as np
import os
from scipy.sparse import csr_matrix
from .._settings import add_reference
fro... |
4168369b8159f618e8755b7a26bfeabd0d15c0b530b7e9b1bd01ac6a5ae595c1 | Python | 36,156 | 801 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
from scipy.ndimage.interpolation import zoom
from csbdeep.internals.probability import ProbabilisticPrediction
from .care_standard import CARE
from .care_standardDropOut import CAREDropOut
from .Feedback_DropOut impo... |
8704980e9c46af01e20b79f4573de9c9c5b07ac36091324d1a051ac088a5ee7f | Python | 36,174 | 876 | import argparse
import hashlib
import itertools
import json
import math
import os
import random
import shutil
from contextlib import nullcontext
from pathlib import Path
from typing import Optional
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
from accelerate import Accelerator
from accele... |
d633e47afbf8c7ea7d07bbd74b75b20e4a3b25a7f8cebe8637eadb590f899939 | Python | 36,177 | 978 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Mapped convolution layers."""
# pylint: disable=too-many-arguments, too-many-locals, too-many-instance-attributes, too-many-lines
from typing import Optiona... |
aa9a1efa7b7f4996618bcddd20049178903eaccde33621452c6a42e79ec677c2 | Python | 36,205 | 1,097 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import SSN_model_funcs as ssn
import pickle
# import umap # This will be imported on the fly
import hdbscan
import matplotlib
from sklearn.preprocessing imp... |
8eb40b1c6fc05242db4966544947b7fed974d3ae7254e1fa06e42a49f3323e93 | Python | 36,277 | 925 | """
This script ports models from VQ-diffusion (https://github.com/microsoft/VQ-Diffusion) to diffusers.
It currently only supports porting the ITHQ dataset.
ITHQ dataset:
```sh
# From the root directory of diffusers.
# Download the VQVAE checkpoint
$ wget https://facevcstandard.blob.core.windows.net/v-zhictang/Impr... |
452401915e0d2b1c929edafbae0c143d52bbbe3f7742c997307f1806b87ef8fb | Python | 36,291 | 964 | ####################################################################################################
# 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... |
57b749a4093b69a17b406a8aaac4d77476e4637aac49a07cbcbe55fe7e383263 | Python | 36,361 | 823 | import os
import time
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import special
### Functions for fitting
def linear(x, a, b):
return a * x + b
def pdf_beta(x, a, b):
return special.gamma(a+b) * (x**(a-1)) * ((1-x)**(b-1)) / (special.gamma(a)*special.gamma(b))
... |
6df8b8ee81999e8b33e4a2a6f18986b3ad277298665d0187284e6dc24ddc632a | Python | 36,368 | 891 | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.views import generic
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy
from django.forms import ModelForm
from django.forms import CharField
from dj... |
51befa20113720ade5b36aad848eb4a8124f7a70f2ef8ac6e8a654dc818c1884 | Python | 36,370 | 831 | from typing import List, Tuple, Optional
import numpy as np
import scanpy as sc
import pandas as pd
import os
def construct_gem_expressions(adata: sc.AnnData,
gem_expr_key: str = 'X_gem',
scale_gem_expr: bool = True,
layer_key: Optiona... |
c8c60f9f60105c81f925edc263504798eb155b83e16229d029ef79979fb198bf | Python | 36,417 | 816 | import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
import pandas as pd
import random
import numpy.random as random
from numpy import genfromtxt
from scipy import stats
from scipy.stats import norm
from scipy.stats import sem
import csv
from scipy.stats import percentileofscore
# using SciPy stats ... |
4350189058dea9710da77bafd5f18f21a6653d3d0f94e73d6e8d3176e67720d4 | Python | 36,421 | 895 | import copy
import logging
import time
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Set, Tuple
import requests
from ray._raylet import RAY_INTERNAL_NAMESPACE_PREFIX, GcsClient
# TODO(rickyx): We should eventually remove these imports
# whe... |
d1f260ffe5b8e695d30d7c68199f456cf40e5b5b8e280e467764d1c314a769fe | Python | 36,444 | 828 | import numpy as np
from pathlib import Path
import os
from ..bonsai.bonsai_helpers import set_recursion_limits
class Cluster_Tree:
# This is just a slim version of the scdata_tree, to make getting
# make it as fast and lean as possible.
root = None
nNodes = None
n_cell_nodes = None
vert_ind_t... |
baabacb100ad036d22db345462fadd4798b6d0ea43f99a452999a88b99730aad | Python | 36,450 | 751 | import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as pltc
import numpy as np
import scipy as sp
from scipy.stats import norm, gaussian_kde
from scipy.integrate import quad
from sklearn.neighbors import KernelDensity
from functools import reduce
from sympy import E
from .analyses import ... |
bf0ed01dd12c912c07cdbc04b1289b32e289a337421cc20e78e3c09d49dc849b | Python | 36,467 | 919 | ####################################################################################################
# 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... |
0f9bcc1c8c55a0e86978e899f2ddd05aa06a752127f7a01563b41ec1c756c037 | Python | 36,503 | 677 | """
module WPEM: The main call interface of WPEM, including the following functions and subroutines.
Author: Bin CAO <binjacobcao@gmail.com>
GitHub : https://github.com/Bin-Cao/WPEM
"""
from .EMBraggOpt.EMBraggSolver import WPEMsolver
from .Background.BacDeduct import Twi... |
56823476d44f68b5a8a700f34956debdc9a7d40509c46af18d785c8de4c9e901 | Python | 36,515 | 891 | """Fast NMF for single-cell gene-program identification.
Wraps :pypi:`nmf-rs` (a Rust port of R's `NMF` package + 2024 SOTA algorithms)
for the factorisation, then provides cNMF-style helpers for visualisation
and module identification.
Use-cases:
- **Exploratory single-cell analysis** — gene programs that align wit... |
b7dd9b276aea678b275b4b68df9cfa98d8883a5117d607e32fa37a6037eb52ec | Python | 36,517 | 958 | ####################################################################################################
# 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... |
ac9da6a895439cc2ceff5b8ec9a02633279b4dd1e308bc5a15866dcdb2598411 | Python | 36,533 | 984 | # -*- 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.
#... |
d1cbf4845e68cde5eb45ca26dc2a687f90e891f06c1a63114ce3d5335d814f0c | Python | 36,543 | 570 | import inspect
import os
import pandas as pd
import pytest
os.environ.setdefault('QT_QPA_PLATFORM', 'offscreen')
QtWidgets = pytest.importorskip('PySide6.QtWidgets')
@pytest.fixture(scope = 'module')
def app():
return QtWidgets.QApplication.instance() or QtWidgets.QApplication([])
def test_gui_settings_match_wr... |
068eb13e268fcbc47a92f8f7eff2d0ebade1dcf7818ec9080e1e4eb8c0d015aa | Python | 36,547 | 688 | import os
import subprocess
import sys
import tempfile
import unittest
import warnings
from collections import OrderedDict
from types import SimpleNamespace
from unittest import mock
import numpy as np
import torch
import torch.nn as nn
from safetensors.torch import load_file, save_file
import nnunetv2
from nnunetv2.... |
cecf94b1217bac5c8be599a11ba18b52a0e4a95b9349c79c8c147ab0c9d67054 | Python | 36,556 | 1,013 | import gzip
import json
import math
import tempfile
from base64 import urlsafe_b64encode
from collections import defaultdict
from hashlib import blake2b
from pathlib import Path
from random import shuffle
from typing import List, Optional
import plyvel
import sentencepiece as sp
import tables as tb
from rich.console i... |
8e53a1d7e6c8882406a5a26e6a4d58c07f6f872a5fc3ce67cb04de49c5f10a42 | Python | 36,558 | 1,013 | import gzip
import json
import math
import tempfile
from base64 import urlsafe_b64encode
from collections import defaultdict
from hashlib import blake2b
from pathlib import Path
from random import shuffle
from typing import List, Optional
import plyvel
import sentencepiece as sp
import tables as tb
from rich.console i... |
288720a2b194a2e24336f1e1f3bb7605aff9a187c32ab6ffe2a80ca3be2c5401 | Python | 36,563 | 51 | from pathlib import Path
import numpy as np
import pandas as pd
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
if __name__ == "__main__":
file_name = cache_file(
"meteorites.csv",
"https://data.nasa.gov/docs/legacy/meteorite_landings/Meteorite_Landings.... |
369262e8acd06c04ed79949a18c7ca030c7ee21f6e357a65724d19d9f3dd8e59 | Python | 36,578 | 809 | # !/usr/bin/env python
# coding: utf-8
# @Time : 2022/7/17 14:26
# @Author : Z.-H. G.
# @Email_0 : guozhenhao17@mails.ucas.ac.cn
# @Email_1 : guozhenhao@tongji.edu.cn
# @File : base2.py
# @IDE : PyCharm
import torch
import dgl
import copy
import scanpy as sc
import numpy as np
import pandas as pd
import net... |
37768dfa09cafc78a21625e6a5b061f118a41ee7faec1629b7f719b035f5a9cf | Python | 36,591 | 709 | import numpy as np
import torch
from tqdm import trange
from torch import nn
import matplotlib.pyplot as plt
import matplotlib.dates as dates
from torch.autograd.functional import jacobian
import os
import time
from sklearn.metrics import mean_absolute_error, mean_absolute_percentage_error
def calc_correlation(actual,... |
a1e4deebd3842994a8588365559aa29f9fd3499aed3f0a729544823f7c079a2f | Python | 36,640 | 900 |
import gym
import numpy
import random
import os
from gym import error, spaces, utils
from gym.utils import seeding
from matplotlib import pyplot
from collections import OrderedDict
import gym_sted
from gym_sted import rewards, defaults
from gym_sted.utils import SynapseGenerator, MicroscopeGenerator, get_foreground,... |
480594fa1085308de888f4716128b83f2814d6bc22c4aa623851e9da2d4b506d | Python | 36,673 | 852 | """Main module for PCA."""
# 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 math import log
from typing import Any, Optional, Tuple, Union
import torch
from torch import... |
31f61c8e1b8104f2df93c1f7323d92296d31bd1b9cb03f83ca479e801a45e29b | Python | 36,750 | 837 | import logging
# no need to set handler here, since we already set handler in root logger (utils.py), this child logger inherit that.
logger = logging.getLogger(__name__)
logger.info('Import sem.py')
import numpy as np
import tensorflow as tf
from scipy.special import logsumexp
from tqdm import tqdm
from .event_models... |
6198afc1e30a7fc949eda71f21f4c3e5f0ee1f50245c507121bc79e66f043ed3 | Python | 36,773 | 1,083 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 22 13:22:26 2015
@author: agiovann
"""
from builtins import map
from builtins import zip
from builtins import str
from builtins import range
import cv2
import json
import logging
import matplotlib.pyplot as pl
import matplotlib.patches as mpatches
... |
e983d0d0bee29050d29c58a7fff91ed4a63e772af92fc2e958413cd7871fb2a4 | Python | 36,776 | 842 | import pickle
from transformers import BertTokenizer, RobertaTokenizer, AlbertTokenizer, OpenAIGPTTokenizer, XLNetTokenizer
from transformers import GPT2Tokenizer, BartTokenizer
import torch
import logging
import sys
from rouge import Rouge
from nltk import bleu
from tqdm import trange
import torch.nn.functional as F
f... |
b8088b470404647e81d1c0087916a0c81932c4fc5bee9d3ad6bca83d4ec87326 | Python | 36,804 | 982 | import sys
from unittest import mock
import pytest
from ci.ray_ci.automation.push_ray_image import RayImagePushContext, compact_cuda_suffix
from ci.ray_ci.configs import DEFAULT_ARCHITECTURE, DEFAULT_PYTHON_TAG_VERSION
from ci.ray_ci.docker_container import GPU_PLATFORM, RayType
def make_ctx(**overrides) -> RayImag... |
5e7655452f142fa7af0400914c973a110937bfdd6e6d9e62c78614db70b9b756 | Python | 36,807 | 711 | # 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... |
05f80fb6c360949fcc0e3f6698e8e2cda586c7a6f102f630eb32152caacf39d0 | Python | 36,843 | 842 | #!/usr/bin/env python3.7
"""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
import os
import re
import shuti... |
76e7b5058126f315f7c666d913436c0bc29b6e47a108ec70fcc64f921434075b | Python | 36,843 | 1,120 | # built-in dependencies
import os
from importlib import metadata
import time
from typing import List, Tuple, Optional, cast, Dict, Any
import traceback
# 3rd party dependencies
import numpy as np
from numpy.typing import NDArray
import cv2
# project dependencies
from deepface import DeepFace
from deepface.commons.log... |
d0c13b47d57c858a009da2dab6907f25c10a0ec5770237f94de25d4f65bb848b | Python | 36,863 | 896 | import os
import sys
import glob
import numpy as np
import math
import matplotlib.pyplot as plt
from . import py
def intra_scan_pair(vol_names, augment, mode="test", bidir=False, batch_size=1, prob_same=0, no_warp=False, **kwargs):
"""
Generator for scan-to-scan registration.
Parameters:
vol_nam... |
a3beffe1c0047943b232fd029a10b6bea6a71b4d48164872a7089c63c926ecab | Python | 36,894 | 876 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. 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 r... |
0340af0a22ed464214b5209e8d116d97db00d10651695dddbaca5c9a3a9977a0 | Python | 36,901 | 902 | """Unit tests for GPU providers."""
import os
import unittest
from unittest.mock import Mock, call, patch
from ray.dashboard.modules.reporter.gpu_providers import (
MB,
RAY_SKIP_PROCESS_UTIL_API,
RAY_SKIP_PROCESS_UTIL_API_DEVICE_NAMES,
AmdGpuProvider,
GpuMetricProvider,
GpuProvider,
GpuPro... |
02526079dfba3fe18fecfcba9629683925a769b3b831c0626d724fa739821fe7 | Python | 36,915 | 892 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# =========================================... |
3bea8fe75938f057ca9311edbed5b001884ee732ae83cad70549f62c4c14bb3d | Python | 37,008 | 1,110 | # -*- coding: utf-8 -*-
import csv
import inspect
import os
import re
import json
import shutil
from copy import deepcopy
import pandas as pd
# PyBIDS 0.6.5 and 0.10.2 compatibility
try:
from bids.grabbids import BIDSLayout
except ModuleNotFoundError:
from bids.layout import BIDSLayout
BEST_GUESS_MODALITY_MATCH = ... |
122b2620060e599fc53a86b29bbcabcc30dfe4600a7d5680d2100279e5382787 | Python | 37,011 | 1,058 | """Hierarchical loss for the labels suggested in https://arxiv.org/abs/2210.10929"""
__cmd_doc__ = """Hierarchical loss for the labels"""
import networkx as nx
import numpy as _np
from collections import namedtuple
from functools import partial
from math import log as _log
from pathlib import Path
from typing impor... |
9ab8af44fba2596777e589e6073ab449071d431afb8a1d016e7884df0a0f39ee | Python | 37,099 | 802 | # ruff: noqa: E501
from ray.dashboard.modules.metrics.dashboards.common import (
K8S_DISK_USAGE_NOTE,
DashboardConfig,
Panel,
Row,
Target,
)
"""
Queries for autoscaler resources.
"""
# Note: MAX & USED resources are reported from raylet to provide the most up to date information.
# But MAX + PENDI... |
f6702a1826ce16e845af901aef8961397e0d2a598ecdff7d81b81f217638f6a0 | Python | 37,106 | 867 | # --------------------------------------------------
# nicMSlesions: MS white matter lesion segmentation
#
# Copyright Sergi Valverde 2017
# Neuroimage Computing Group
# http://atc.udg.edu/nic/about.html
#
# Licensed under the BSD 2-Clause license. A copy of
# the license is present in the root directory.
#
# ---------... |
46ed3be1473d8e5edaa0889f9b5bce30e2139bd465d8777d2e6e2ad89b0046c1 | Python | 37,142 | 796 | import os
import numpy as np
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
plt.rc('font',family='Times New Roman')
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from matplotlib import font_manager
from statsmodels.stats.multitest import multipletests
i... |
b8e1810f86036c29768a17f87e2cb37c21a1fd96a9872af277c04e27375b55ae | Python | 37,235 | 896 | import argparse
import hashlib
import itertools
import logging
import math
import os
import warnings
from pathlib import Path
from typing import Optional
import datasets
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
import transformers
from accelerate import Accelerator
from accelerate.log... |
4e939718b8b3f260dfb4062e11b4a140bd235f20c5a9c2345ece67700a826126 | Python | 37,321 | 1,404 | import os
import pickle
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.special as sc
import settings
import matplotlib as mpl
from math import isinf
from utils.grid_funcs import gen_offsets, gridpop_conj, traj, traj_pwl
from joblib import Parallel, delayed
from mpl_toolkits.axes_grid1... |
8563d9689fad545404e6ca67933b596cc46d52b0580983c299722203abfb2ce1 | Python | 37,327 | 801 | import os
import os.path as osp
import pandas as pd
import numpy as np
import sys
import copy
from torch_geometric.data import DataLoader
import torch
import torch.nn as nn
from tqdm import tqdm
import re
from sklearn.metrics import plot_confusion_matrix
import joblib
from sklearn import metrics
from sklearn.pipeli... |
c1285c1a05493017754a7e82ccd3dd30484d9812c9120ab6bfbda3def09dd7ca | Python | 37,370 | 862 | import copy
import heapq
import logging
from collections import defaultdict
from enum import Enum
from functools import total_ordering
from typing import Dict, List, Optional, Set, Tuple
import ray
logger = logging.getLogger(__name__)
class _DAGNodeOperationType(Enum):
"""
There are three types of operation... |
617b934b20b919b5828451f72a4c7b78f22719f24ab03b72bf578fbb44d05b16 | Python | 37,382 | 504 | #!python
# this script takes in the CPX SVs, reformats in svelter format, and generates the script to collect PE metrics
import os
import argparse
def header_pos_readin(input_bed):
fin = os.popen(r'''zcat %s''' % input_bed)
pin = fin.readline().strip().split()
out = {}
for i in range(len(pin)):
... |
67ee20723e6dc10232b9746e7127c041754553e7a5cf11ca898cf3fb0e81d106 | Python | 37,468 | 976 | import hashlib
import json
import logging
import os
import subprocess
import sys
import time
from getpass import getuser
from shlex import quote
from typing import Dict, List, Optional, Tuple
import click
from ray._private.ray_constants import DEFAULT_OBJECT_STORE_MAX_MEMORY_BYTES
from ray.autoscaler._private.cli_log... |
0b767231b5793f2aee208dfde7f6d70471b38989d81481df05419ebc85ca93aa | Python | 37,476 | 922 | # built-in dependencies
import base64
import json
from types import SimpleNamespace
from unittest.mock import MagicMock
# 3rd party dependencies
import numpy as np
import pytest
# project dependencies
from deepface import __version__
from deepface.modules.database import weaviate as weaviate_module
from deepface.modu... |
746dd1329648b9b5ffe5b8d0ea5d1178bf07c36b7f6b4d7769ce87c55eddbc9c | Python | 37,505 | 911 | import json
import logging
import os
import re
import threading
import time
import traceback
from collections import defaultdict, namedtuple
from typing import Any, Dict, List, Set, Tuple, Union
from opencensus.metrics.export.metric_descriptor import MetricDescriptorType
from opencensus.metrics.export.value import Val... |
4c815874b57647061271292aa266ec50512cd3ed0eb38e46b6b064852c866669 | Python | 37,587 | 848 | #!/usr/bin/env python3
__prog__ = 'DCANBOLDProc'
__version__ = '4.0.0'
__doc__ = \
"""Wraps the compiled DCAN Signal Processing Matlab script, version: %s.
Runs in 3 main modes: [setup], [task], and [teardown].
[setup]: creates white matter and ventricular masks for regression, must be
run prior to task.
[... |
59e490a0c9199bac561b317c45abc573108ac6add7011ed60042812d3c1e3857 | Python | 37,594 | 817 | from typing import Callable, Optional, Union, List, Tuple
import numpy as np
import torch
import torch.nn as nn
from new_style_optim_encoder.glm_components import _multimovie_spatial_stimulus_contrib_gensig, \
_multimovie_timecourse_stimulus_contrib_gensig, _multimovie_coupling_feedback_contrib_gensig, \
_fla... |
beffc56404e2de3cf07c4e1f28d56c6a094f3b82f4e08bc8bd09f9c0629fb9b0 | Python | 37,595 | 766 | from copy import deepcopy
from typing import Literal, Tuple, Union, List
import torch
from batchgenerators.utilities.file_and_folder_operations import isfile
from dynamic_network_architectures.architectures.abstract_arch import AbstractDynamicNetworkArchitectures
from torch._dynamo import OptimizedModule
from nnunetv2... |
cf1d4eff1481802c56179dcf22151f91235605f95c5541e5f079fe28867b5d58 | Python | 37,621 | 910 | """
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 matplotlib.pyploat as plt
import pandas as pd
from fairchem.core.scripts import downl... |
bc24866f89812797362c257c56c3d89a5f8daf38ce6cc862d6266c5a3eeb4a51 | Python | 37,636 | 1,019 | # 导入相关的第三方包
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import glob
import os
## 忽略提醒
import warnings
warnings.filterwarnings("ignore")
def get_reward_values(df,stage_index):
# R = 0
if df.loc[stage_index,'stimulus']==1: # GO_cue
if df.loc... |
4335ea47fb817ef1976b976651ad500080da62d750635add6b6b5e459e9d1d29 | Python | 37,652 | 989 | from __future__ import annotations
from operator import truediv
from typing import TYPE_CHECKING
from warnings import warn
from datetime import datetime
import numba
import numpy as np
#from fast_array_utils import stats
from .._settings import settings, EMOJI, Colors
from .._registry import register_function
# Out-... |
b8406501db964011babbc9e55c22555c1052770cb0c3c6c151bfc4fe62ff51c8 | Python | 37,656 | 736 | import inspect
import warnings
from typing import Callable, List, Optional, Union
import numpy as np
import torch
from packaging import version
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from ...configuration_utils import FrozenDict
from ...models import AutoencoderKL, UNet2DConditionMo... |
dd77ca73114e9fc8f10f0a7e9d13e784a7a4d6fd176e50ebae49582b63fd1746 | Python | 37,709 | 944 | # 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... |
aaa1691aa2e381ed4f09e7e4d1539df2a074339389a439d055bfd6b48c650d6a | Python | 37,721 | 956 | import json
import logging
import os
import time
from concurrent.futures import Future, ThreadPoolExecutor
from pathlib import Path
from threading import RLock
from typing import Dict, List, Optional
from uuid import uuid4
from azure.common.credentials import get_cli_profile
from azure.core.exceptions import ResourceN... |
f5eab726da56e25ca92134125a5b9caaedf815243cb0a9750b5db13e4d6f83bb | Python | 37,729 | 668 | import argparse
import hail as hl
import logging
import os
import re
hl.init(default_reference='GRCh38')
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def parse_args():
p = argparse.ArgumentParser(description="This script lets yo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.