sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
857eb6d04b7925f96b1b18690f043f2fbc56e83be9fed78f7f65477af8f1b9d2 | Python | 7,806 | 250 | #
# 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... |
540078b1d270885d42347c575e2e9302477a2b10239f737b71c1403e4f68d6e5 | Python | 7,807 | 240 | import unittest
import basetest_state_action_q_function as base
import pytest
import torch.nn.functional as F
import pfrl
assertions = unittest.TestCase("__init__")
@pytest.mark.parametrize("n_dim_obs", [1, 5])
@pytest.mark.parametrize("n_dim_action", [1, 3])
@pytest.mark.parametrize("n_hidden_layers", [0, 1, 2])
... |
b280d719b61066975633cb99fae86b3ecdcf23672ffd9834823f27468b2898df | Python | 7,808 | 217 | ####################################################################################################
# Copyright (c) 2023, 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... |
857a786d3782f790dfe2424689e974450917d290e38dabe00854156c0b87f9c6 | Python | 7,810 | 189 | import json
import logging
import os
import re
import shlex
import subprocess
import sys
from typing import Any, Dict, List, NoReturn, Optional
from ray._private.services import get_ray_jars_dir
from ray._private.utils import update_envs
from ray.core.generated.common_pb2 import Language
from ray.util.annotations impo... |
c78d11b46107d47afeb02896f7ed4825a516727d59330fa6dccc18b4694607d2 | Python | 7,810 | 244 | # -*- coding: utf-8 -*-
#
# cort_language documentation build configuration file, created by
# sphinx-quickstart.
#
# 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.
#
# All configuration values ... |
d364e6bbc20541a9bd8ea909614a70e164302b95b49f91106544c8b95f3c956a | Python | 7,820 | 209 | from __future__ import annotations
import logging
import os
import numpy as np
import pandas as pd
import scipy
from OnClass.OnClassModel import OnClassModel
from .. import settings
from ._base_algorithm import BaseAlgorithm
class ONCLASS(BaseAlgorithm):
"""
Class to compute OnClass cell-type prediction.
... |
b66c3726f9e4dbc9d88b93d19eaa16fcd56102b7910e70312008cc777ae5c038 | Python | 7,823 | 200 | #!/usr/bin/env python3
"""Utility scripts for gene graph class."""
import logging
import numpy as np
import pandas as pd
from scipy import sparse
def set_zscore(p, n):
"""Set a z-score for p-value p in n tests."""
import scipy.stats as st
# TODO: get proper BY testing correction equation
z = -st.norm... |
bad42b84817c01223cf2f8759ef802f353590b441da4ad6408e4466e81ab7de4 | Python | 7,825 | 200 | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
627dad986627e6c61d4554f487793449590ab705dd2ec9cc179c3da99b7ceb37 | Python | 7,826 | 256 | #!/usr/bin/env python3
import argparse
import fnmatch
import os
import subprocess
import sys
from pprint import pformat
from typing import List, Optional, Set, Tuple
def _list_changed_files(base: str, commit: str) -> List[str]:
"""Returns a list of names of files changed in the given commit range.
The funct... |
6d42de246721644a2652ad121f0a94d7a925a0e6b4febbe01b754baa6699c3f9 | Python | 7,827 | 192 | from imports import *
from datetime import date
class Base( common.BaseClass ):
modulepath = 'ngs_mapper.miseq_sync'
def setUp( self ):
super( Base, self ).setUp()
self.bc_path = join( 'Data', 'Intensities', 'BaseCalls' )
self.samplesheet = join( fixtures.THIS, 'fixtures', 'SampleSheet... |
11fe221153e4bf1b14e859143545255b4a67784191b94fe852d0bc70a3e6c6a9 | Python | 7,831 | 220 | """
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.
Configuration Validation and Management for FastCSP Workflow
This module provides comprehensive configuration validation and management utilit... |
bd5ffc003e93396c5b49d123585563643e83e9f7323437347cc1e21c7a5a0a3e | Python | 7,832 | 206 | import matplotlib.pyplot as plt
import sys
import numpy as np
import os
import torch
import pickle
# from Step_7_util import *
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, average_precision_score
def print_topl_statistics(y_true, y_pred, topl_csv):
... |
17832015411644dcc78f91f145998dd1d0c1410185ec4932c5c746079d337ff2 | Python | 7,833 | 246 | # 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, ... |
339f0f67007251e68d1f28bb83808f85bac967bfb74e26ed8c0a8978e0363b6c | Python | 7,833 | 297 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache
# In[2]:
# this path determines where downloaded data will be stored
manifest_path = os.path.j... |
a87d87816e0c7f786348fb94a3264d1d20aeca59c54f2902b1f3b68eeb36cc55 | Python | 7,837 | 196 | """
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.
Copied (and improved) from:
https://github.com/fadel/pytorch_ema/blob/master/torch_ema/ema.py (MIT license)
"""
from __future__ import annotat... |
ed5766058e45e72f6ab3a84d07c5f7c1c31d245e6520abda599e09c6223e6d46 | Python | 7,840 | 215 | import unittest
import pytest
import torch
from torch import nn
from pfrl.nn import RecurrentBranched, RecurrentSequential
from pfrl.testing import torch_assert_allclose
from pfrl.utils.recurrent import (
concatenate_recurrent_states,
get_recurrent_state_at,
mask_recurrent_state_at,
one_step_forward,
... |
45475e4f88c1ac3b23c799a01122782a2c69e5c1f7e72e771d4b6057609041da | Python | 7,841 | 236 | import math
from dataclasses import dataclass
import matplotlib.pyplot as plt
import numpy as np
@dataclass
class StepCurrent(object):
times: []
amplitudes: []
def __post_init__(self):
assert len(self.times) == len(self.amplitudes)
assert all(
t1 <= t2 for t1, t2 in zip(self.... |
45678ddb428e843af798e1725fc0c2be07471f219f927d696a4eb0f08b9577e7 | Python | 7,844 | 268 | import logging
import warnings
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
from torch import nn
import flyvis
from flyvis.utils.logging_utils import warn_once
logger = logging.getLogger(__name__)
def recover_network(
net... |
b3fc971eff054b9a20c47740edbe8a7be1057ccd9d1b9623b019dc4a0fb8f05b | Python | 7,847 | 163 | r"""Reference sequences used as landmarks by the tutorials and the test suite.
Sequence-level predictors can only be judged against sequences whose behaviour
is already known, so the same handful keeps coming up: a protein with a
documented signal-peptide cleavage site, one that is famously soluble, one that
is famous... |
ab1b4a24db4229ddedb6d40a68fedaeac27741922b937cc37492fe41cc86b4b8 | Python | 7,848 | 219 | import re
import os
import argparse
import glob
import pandas as pd
import numpy as np
import tensorflow as tf
from keras import backend as K
import task
import joblib as jl
import sklearn
def read_args(logfile):
args = {}
with open(logfile, "r") as f:
for line in f:
if "Namespace" in line:... |
7c4cab3fcf6dde274775cb698babafddd896c131452e2642ab104343dade433e | Python | 7,849 | 260 | # modified from https://github.com/facebookresearch/LeViT
"""
Misc functions, including distributed helpers.
Mostly copy-paste from torchvision references.
"""
import io
import os
import time
from collections import defaultdict, deque
import datetime
import torch
import torch.distributed as dist
class SmoothedValue... |
cd65a6a418d6f06f051b1f0b6cbc77aed3eae57547eaba8a735f4e6fa0ce89d4 | Python | 7,849 | 227 | #!usr/bin/python
"""Compute co-expression modules for Tabula Sapiens using scdemon."""
# -------------------------------------------------------------
# Compute co-expression modules within python scanpy framework,
# on the Tabula Sapiens dataset
# Created: 11/30/23
# ---------------------------------------------------... |
72b606b047be82743f7c4ed6d9fc5754ec36a4b745dc0daa9a940375a2a52327 | Python | 7,851 | 197 | import tensorflow as tf
from utils.nn import linearND, linear
from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph_list as _s2g
from models import *
from ioutils import *
import math, sys, random
from collections import Counter
from optparse import OptionParser
from functools import partial
... |
98b8561550cc20e5469cfa180406b36242ea1b17eb548c540e145375a494684e | Python | 7,852 | 223 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 7 13:29:49 2017
@author: agiovann
"""
#%%
try:
get_ipython().magic(u'load_ext autoreload')
get_ipython().magic(u'autoreload 2')
except:
print('Not launched under iPython')
import numpy as np
import matplotlib.pyplot as plt
from matplo... |
fabc7e2cd7eaf016111103feeae0dd744847cd620fb72c264d56cdf449a45e5d | Python | 7,852 | 258 | """
Shared CSV canonicalization for USPTO-50K and USPTO-FULL.
The chemistry preprocessing is identical for both datasets; the only dataset
specific behavior is how the output reaction class is assigned.
"""
import argparse
import os
from multiprocessing import Pool
import pandas as pd
from rdkit import Chem
from tqd... |
8dfc067ab444367929cd5893b4c233d84db91cad93725e9d986540c8dd40249c | Python | 7,855 | 163 | import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from functools import partial
from collections import Iterable
from pymirc.metrics.tf_metrics import generalized_dice_coeff
from deepvoxnet2.backwards_compatibility.metrics import *
from deepvoxnet2.keras.metrics import _metric
def missing... |
1a31d86fd5dbe793980fd8088926056ffb6d7f9109fe4cb959af05653da95e01 | Python | 7,861 | 233 | import os
import anndata
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler, StandardScaler
import numpy as np
import random
import torch
# 固定随机种子
def set_seed(seed=42):
random.seed(seed)
np.random.seed(seed)
torch.ma... |
dfbb60e03c8e639083b84686e7adbb0c20b07f1b54df9d6ec9b87917222ee3ee | Python | 7,861 | 183 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
numpy version: 1.23.3
pingouin version: 0.5.3
"""
#%% Import Modules
import pandas as pd
import numpy as np
import pingouin as pg
from pathlib import Path
#%% Functions
def get_correlation(comparison, roi, measure_type, co... |
574e5587086f708aee42440606e95cb5878ac8652c2822d6d8e12717a7ec6c79 | Python | 7,864 | 175 | import torch
import utility
import loss
torch.backends.cudnn.enabled = False
import argparse
from div2k import Flouresceneproj
from trainer import Trainer
from torch.utils.data import dataloader
import model
def options():
parser = argparse.ArgumentParser(description='EDSR and MDSR')
parser.add_argument('--mo... |
818352f66dbdcbd2ade74d146efc3350bbff29eaed8f42e505155f29850d1f54 | Python | 7,865 | 187 | #!/usr/bin/env python3
# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright ... |
e020f7c79225771c47bf18d546e025f2c01136ebf5444d159ec27e50355eb169 | Python | 7,867 | 284 | """
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 dataclasses import dataclass
from functools import wraps
from typing import TYPE_CHECKING, Callabl... |
efd7505edf73905c6ddacd2a1a2970e7dfea4ab5578e8fea0f731a7fb8b80678 | Python | 7,872 | 212 | import os
import sys
import pandas as pd
import numpy as np
import pcntoolkit as ptk
from matplotlib import pyplot as plt
import seaborn as sns
#%% Set globals
scriptsdir = '/project_cephfs/3022017.02/projects/hansav/Run8_f/scripts/'
datadir = '/project_cephfs/3022017.02/projects/hansav/Run8_f/data/'
Zdir = '/proje... |
a607513560d94ca1af575d00fe1ec744cd1a955e29f34833f4d236d69b11c760 | Python | 7,873 | 199 | """
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 logging
import numpy as np
from ase.stress import voigt_6_to_full_3x3_stress
def uniform_atom... |
87a959b08dba20b8a40ad2bb056046385d2972e578f435e7f3e683a218c9161a | Python | 7,874 | 250 | # 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... |
cbd6ab6ad6ffc75b9b7f3fad6eec54feceebe11f95e3394061d38f78e1015f9e | Python | 7,876 | 258 | #!/usr/local/bin/python
"""
vector to matrix
"""
from __future__ import print_function
from __future__ import division
import sys
import argparse
import subprocess
import shlex
import logging
import itertools
import time
import gzip
import re
import os
import math
import uuid
import socket
from datetime import datet... |
978393db71e47884eceaa7ceb12f25865033508c0b63e936a4d42342ae8693b9 | Python | 7,878 | 212 | ####################################################################################################
# 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... |
a6ebc6cbaa9b49d6093deb2293995dc356bfc1346d4b97e997219589781015f5 | Python | 7,882 | 138 | import logging
import torch
from os.path import exists
from transformers import AlbertForSequenceClassification, BertForSequenceClassification, FunnelForSequenceClassification, AutoTokenizer
from transformers import AlbertModel, BertModel, FunnelModel
from agent.classifiers.custom_transformer import ModelWithCustomLos... |
a2d3c0fb9f11bd0f0d305c62b99368073d400f19a398d87b5bb2d9b832438154 | Python | 7,883 | 226 | import torch as th
from torch.nn import functional as F
import torch.nn as nn
from .gclayer import GraphConvolution as GCLayer
import numpy as np
class MLP(nn.Module):
"""
Simple dense neural network
"""
def __init__(self, input, hidden, output, activation = nn.ELU(), bn = False):
super(ML... |
53870a610ced5760e6b648fb348e22c5271bb8afca275959e0f9c96ab5759556 | Python | 7,884 | 243 | import asyncio
import logging
import os
import shlex
import tempfile
from typing import List, Optional
from ray._private.authentication.authentication_token_setup import (
_get_default_token_path,
)
from ray._private.authentication.authentication_utils import is_token_auth_enabled
from ray._private.runtime_env.con... |
4e750c656f154c651f13c2dd4e013fd2adcd66449c667e09b515f44d83a27346 | Python | 7,886 | 228 | # 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... |
27bd46e02210cd12a2107019ae31761ffefbc93e4749e41d4c4b5647e84c26be | Python | 7,890 | 237 | import collections
import copy
import logging
import os
import pdb
import warnings
# from random import random # didn't work for random.seed(seed)
import random
from typing import Union, List, Dict, Optional
import numpy as np
import torch
import torch.nn as nn
from torch.optim import Adam
from torch.autograd import V... |
ade1847f82e064af75e3efd22f477652a8f8cd7e2b2436cdb3228380ed16250a | Python | 7,893 | 165 | ####################################################################################################
# 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... |
7bbc772fbf707e7c685e03a2fd4c409189039764ff9cebebce77f7588ad4cbab | Python | 7,895 | 157 | """
***
This implementation is for the rewards of the 2nd gym setting, in which datamaps evolve over time. Some details, such as
bleaching computation, differ due to this, which is why the implementation here differs from the one in objectives.py
***
"""
import numpy
class RewardCalculator:
def __init__(self, ob... |
9f238cadebcab765918eeb37272eaf38e12691054b32bf40936932ddfb3a2b47 | Python | 7,898 | 183 | import numpy as np
import os
import tifffile as tiff
import random
import math
import torch
from torch.utils.data import Dataset
def Img2Subimg(args):
im_folder = args['datasets_path']+'//'+args['datasets_folder']
name_list = []
# train_raw = []
image_list={}
coordinate_list={}
print('im_fol... |
05631b0350504b6f5147e28e80fa2a85bbfd9778d35a87b8098bb12b7adf291d | Python | 7,902 | 220 | #!/usr/bin/env python
import os
import os.path as osp
import platform
import shutil
import sys
import warnings
from setuptools import find_packages, setup
import torch
from torch.utils.cpp_extension import (BuildExtension, CppExtension,
CUDAExtension)
def readme():
with ope... |
b2f8812394aab8bfa0231846ed0899382c9a0edc560b3b7797f6ce84e28fbdc1 | Python | 7,904 | 187 | import argparse
import pickle
from typing import Dict, Any, List
import numpy as np
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.dataset_specific_hyperparams.mask_roi_region import make_sig_stixel_loss_mask
... |
d278258978cd6afcbf4964087f5fee5b56e179f51cf9a1752c6735e6c0f0ee3b | Python | 7,908 | 237 | from __future__ import annotations
import time
from pathlib import Path
from typing import Any, Iterable, List, Optional
from .media_ingest import (
PreparedImage,
looks_like_image_name,
prepare_image_bytes,
prepare_image_path,
)
def build_channel_request(session: Any, text: str, *, channel_label: s... |
1db58a014fd7d4eb5a81c9f540f667613f701330a17a3d4e77120e2c444130b6 | Python | 7,909 | 190 | ####################################################################################################
# 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... |
9bf9ada55d3b405481eb397c05fd92cafd5381ac06e780758580a6420b6ec5eb | Python | 7,910 | 272 | import logging
import os
import pathlib
from functools import partial
from multiprocessing import cpu_count
from typing import Any, Callable, Generator, Iterator, List, Optional, Sequence, Union
try:
import dill
DILL_AVAILABLE = True
except ImportError:
DILL_AVAILABLE = False
from torch.multiprocessing i... |
fca103094957b8bb2f60a89dd0884a3c476591648d691675d40cf113b157117f | Python | 7,910 | 212 | import dataclasses
import json
import logging
import traceback
import aiohttp
from aiohttp.web import Request, Response
import ray
import ray.dashboard.optional_utils as optional_utils
import ray.dashboard.utils as dashboard_utils
from ray.dashboard.modules.job.common import (
JobDeleteResponse,
JobLogsRespon... |
682da70641037ae3ee9982f9a92aa92bdf7741a6475e14d7b1066e1fce71bbe3 | Python | 7,911 | 254 | """Functions to calculate figure sizes for plotting."""
from dataclasses import dataclass
from typing import Tuple, Union
from . import plt_utils
def figsize_from_n_items(
n_panels: int,
max_figure_height_cm: float = 22,
panel_height_cm: float = 3,
max_figure_width_cm: float = 18,
panel_width_cm... |
f6e566eba6347853f205a76d19e2494ecd233a135f5a185b365e0b04b55e6f71 | Python | 7,911 | 215 | """
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 json
import os
from dataclasses import dataclass
from importlib import resources
from typing imp... |
6f06754489f071dd5317c6ac2d6d4a6254e218874d43d2e57ebeae849a4a4ef1 | Python | 7,912 | 287 | """
radial.py
A collection of functions mainly related to manipulating and analyzing the radial
positions of IGS reads in single cells.
"""
import warnings
import numpy as np
import source.const as const
import matplotlib.pyplot as plt
from scipy.spatial import ConvexHull
from mpl_toolkits.mplot3d.art3d import Poly3... |
d2b4648a5b039d6b8625169c9b8f227d77e868e203f5bb20e4e4bfd88e514217 | Python | 7,912 | 212 | import os
import sys
import numpy as np
from mrcnn import visualize
from mrcnn import utils
from pycocotools.coco import COCO
from pycocotools import mask as maskUtils
# Root directory of the project
ROOT_DIR = os.path.abspath("./")
############################################################
# Configurations
#####... |
dc2859df2b509c93f033de541b4a221ff91487439b5a17d62e86f7c02ebac741 | Python | 7,912 | 227 | # 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)... |
9e560ae0bdf461afd578dd0e4e319c87ba69c0af60c3764dd5141d248815c158 | Python | 7,915 | 276 | import functools
from typing import Any, Callable, Optional, Tuple, TypeVar, Union
import numpy as np
import pandas as pd
from multimethod import multimethod
from scipy.stats import chisquare
from data_profiling.config import Settings
T = TypeVar("T")
def func_nullable_series_contains(fn: Callable) ->... |
0de045a8d79b7b753e3fe9f874d2267316cbf46d08e93e937357c9d30663a80b | Python | 7,916 | 203 | from utils import *
import csv
import pandas as pd
if __name__ == "__main__":
SHOW = 0
tasknames = ["complete",
"rivalry",
"distort"]
taskprettynames = {"complete": "Pattern Completion",
"rivalry": "Perceptual Rivalry",
... |
1e4b39e5a129f5ea66c55ca53745ede53c22d4235fdc196ae6ebc0bdcf0769a8 | Python | 7,919 | 161 | from src import predict
from src import data
from src import neon_paths
from glob import glob
import geopandas as gpd
import traceback
from src.start_cluster import start
from src.models import multi_stage
from distributed import wait
import os
import re
from pytorch_lightning.loggers import CometLogger
from pytorch_l... |
39ea12f2bc6f2f6e61cfb577831a0c58778420262cbac8b6233d549b48d57941 | Python | 7,922 | 225 | # built-in dependencies
import os
from typing import List, Any, Tuple
# 3rd party dependencies
import numpy as np
from numpy.typing import NDArray
import cv2
# project dependencies
from deepface.commons.onnx_utils import build_session
from deepface.models.Detector import Detector, FacialAreaRegion
from deepface.commo... |
3eb474c9c12deb8810e6975ef9d9b435112509a6f614302b07e2b5109fb6107b | Python | 7,923 | 185 | import numpy as np
from spinnaker2.neuron_models.application import BaseApplication
from spinnaker2 import mapper
from spinnaker2.mapper import SynapseWordSpec, SynapseWordSize
from spinnaker2.configuration import PEConfig, MemoryRegion
from spinnaker2.neuron_models.common import (add_log_memory_region,
N_WORD... |
715b0026b838edcadadfb8ee167f0a67a3b3b890c550d98d8a45aa922e528cc5 | Python | 7,925 | 247 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
faa047be0507267a167d8795a79b65d73f4e30018331146668caa58c4f3a14f0 | Python | 7,925 | 208 | import argparse
import numpy
import datetime
import functools
import uuid
import os
import time
import gym
import gym.spaces
import torch
from torch import nn
import pfrl
from pfrl import experiments, utils
from pfrl.policies import GaussianHeadWithFixedCovariance, SoftmaxCategoricalHead
from src import models, Wrap... |
18750a90b1ec0dce624869b14a002169fdf78f00a39836ed0e510ccf7a179b30 | Python | 7,926 | 213 | ####################################################################################################
# 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... |
4696a8bccf9a5cd2b5fcf1373c69916525dbc756e66a7330ef1e4eab88014fc7 | Python | 7,929 | 245 | import torch
import argparse
import json
from torch.utils.data import DataLoader
from models import PretrainModel, load_model_arch
from utils.training import pretrain, preeval
from utils.data_utils import (
check_early_stop,
create_log_model,
dump_tokenizer,
fix_seed,
init_tokenizer,
load_data... |
5f117e86ddcfd06b41e09f76ac3e7e2530f9bb8388b388a7f46df5ae22a1fbb0 | Python | 7,929 | 211 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from ..utils import _raise, move_channel_for_backend, axes_dict, axes_check_and_normalize, backend_channels_last
from ..internals.losses import loss_laplace, loss_mse, loss_mae, loss... |
8b1e60d79990292f02623b7c39a5d2b882ddc7d5d473bff4230440f24d9ad998 | Python | 7,937 | 189 | import numpy as np
import os
import utils
import pandas as pd
import random
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from torchvision import datasets, transforms
from torchvision.transforms import T... |
727f92dbfb85a10f8a4d41b2f9c5f7e4ed87ad308471a4d3310ae217fdd229fc | Python | 7,939 | 255 | """A training script of PPO on OpenAI Gym Mujoco environments.
This script follows the settings of https://arxiv.org/abs/1709.06560 as much
as possible.
"""
import argparse
import functools
import gym
import gym.spaces
import numpy as np
import torch
from torch import nn
import pfrl
from pfrl import experiments, uti... |
caa6337567a5b2bbdc4dc5aba85a7af366d672b4539059b790e5b146b6a7a733 | Python | 7,943 | 217 | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
549423c836b0b71540cd6732e42a6bc3641b87bebc8dd12c542f3ca75a7a3bec | Python | 7,944 | 253 | #! /usr/bin/python
import warnings
import numpy as np
from umap import UMAP
from sklearn.manifold import TSNE
def _import_plotlibs(for_save=True):
"""Import plotlibs properly for either save or jupyter notebook.
Really annoying to have to do this as a method, but one or the other always
freaks out if imp... |
f7852aef91529fcd9ee8ba950dfa3bdc2b36f678cb7dbe4b492ec0fd3e1bb18e | Python | 7,944 | 256 | """
Trace persistence and replay helpers for OVAgent harness runs.
"""
from __future__ import annotations
import json
import time
from pathlib import Path
from typing import Any, Optional
from .contracts import (
ArtifactRef,
HarnessEvent,
RunTrace,
ScenarioResult,
ScenarioSpec,
StepTrace,
... |
81713718eacf7449ca00335184a254302590ddd0f9e63574e688c4b832fb8e20 | Python | 7,946 | 201 | import time
import numpy as np
import tensorflow as tf
from models.time_series_models import TimeSeriesRegressor
from utils.tools import save_train_duration, save_test_duration
from utils.regressor_tools import setup_callbacks
def plot_epochs_metric(hist, file_name, model, metric='loss'):
"""
Plot the train... |
139e12d522ead559279d63ac819a8a2e1a61a25572073bf8182a0d23ce744e4b | Python | 7,947 | 141 | import os
from typing import Iterable, List, Optional
import torch
from nnunetv2.utilities.checkpoints import CHECKPOINT_EXTENSION, LEGACY_CHECKPOINT_EXTENSION, \
assert_checkpoints_equal, load_checkpoint_file, safetensors_filename, save_checkpoint_file, without_training_state
def convert_checkpoint(pth_file: s... |
7fc2fee099df5728d2ab742541beb517a4f39d8faeffdaf95247a2bbebfeba78 | Python | 7,949 | 288 | """Run integration tests with Hugging Face platform
See accompanying test-hf-integration.yml GH workflow file.
Specifically, this tests:
- loading a pre-trained tokenizer
- loading a pre-trained transformer model
- saving model (pickle and pytorch) on the model hub
Trigger:
- trigger the action manually at https:/... |
8ca29f75ea62c4acc74168ceb1fe22685a983ef32ac267b4809b875b34a36aef | Python | 7,950 | 227 | import unittest
import neuron_morphology.features.path as path
from neuron_morphology.morphology import Morphology
from neuron_morphology.constants import (
SOMA, AXON, APICAL_DENDRITE, BASAL_DENDRITE)
from neuron_morphology.feature_extractor.feature_extractor import (
FeatureExtractor
)
from neuron_morphology... |
5b2bf329d9b306084184480e145e350418fc6b565f87427c603ffa5893ecded8 | Python | 7,953 | 213 | import torch
import random
import warnings
import numpy as np
from tqdm import tqdm
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
warnings.filterwarnings("ignore")
class simdatset(Dataset):
... |
088e1a2b82c46fe20ee3f64c71318184cc01238a6190ac774a80c5007691a2cc | Python | 7,958 | 205 | from agent.classifiers.tr_ffnn_ensemble_classifier import tr_ffnn
from agent.classifiers.fd_naive_item_classifier import fd_naive_classifier
from agent.classifiers.data.tr_ffnn_dataset_mgmt import get_datasets as get_fc_tr_ffnn_datasets
from agent.classifiers.data.tr_ffnn_dataset_mgmt import annotate_dataset as annotat... |
48ca46b4a207778ebbc2bbdaff9b04aab4c36ae3ec1ee5dbf154fad88952c078 | Python | 7,959 | 218 |
import gym
import json
import os
import gym_sted
import pfrl
import torch
import sys
import random
import pickle
import logging
import functools
import numpy
import h5py
import datetime
import matplotlib
matplotlib.use("TkAgg")
from tqdm.auto import trange, tqdm
from matplotlib import pyplot
from collections import d... |
36b1abd772e4f1e88dc8ab19414cadb07c85f22ec37891909fc607a7df8d1a16 | Python | 7,961 | 231 | """
Functions to optimally combine data across echoes.
"""
import logging
import numpy as np
LGR = logging.getLogger("GENERAL")
RepLGR = logging.getLogger("REPORT")
def _combine_t2s(data, tes, ft2s, report=True):
"""
Combine data across echoes using weighted averaging according to voxel-
(and sometimes ... |
8ced73c778971e147c5a203ef817c0215b15c298752983f232cb702f76954c4e | Python | 7,961 | 210 | """
Repair of the native isosurface mesh, so that it is a clean disk for the
Laplace-Beltrami solve.
- fill_holes closes every boundary loop except the outer boundary (up to a
size limit), with a fan of triangles to the loop centroid. Each new face
reverses the boundary edge of the face it adjoins, so the winding ... |
ebf1d5d79192c5da5fbb5fb5b0e585c2a0e56e1592591660995d057c4a8c39af | Python | 7,961 | 229 | # 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... |
28fdf2813ea1da7e1698713df1df11adcafeafa2389cdd10ce06607f731351fc | Python | 7,962 | 258 | '''!
@file capture.py
Defines a Capture class that is a container for a single capture of data
from an Azure Kinect device.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
'''
import ctypes as _ctypes
import copy as _copy
from os import linesep as _newl... |
4b7af6aac6630b83e79e1592eb0c3cf93ab3f71866298c811ea005f4054c2c4d | Python | 7,963 | 220 | """Single-cell disease relevance scoring for ``ov.genetics`` — scDRS backend.
Wraps the standalone :mod:`pyscdrs` package (Zhang *et al.* 2022). Given
an scRNA-seq :class:`~anndata.AnnData` and a GWAS-derived gene set,
:func:`disease_relevance_score` assigns each cell a disease-relevance
score (and an empirical p-valu... |
f6e1b0e65090084240e4a2eb541315c3f6033cb98aa834046f5801641cd42336 | Python | 7,963 | 221 | """InterPro data collector."""
import logging
import json
from typing import Any, Dict, List, Optional
from src.api.interpro import InterProClient
from src.models.interpro import Domain, DomainLocation
from src.models.protein import Protein
from .base import BaseCollector
from config.config import settings
logger =... |
d2add6adfac0b01c34ffa1fa0c8c1bb62b2c916f5ceb7078abe8b5d3b9af7c0e | Python | 7,966 | 186 | import numpy as np
import torch
from torch.utils.data import Dataset, IterableDataset
def _prep_graph(graph_, graph_n_epochs):
"""Filter weak edges and return (head, tail, weight, graph_n_epochs).
graph_n_epochs controls the cutoff (matches umap-learn / Sainburg pumap):
edges with weight < max_weight / g... |
8e6c9189dcfc35d63f45c27bf4e2abc27908834f40e923b1f38fcdf8cf23f97d | Python | 7,968 | 186 | ####################################################################################################
# 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... |
728ad4049906ed3bbe879fe0acf2906fc701d0fdb63e0544fc9c6670a105164c | Python | 7,969 | 273 | import unittest
from unittest import TestCase
import sys
from functools import partial
import numpy as np
from shapely.geometry.polygon import Polygon
from shapely.geometry import Point, LineString
try:
import rasterio
from neuron_morphology.snap_polygons.geometries import Geometries
import neuron_morphol... |
df59c61ac9d21ef097b8a6ebfa845a82ca14aecd44b858b7c29165da7fa01994 | Python | 7,973 | 224 | import os
import csv
from itertools import product as itertools_product
import argparse
from tqdm import tqdm
from copy import deepcopy
from src.models.train_model import train
from src.models.train_darts_model import train as train_darts
from src.data.load_data import (
load_data,
load_params,
make_input_... |
40e12b331f62a9daffc27ef9d0b740d8743c2c1f63f4f2550f80da598eba4d41 | Python | 7,974 | 206 | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
9d3fab91a1b7b6b377d0a115023596ec3d9cd9dee0aeb306a46b7603beaf218b | Python | 7,974 | 214 | import sys
import pytest
from ray._raylet import JobID, TaskID, WorkerID
from ray.core.generated import gcs_pb2
from ray.core.generated.common_pb2 import ErrorType, TaskAttempt, TaskStatus, TaskType
from ray.dashboard.modules.task_events import task_event_storage as tes
_JOB = JobID.from_int(1).binary()
def _task_... |
04fe5e448e36cadfbc3f291e806b326836529ccf897e3ae4b60fda24985cabff | Python | 7,975 | 243 | """
Train a noised image classifier on ImageNet.
"""
import argparse
import os
import torch as th
import torch.distributed as dist
import torch.nn.functional as F
from torch.nn.parallel.distributed import DistributedDataParallel as DDP
from torch.optim import AdamW
from .guided_diffusion import dist_util, logger
fr... |
2b9ad4f0f764009e42ffcc152ec91836ed59a61dd5596ebce7650b6ac0691b8c | Python | 7,976 | 255 |
import numpy
import plotly.graph_objects as go
import matplotlib
from matplotlib import pyplot
from plotly.subplots import make_subplots
from plotly import express
from tiffwrapper import make_composite
import utils
COLOR = "#87cdde"
cmap = matplotlib.colors.LinearSegmentedColormap.from_list(
name="space",
# ... |
aed32bbdf257aff53fd14a289ad609b17fb561a0cee921eb66fb60b6b5c24072 | Python | 7,980 | 195 | """Peptide → protein summarization for ``ov.protein``.
Bulk LC-MS/MS search engines often report **peptide / PSM-level**
intensities; the downstream DE machinery (DEqMS, proDA, MSstats) works
on **protein-level** matrices. :func:`summarize` collapses a
peptide-level AnnData into a protein-level one, dispatching to the... |
91b2c011e23a15c6b2fb8173d05591c40c50ec139d2fa1fe60dec6f3a1ff5516 | Python | 7,985 | 128 | import pandas as pd
import numpy as np
from Code.utils import fastq_reader, sort_seqs_to_mut, sort_mut_by_number, is_interface_mut
# TIMP library NGS- variables
WTaa = 'CSCSPVHPQQAFCNADVVIRAKAVSEKEVDSGNDIYGNPIKRIQYEIKQIKMFKGPEKDIEFIYTAPSSAVCGVSLDVGGKKEYLIAGKAEGDGKMHIT'
WTnuc = 'TGCAGCTGCTCCCCGGTGCACCCGCAACAGGCGTTTTGC... |
d3d8b3078847fa1b1384ac7db9d94a96f0710219af85b7855e5e39b32fa086d4 | Python | 7,987 | 240 | import tqdm
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation, writers
from matplotlib.collections import LineCollection
#https://github.com/tmiyama/windmap/blob/master/windmap.ipynb
#https://github.com/rougier/windmap
class Streamlines(object):
"""
Copyright (c)... |
c3beeffacc49807bff47b8c661ec7b122ff2e39e8c12562b105aab14b9fa8622 | Python | 7,990 | 224 | import sys
import argparse
import subprocess
import bpy
import bmesh
import mathutils
import nmv.mesh
import nmv.bmeshi
import nmv.scene
lib_path = '/projects/building/lib/python3.10/site-packages/omesh-1.0.0-py3.10-linux-x86_64.egg'
sys.path.append(lib_path)
import omesh
###########################################... |
7557cd3468a0dab8e716bc66b6a26ab48855cbcdb0a65e9d7c7b1be4344c2a18 | Python | 7,993 | 216 | #Function for extracting and averaging raw data
import os
import numpy as np
from pathlib import Path
from scipy.ndimage import gaussian_filter
from mtscomp import decompress
from joblib import Parallel, delayed
import UnitMatchPy.utils as util
#Decompressed data functions
def Read_Meta(metaPath):
"Readin Meta da... |
c6abe9bba896941970eed637cb2eaed4377348c8defd32ceec5de49a44b2a963 | Python | 7,994 | 243 | import numpy as np
import torch
import pdb
import matplotlib.pyplot as plt
from latent_time_stepping.oracle import ObjectStorageClientWrapper
from scipy.signal import savgol_filter
class TimeSteppingDataset(torch.utils.data.Dataset):
"""Dataset"""
def __init__(
self,
oracle_path: str = None,
... |
3f90032b7aa1b3f249fd864d4dd755662ee6a10dd8082d56f34608f0f5c349ca | Python | 7,995 | 180 | """
This file defines the ML models used in Lisa. The class hierarchy is shown below (* = applied directly by Lisa):
BaseEstimator --> EstimatorInterface --> SampleSelectionModel --> LR_BinarySearch_SampleSelectionModel*
|
|
... |
1f69314a9f8b702790fd0343e7102fa3c7ef1a31b288e6a4189d129facba040f | Python | 7,996 | 240 | """
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 logging
from abc import ABCMeta
from functools import cached_property
from pathlib import Path
fr... |
c396ab13a8e36accacd8647d714ba8102e3d6232afff21723adcd7118513be8f | Python | 7,996 | 217 | import asyncio
import logging
import os
import random
from concurrent.futures import ThreadPoolExecutor
import requests
import ray
import ray._common.usage.usage_lib as ray_usage_lib
import ray.dashboard.utils as dashboard_utils
from ray._common.network_utils import build_address
from ray._common.utils import get_or_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.