sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
59d031f9fe998c5cc3b71c330173b83cafeddaf2dac8705882d5b40beab0f5a2 | Python | 4,777 | 105 | import numpy as np, statsmodels.api as sm
from .io import load_activity, load_outputs, load_params, load_meta, load_rates, load_weights, load_current, save_convergence, RESULTS_DIR, SAVED_DIR
from sklearn.linear_model import LogisticRegressionCV
from sklearn.metrics import confusion_matrix
def binarize_inputs(run_name... |
979b95fff157fbdccf07717bdecfd9826363a6fd198bcd3ab05b37bab4bc45ea | Python | 4,778 | 177 | import argparse
import random
import sys
import typing
from . import stl
if typing.TYPE_CHECKING: # pragma: no cover
from typing import IO
def _get_parser(description: str) -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description=description)
parser.add_argument(
'infile',
... |
b7ad780d3128655cc08c44d56ddbf32744c9f18bb001bada5bdc10dcb72e7023 | Python | 4,779 | 112 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
"""
#%% Import Modules
import pandas as pd
import warnings
from pathlib import Path
warnings.filterwarnings("ignore")
#%% Functions
def retain_quantile(data, percentile=0.9):
percentile_val = data[3].quantile(percentil... |
b9fc57a07b45985572df6651f56852cae2a65b9a7fafeae17d7c1528a96bbe30 | Python | 4,780 | 150 | import logging
import threading
import time
from typing import Optional, Union
INTERNAL_TIMESTAMP_LOG_KEY = "_ray_timestamp_ns"
def _print_loggers():
"""Print a formatted list of loggers and their handlers for debugging."""
loggers = {logging.root.name: logging.root}
loggers.update(dict(sorted(logging.ro... |
3cbe23ffb81d4b5920daeb1f26e673b8de537fa98a52c4c367f1b6085346d575 | Python | 4,781 | 175 | r"""
Dataset management utilities for omicverse.
This module provides functions to load datasets for single-cell analysis,
following the dynamo-release sample_data.py pattern.
Main functions:
get_adata: Download and load AnnData from URLs
download_data: Download files with progress tracking
pbmc3k: Load P... |
39ab4c257928fe546b40fa0efe0aeecc3d1c8f47cd5f4a9c13f670587b5fbb5b | Python | 4,783 | 145 | """
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 typing import TYPE_CHECKING, Literal
import torch
import torch.nn as nn
if TYPE_CHECKING:
fr... |
bc20d0d05c28dc3de3ea481c12f1c43328f196a3cdbc0c070b8fb49428755007 | Python | 4,783 | 146 |
import numpy
import pickle
import os
import bz2
from collections import defaultdict
from matplotlib import pyplot
from gym_sted.prefnet import PreferenceArticulator
PATH = "/home-local/gym-sted"
class LeaderBoard:
"""
Creates a `LeaderBoard`
"""
def __init__(self, models, bleach="low-bleach"):
... |
62543647a827545f2ae19661f1305ddc621177497c9c0fb1813d546fe5b935da | Python | 4,784 | 137 |
import torch
from torch import nn
class EEGNet(nn.Module):
def __init__(self, nb_classes=4, kernel_size=125, number_channel=22, signal_length=1000,
dropoutRate=0.5, pooling_size1=8, pooling_size2=8, f1=8,
D=2, f2=16, norm_rate=0.25, dropout_rate=0.5):
super(EE... |
046e72e8e131398aa298afa1017cf3cd4edfd6ebddbd6c4745454e05fbcced63 | Python | 4,785 | 152 | #!/usr/bin/env python
"""
Compare two metrics files.
"""
import sys
import argparse
import math
import re
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import svtest.utils.IOUtils as iou
WIDTH = 10.24
HEIGHT_SCALE = 0.25
MAX_ROWS_PER_PLOT = 500
def main(ar... |
d8f5b028b9d56b2e1910af9374a7fa78c21207fd19a42d18a5f3fe2ac2cadd88 | Python | 4,787 | 153 | # This file is part of the INTREPPPID programme.
# Copyright (c) 2023 Joseph Szymborski.
#
# This programme is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, version 3.
#
# This programme is distributed i... |
ed3e4b2a2ce4eb2f5d334bdb8ab228e0465ac3a42bb59d172ad6ba044289087a | Python | 4,787 | 117 | # MIT License
#
# Copyright (c) 2020 Marcus D. R. Klarqvist, PhD, MSc
# https://github.com/mklarqvist/tf-computer-vision
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction,... |
eb185fe103c862d58c4b8df5e0040a89540e6e132a60778dfbc40551d24f0708 | Python | 4,788 | 141 | # 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... |
c52e74dfac8820416758a81073e44fefa30100c00a233cc77c5de49fafb8c976 | Python | 4,789 | 122 | #%%
from re import A
import torch
import numpy as np
import matplotlib.pyplot as plt
import torch.nn.functional as F
import sys
import pickle
import itertools
import random
import os
from src.encoders_decoders import *
from src.losses import *
from src.useful_functions import *
from torch.utils.data import DataLoader
f... |
b803b243f5d71757db4aef876ad80b0bd66b0952e55084b60b06157c0e040b6e | Python | 4,790 | 142 | import os
import torch
import torch.nn as nn
import torch.optim as optim
import wandb
from ldctbench.hub import load_model
from torch.autograd import Variable
from tqdm import tqdm
from ldctinv import utils
from ldctinv.cinn.network import ConditionalTransformer
from ldctinv.data.LDCTMayo import LDCTMayo
class Trai... |
44dfa84256968cd65b5fb7dd328c9361a5557fc3709326d256b1e68c9b21369c | Python | 4,791 | 129 | # 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... |
c160fed565b5696d3307d611e059c0bd2359289292f29c8740c88b1795a36515 | Python | 4,795 | 125 | import time
import pytest
import samna
import torch
from tests.hw_utils import find_open_devices, is_any_samna_device_connected
from torch import nn
from sinabs.backend.dynapcnn import DynapcnnNetwork
from sinabs.backend.dynapcnn.io import calculate_neuron_address, neuron_address_to_cxy
from sinabs.layers import IAFS... |
50a32e7126bf8c362b5bba1fc8743bbf13198a001e290c73434b308762ce16d0 | Python | 4,796 | 145 | 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, smiles2graph_test, bond_types
from models import *
import math, sys, random
from optparse import OptionParser
import threading
from multiprocessing import Queue
import rdkit
fr... |
339d9d4ec89d9fa41e8a4d885b19822b1b3806083999b4e688ae6b67a21689ed | Python | 4,799 | 122 | import sys, os
import torch
import argparse
import numpy as np
from Bio import PDB
from biopandas.pdb import PandasPdb
parser = argparse.ArgumentParser(description="Extract geometric constraints from PDB files")
parser.add_argument('--state1', type=str, help='conformational state 1')
parser.add_argument('--st... |
9d733b61a8a5a2338a3902369a6f73ef5dca52ab3d1bd9b2bf4a6fb5cf9530bd | Python | 4,800 | 116 | ####################################################################################################
# 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... |
83e7f759b7c2ae90a39b65c32a27a98700032083c4c815da7d8f483c74cb8409 | Python | 4,801 | 130 | import numpy as np
# from tifffile import imsave,imread
# from mwr.util.mrcfile import *
# from mwr.util.filter import no_background_patches
#import mrcfile
def normalize(x, percentile = True, pmin=4.0, pmax=96.0, axis=None, clip=False, eps=1e-20):
"""Percentile-based image normalization."""
if percentile:
... |
2b73a879e95bd294bd7c53961154c0d9aa7c354d19e65330d946a0d19c4ba399 | Python | 4,802 | 159 | import abc
from dataclasses import dataclass, field
from typing import Any, Callable, Iterable, List, Optional, Tuple
from ray.data._internal.stats import IterationStage, TimeSpan
from ray.data.block import Block, DataBatch
from ray.types import ObjectRef
@dataclass
class BlockStageTimings:
"""Per-block timing f... |
b10d65b91b2e7d4da4e45f69a3e68b6afd98997725b658d27d8f42729e79e904 | Python | 4,806 | 131 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Identify and classify duplicated variants from an input VCF.
"""
from typing import List, Text, Optional
from collections import defaultdict
from itertools import groupby
import argparse
import sys
import pysam
def process_duplicates(vcf, fout):
# Initialize co... |
b8ff3d289ddd5c8e7938c4f458e304ce4af1ff08091754dcac8a9abf47e00b18 | Python | 4,806 | 159 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Visualization utilities (web)."""
import argparse
from typing import Optional, Union
from pathlib import Path
from cycler import cycler
import matplotlib.py... |
cebe70e8563251df0c7647a79f8c730f1ac7cb88f0641407a8832baa58a942ce | Python | 4,808 | 144 | import tensorflow as tf
from tensorflow.keras import backend as K
import os, sys
import h5py
import matplotlib.pyplot as plt
from utils import *
import gc
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# from TEST_dataset import *
# from SpliceNN import *
# from SpliceNN_utils... |
2290df9e9db5d59eda654172f29f712b63814519029bbd6f412db9097f1e8bdb | Python | 4,809 | 125 | from mdgru.eval import SupervisedEvaluation
import logging
import os
from mdgru.helper import argget, check_if_kw_empty, generate_defaults_info
import torch as th
import numpy as np
import copy
import time
from torch.autograd import Variable
from mdgru.helper import compile_arguments
class SupervisedEvaluationTorch(S... |
bd0a0fd77e4758a8b10571a822c61e22f46c8d8523749031f1b4f94d353ee993 | Python | 4,809 | 131 | ####################################################################################################
# Copyright (c) 2019 - 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... |
570250d7097cc282570f161531b60f85266ad63bc210521de17f0fa59bea8d69 | Python | 4,811 | 108 | #--------------------------------------------------------------------------------------------------------------------------------------------
# Authors: Brandon S Coventry Wisconsin Institute for Translational Neuroengineering
# Date: 04/22/2024 Wisconsin is springlike? Finally?
# Pu... |
7e1635a458f4bc8525fe92fbf32dd4132cf9988e8479c426652ec3588f87f52e | Python | 4,811 | 103 | import numpy as np
import argparse
import pickle
from typing import Dict, List, Tuple
import visionloader as vl
from cellmatch.combine_multiple_cell_matchings_by_RF_and_cell_type import get_stafit_centers_ordered, \
greedy_match_rf_centers
from lib.dataset_config_parser.dataset_config_parser import read_config_f... |
84a222a25153a38ef085d8464b4be9aa8b0d24efa1ec97c3f8c0d3b5345a8b26 | Python | 4,814 | 145 | #
# 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... |
7167856c311d31fcd0cc7976e529c7db107ff3989cc5e598826b01759f3ae42f | Python | 4,816 | 131 |
################################################################################
# -- Tools for simulating networks of spiking neurons using the NEST simulator
################################################################################
from imp import reload
import defaultParams; reload(defaultParams); from defa... |
a23d76045ebe4fff14a4d0e35652c07e60f767b4acad7a9a2ee09fab162761d7 | Python | 4,817 | 137 | """
Shared RayImage dataclass for image identity logic.
Centralizes wanda image naming, validation, repo lookup, arch suffix,
and variation suffix computation used by both ci/build/build_image.py
and ci/ray_ci/automation/push_ray_image.py.
"""
from __future__ import annotations
from dataclasses import dataclass
from... |
fbd6a7940eb885bfcdae34adb1e0b32b4817095aaeab022a307a7a4a18fd35d9 | Python | 4,818 | 134 | from dataclasses import dataclass
import numpy as np
from .node import NIRNode
from .utils import calculate_conv_output
@dataclass(eq=False)
class Conv1d(NIRNode):
"""Convolutional layer in 1d.
Note that the input_shape argument is required to disambiguate the shape, and is
used to infer the exact outp... |
36704cda7cdc2286e4294288545ebbcce7e19d321c853653588fb319f07beb31 | Python | 4,820 | 116 | import os
import numpy as np
import time
import torch
import torchvision
from tqdm import trange
from reservoir_KS import Reservoir2D
from KS_dataset import KSDataset
class Optimizer:
def __init__(self, batch, V_min=11.0, V_max=13.0, Cth_factor=1.0, noise_strength=0.002):
# self.batch = batch
... |
aba65ba4f0bb2ccb3e77aa2d30043899228abe4ba66d37e2db4f17becd793bed | Python | 4,820 | 145 | from PIL import Image
import numpy as np
from ctypes import *
import ctypes
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import cv2
import time
import pdb
import torchvision
import scipy
import scipy.ndimage
import PySpin
import matplotlib.pyplot as plt
from ... |
837db0fe72d0b4b413f0d1f5d3c5363563f369f8042d45389070c071e6241769 | Python | 4,822 | 145 | """SRA prefetch wrapper with validation."""
from __future__ import annotations
import time
from pathlib import Path
from typing import Dict, List, Optional, Sequence, Union
from .._registry import register_function
from ._cli_utils import (
build_env,
ensure_dir,
ensure_link,
find_sra_file,
listif... |
07ec22b2ab02db106fb70ae45a6c8035065ce5105a531f2bb85188ad5abc3fc7 | Python | 4,823 | 121 | import signal
import sys
import pytest
import requests
import ray._private.ray_constants as ray_constants
from ray._common.network_utils import find_free_port
from ray._common.test_utils import wait_for_condition
from ray.tests.conftest import * # noqa: F401 F403
def test_healthz_head(monkeypatch, ray_start_cluste... |
7e6255ce44142bc9fe52b53daf6eb816a8d2217b7360e38ebbc685b08040cf8d | Python | 4,824 | 136 | '''
Upsample images. Assumes that a registration mask is generated based on first
session.
'''
import os
import subprocess
import glob
DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti'
UPFACT = 4
SUBS = ['sub-05']
for sub in SUBS:
# ====================================================... |
137bc7341251a3c4b192bd330a112781889d02ffa4dd3f10fd49635f03ee2e68 | Python | 4,826 | 158 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard imports
import joblib
from pathlib import Path
# Third-party imports
import numpy as np
import pandas as pd
from tensorflow.keras import models
from tensorflow.kera... |
3b70ff36babf75fcf4183a0e979d13d5dd6ba62ff8cd6936f49c8bb14afdc53c | Python | 4,827 | 155 | # %%
import json
import os
import re
from pathlib import Path
from typing import Optional, Sequence
import h5py
import numpy as np
import PIL
import torch
from torch.utils.data import ConcatDataset, Dataset
from torchvision import transforms
from tqdm import tqdm
from . import __version__
__all__ = ["extract_feature... |
3d51daa53f1deefc3d08f59d9dd4e66b603dbf4c0c8f1400408c7f8aab7b41f2 | Python | 4,828 | 114 | import torch
from loss import spearman_loss
from metrics import spearman_corr
class ProcessingData(torch.utils.data.Dataset):
def __init__(self, train_csv, train_pt):
self.train_csv = train_csv
self.train_pt = train_pt
def __len__(self):
return len(self.train_csv)
def __getite... |
4b3d4b154b621af089d46cf349fdc9065854337df313aa78a300a3eafaa34740 | Python | 4,828 | 120 | ####################################################################################################
# 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... |
6f7b53ec79af77e9a5f48694266dfb2100bf0fa8c61cd168944bd6e1e96cd82e | Python | 4,828 | 132 | ####################################################################################################
# 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... |
bc304c9d4e296202343d742c951d079bd1470db074e47c39a03d02cc849b6074 | Python | 4,829 | 125 | import argparse
import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import pdb
from PIL import Image
from scipy.io import loadmat
from torch.autograd import Variable
from torchvision import transforms
import deeplab
from pascal import VOCSegmentation
from cityscapes import Citys... |
18985d870247a1b19498a76e629c516891fb89ef6926f309119c32cd4ead702c | Python | 4,830 | 143 | from typing import Dict, Optional, Sequence, Union
import torch
from torch.utils.data._utils.collate import default_convert
from rising.transforms import AbstractTransform, BaseTransform
from rising.transforms.functional import tensor_op, to_device_dtype
__all__ = ["ToTensor", "ToDeviceDtype", "ToDevice", "ToDtype",... |
3ff3f8a83c35e624cc8c1657d1e3f8fbf8636eebc5f65f29d778f67c6c578604 | Python | 4,831 | 140 | """VideoEncoder deployment - GPU-based frame encoding using SigLIP."""
import asyncio
import logging
from typing import List
import numpy as np
import torch
from ray import serve
from transformers import AutoModel, AutoProcessor
from constants import MODEL_NAME
from utils.video import frames_to_pil_list
logger = lo... |
91e298a52f145e734478feffcde6627f861974cf7e15774ca6cf0c3d339404fa | Python | 4,832 | 169 | '''
check if we can cluster the scene vectors
in particular, can we derive good clustering parameters from the training set
and generalize to the validation set
this is essential for the clustering based shortcut model to work
'''
import os
import pickle
import torch
import numpy as np
import pandas as pd
import seabo... |
802052e7a69759d43c4b4525075c0c37566d12af79685f4266d558b15c679db6 | Python | 4,834 | 154 | import unittest
from neuron_morphology.morphology import Morphology
from neuron_morphology.constants import (
AXON, APICAL_DENDRITE, BASAL_DENDRITE, SOMA
)
from neuron_morphology.feature_extractor.data import Data
from neuron_morphology.features.statistics import overlap as ol
from neuron_morphology.feature_extrac... |
ae955cf6514d235b8ed4fa385eebf6ea43c1c37ed2e4d110d2e81c704d7ee8a9 | Python | 4,834 | 145 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import argparse
import glob
import os
import numpy as np
SPLITS = {
"OC20": ["id", "ood_ads", "oo... |
2487573c820f40589e04f8dbf306e352e57b9206648a2766c22dec2e7c8b852e | Python | 4,835 | 188 | """
Implementing "a complex network structure" example in https://github.com/synsense/sinabs/issues/181
"""
import torch
import torch.nn as nn
from sinabs.activation.surrogate_gradient_fn import PeriodicExponential
from sinabs.layers import IAFSqueeze, Merge, SumPool2d
class SNN(nn.Module):
def __init__(self, b... |
8533ae6881e14da63d137bfb51fb9d52fb724663dc08a81753001cb2fbe803f2 | Python | 4,835 | 100 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This code splits a bam file by a user-specified tag. Tag values can either be exact macthes, or matches with a certain number of allowed mismatches. In the latter case, all possible tag values must have the same length.
It produces two output files:
- file one: al... |
18e92fc4fd5a12d4ebd6bb6727d7a76cce1dff0ea52675b8c831c3a9cae652d2 | Python | 4,837 | 108 | # MIT License
#
# Copyright (c) 2020-2022 Marcus D. R. Klarqvist
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... |
eb94e84925046190415f96dc2f73561482ecff769c1fc2ae9f9125c9a879004a | Python | 4,837 | 133 | import numpy as np
from .basic_distributions import Distribution
from .bernoulli import Bernoulli
from .univariate_gaussian import UnivariateGaussian
from ..utils import *
class BernoulliGaussian(Distribution):
"""
Class to define a Bernoulli-Gaussian distributions (for more information see Titsias and Gredi... |
143beee015208a0dc926f3dfd4110329c400b65549ed8140d27325e0d1c84251 | Python | 4,838 | 146 | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
62d4a6fd8126e8f67b4927b4eb4ede76e5c2d9bc60c873c9d70d12896b3025dd | Python | 4,838 | 146 | """
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 time
from typing import TYPE_CHECKING
import ase
from ase import units
from ase.md.langevin imp... |
135dbe6ae0703916c879d19403fbc2117c8fedd6d1f012609bf53b9bf0805f16 | Python | 4,839 | 125 | ####################################################################################################
# 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... |
1326f96d06ad510031e524ec61187b302d0d5809de7a0f02cae9eb0f4ede466d | Python | 4,842 | 131 | import h5py
import numpy as np
import torch.utils.data as torch_data
from typing import List
class ImagenetMaskedDataloader(torch_data.Dataset):
FRAMES_KEY = 'data'
def __init__(self,
hdf5_path: str,
noise_levels: List[float],
masks: List[np.ndarray],
... |
ba740f27cf666db94bf531bc1b7632bf19f531f59c031874503333981731a3c8 | Python | 4,843 | 127 | # 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... |
dc07bcb598dfd8fffd8db4fa550e8adee5915a423a2aa37f82cf8286cd32b93c | Python | 4,847 | 96 | import json,sys
import logging
global logger
logger = logging.getLogger('main')
logger.setLevel(logging.INFO)
global refine_param, predict_param, extract_param, param_to_check, param_to_set_attr
refine_param = [ 'normalize_percentile', 'batch_normalization', 'filter_base', 'unet_depth', 'pool', 'kernel', 'convs_per_de... |
e8b874f4910989ab89b8505f7b5441279b1234e1ca75524ec8855d6486e4adfb | Python | 4,848 | 94 | import torch
import numpy as np
from einops import rearrange
from typing import Any, Dict, List, Tuple, Union
from utils.dataset import create_coords, create_flattened_coords
class RandomCubeSampler:
def __init__(self,data: torch.Tensor,weight:np.ndarray,coords_mode:str,cube_count:int,cube_len:List[int],sample_c... |
f68a05084333bdccd170489ac026fc83a044fa8890ebd52918379a915311a22e | Python | 4,850 | 161 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
4519199fc8eb434db41ab8ad51efca1a70071b3e41d7a843df2d5f519fb9897b | Python | 4,852 | 133 | """
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 typing import TYPE_CHECKING
import torch
from torch import nn
if TYPE_CHECKING:
from fairche... |
9523f8924d561979fcc3ac412f84202c3036d0aa9824e270bf7977c0b16c79bb | Python | 4,853 | 172 | """
Copy Wanda-cached container images to a destination registry using crane.
Example:
bazel run //ci/ray_ci/automation:copy_wanda_image -- \\
--wanda-image-name manylinux-cibase \\
--destination-repository rayproject/manylinux2014 \\
--tag-suffix -x86_64 \\
--upload
Tags are gener... |
74a558bceab9d3d515092981d12f6f1e90a2d52a8a5bb8d78d9b0f934be2e264 | Python | 4,854 | 107 | # plot_canonical.py
# Copyright (c) 2010 Jes Frellsen
#
# This file is part of Muninn.
#
# Muninn is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Muninn is distributed in the hope that it will be... |
e1b0bedfd4f3a866110744dcdad69fef8ca18c63848a2885619b685c3d9a20af | Python | 4,854 | 117 | from os.path import join
from typing import Dict, List
import lightning.pytorch as pl
import numpy as np
import pandas as pd
import torch
from lightning.pytorch.tuner.tuning import Tuner
from cellnet.datamodules import MerlinDataModule
from cellnet.models import TabnetClassifier, LinearClassifier, MLPClassifier
cla... |
a537bac1f78ca84daf7a36922ededa0c8ff03e230f6731eab5643b975a06f901 | Python | 4,855 | 156 | # -*- coding: utf-8 -*-
import numpy as np
from vtkplotlib.plots.BasePlot import ConstructedPlot
from vtkplotlib.plots.polydata import join_line_ends
class Lines(ConstructedPlot):
"""Plots a line passing through an array of points.
:param vertices: The points to plot through.
:type vertices: numpy.ndar... |
d049b96ecd2621227830623d1e1468d9c97fefc0deec25f8d8c72e9e6b3f7094 | Python | 4,855 | 121 | import numpy as np
import pandas as pd
from tqdm import tqdm
def create(words_dir: str, phones_dir: str, out_dir: str, config: dict) -> None:
"""
Create feature from linguistic time stamps and features.
This function reads in the .txt files containing the linguistic time stamps and features and creates a... |
33b1e553647464c6f95a7ec70e9009dc2899d98c791a8bf15e1c299dea5daa81 | Python | 4,856 | 152 | from typing import Union
import torch
from PIL import Image
from torchvision import transforms as tfms
from tqdm.auto import tqdm
from transformers import CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
DiffusionPipeline,
LMSDiscreteScheduler,
PNDMScheduler,
... |
5634bef7f9b9feb2ea9c801bcb8e44036b1c190b2c2a44ee84e8113941520650 | Python | 4,856 | 107 | import argparse
import scipy.stats as sts
import numpy as np
import pickle
import functools as ft
from datetime import datetime
import general.utility as u
import swap_errors.auxiliary as swaux
import swap_errors.analysis as swan
def create_parser():
parser = argparse.ArgumentParser(description='naive swapping an... |
7a8c119f91ba096c2167cb0f7dc99875ca78b2584fb254393a09fe5d4a493da3 | Python | 4,856 | 129 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import logging
from matplotlib.colors import LinearSegmentedColormap
from .util import *
class SomNode:
def __init__(self, X, k,homogeneous_codebook=True):
import somoclu
self.X = X
self.somn = int(np.sqrt(X.shape[0... |
9541830784c1a09f26319ea81ab54ff38a83b2d406adabe46b9500ab8cd22852 | Python | 4,856 | 134 | import itertools
import numpy as np
import pytest
from stl import mesh
def _face(axes, index, axis, direction):
other = [(axis + 1) % 3, (axis + 2) % 3]
corners = []
for offsets in [(0, 0), (1, 0), (1, 1), (0, 1)]:
corner = np.array([axes[i][j] for i, j in enumerate(index)])
corner[axis]... |
9b8ef84ff84ea8d993730f58dd3e7fe6915d12c8c7ce2b4957c7739a6269b384 | Python | 4,858 | 82 | """ File processing procedure / Processus de traitement des fichiers """
import os
import sys
import colorama
import numpy as np
import pandas as pd
from libs.drawing import draw_baseline
from libs.signal_processing import apply_filters, get_epochs, get_power
from libs.signal_processing import parse_baseline, check_b... |
9fa4ae831746e197a6133776fb3ebbe98c599098d1164238df9ea2cd5f3bea05 | Python | 4,860 | 141 | import logging
from dataclasses import dataclass
from typing import FrozenSet, Iterable, List, Optional
from pyarrow.fs import FileSelector, FileSystem, FileType
from ray.data._internal.datasource_v2.interfaces.file_indexer import FileInfo
from ray.data.datasource.file_meta_provider import _handle_read_os_error
logg... |
2ca19dcb5784879cd4d6767f2c1ff6c6d19b090ff987f08d60c5dbd7b42d13d5 | Python | 4,861 | 179 | ##Ratings for SRNDNA
from psychopy import visual, core, event, gui, data, logging
import csv
import datetime
import random
import numpy
import os
import sys
#parameters
useFullScreen = True
useDualScreen=1
DEBUG = False
frame_rate=1
responseKeys=('1','2','3','z','enter','escape')
#subject ID
subjDlg=gui.Dlg(title=... |
52c485a06e70badc7e99bfb6727546da099e6a3f5afacdb14fc7f5e404709150 | Python | 4,861 | 118 | #!/usr/bin/env python
# coding: utf-8
import pyxdf
import pandas as pd
import time
import mne
import matplotlib.pyplot as plt
import numpy as np
import os
from mne_icalabel import label_components
import pickle
def invert_dict(dictionary):
inverted_dict = {value: key for key, value in dictionary.items()}
retu... |
86590aeff3d8dda1eb5a4d6e22a43a163bf0f4075adaf5ad70880f13fab65930 | Python | 4,864 | 142 | import asyncio
import faulthandler
import logging
import signal
import sys
import threading
import time
from contextlib import contextmanager
import pytest
from ray.dashboard import event_loop_monitor
from ray.dashboard.event_loop_monitor import EventLoopMonitor
# pytest's ``caplog`` attaches to the root logger, bu... |
7ee4fdf3650f7fcbcf7b4163c11115f67f43299bd18e904522220b33e362090c | Python | 4,867 | 135 | #!/usr/bin/env python3
"""Check that links to files on Ray's master branch point at files that exist.
Docs, READMEs, and docstrings often link to a file in this repo by its GitHub
URL, such as ``https://github.com/ray-project/ray/blob/master/<path>`` or
``https://raw.githubusercontent.com/ray-project/ray/master/<path>... |
b24a29b6edab82b974faaf69f64dff42f15d578b9d88b149742fabad19686afb | Python | 4,867 | 111 | # 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... |
d34b3396c59d694f9ef0f11cd001a970e19948f75bac5622cd5849130c15a69a | Python | 4,868 | 126 | ####################################################################################################
# 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... |
d598da584195cb6251744d5381e8569b892ce8a4fbf6dea563483da735f3b008 | Python | 4,868 | 89 | import numpy as np
import pickle
import math
def spike_detection(filtered_signal, electrode_stream, fsample, data_preprocessing_config):
"""
Detect spikes in a filtered signal and save the results.
This function processes a filtered signal to detect spikes based on thresholding and
records the spike ... |
72d4e6c28f48eac3a84ada0a2202b5ef2ebd01bf994db05841d5e45d40754f91 | Python | 4,869 | 145 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
import sys
import pysam
import numpy as np
import pandas as pd
from svtk.vcfcluster import VCFCluster
import svtk.utils as svu
def is_batch_only(cluster, batch):
ids = [s.record.id for s in cluster.records]
return all([batch in x for x... |
719ab41a76ccde004ca7b380567a474d1bc809782e1018edcd8ef927fb5b3da7 | Python | 4,870 | 119 | ####################################################################################################
# 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... |
9cc3dc10b3b13fb4a337a7eb2151b2f92cbda23df74820b39ccf0ec959496bd8 | Python | 4,870 | 138 | """
Summary figure of choice decoding
Show early / late trial choice decoding for hit vs. miss (don't use correct reject for this)
Break up my SNR and by brain region.
Point is that choice decoding does not change signficantly over the course of the trial.
This suggests that "choice" decoder readout is probably more ... |
e8d843e98ddc4d4dc7cd3455a932b0d8fd7d4d44cd3a8fd4e7d1a2a8fdc128df | Python | 4,870 | 128 | import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import logomaker
class Cluster:
def __init__(self, name: str, x: float, y: float, r: float):
self.name = name
self.x = x
self.y = y
self.r = r
class Point:
def __init__(self, ... |
1ebbacd7f8264e222dc67f07064f035d812007083537e53cb0d789fade451cd3 | Python | 4,871 | 131 | """
Running first level GLM in FSL using Nilearn
"""
import nibabel as nb
import numpy as np
from nilearn.glm.first_level import make_first_level_design_matrix
import glob
import pandas as pd
from nilearn.glm.first_level import FirstLevelModel
import os
import sys
# Define current dir
sys.path.append('/Users/sebast... |
597e23e221e9b8c407ef8d14f6fce89f1dc785e70cf2a5545dd0d57b510736ad | Python | 4,871 | 120 | from __future__ import division
import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from torch.nn.modules.conv import _ConvNd
from torch.autograd.function import once_differentiable
from gcn import _C
class GOF_Func... |
996895c5a3a43291b981f8cf64c32e93b2c1e25156f191aba65ed9b3b2f7d750 | Python | 4,874 | 140 | import io
import unittest
import random
import numpy as np
import testtools
from vamb.parsecontigs import Composition, CompositionMetaData
class TestReadContigs(unittest.TestCase):
records = []
large_io = io.BytesIO()
io = io.BytesIO()
@classmethod
def setUpClass(cls):
rng = random.Rando... |
c003b2f558dbccc18da95eb298b0d13ebe0e8f1f65cc81c0a6a19d8629892789 | Python | 4,874 | 139 | # 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, ... |
cb243650f6bc2f623b3e3aabc37433bc9226d94a0c4197051a72ec5713dd860c | Python | 4,874 | 113 | # 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... |
d386cd1b0a020c236068d6170916f8fb845fd95b9f71a6686f618c8406b0f9d0 | Python | 4,874 | 158 | r"""
This module contains several helper functions for working with periodic variables.
"""
import logging
import numpy
from numpy import pi, sin, cos
logger = logging.getLogger("mozaik")
def circular_dist(a, b, period):
r"""
Returns the distance between a and b (scalars) in a domain with `period` period.
... |
f90de0758638cd22497b99d857492375b77ce87830bf700d8cf9c221477a73d7 | Python | 4,875 | 94 | # 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... |
64d9100ecd16150bbcae9e47d7b707714ecbf19b1a1a3bd068115933c88725ba | Python | 4,876 | 128 | #!/usr/bin/env python
#!/usr/bin/python
# PYTHONUNBUFFERED=1
"""A simple GAN network and classifer.
"""
# from __future__ import print_function
# Import data
import matplotlib.pyplot as plt
import pyaudio
import wave
import sys
import skimage
from skimage.transform import resize, rescale
import tensorflow as tf
import... |
013f38dc2ecc3153ebdad2b7cfbf67ba7188b38178a70063c7f19140847f61e2 | Python | 4,877 | 132 |
################################################################################
# -- Tools for simulating networks of spiking neurons using the NEST simulator
################################################################################
import numpy as np; import pylab as pl; import time, os, sys
from imp import ... |
aa967d40193398528c0580c7adc74838bcc16f16601799f0e727b9c7d5290cdb | Python | 4,879 | 169 | import torch
import optuna
from optuna import Trial
import wandb
from pathlib import Path
import yaml
from pytorch_lightning import Trainer
from pytorch_lightning.loggers.wandb import WandbLogger
from pytorch_lightning.callbacks import (
ModelCheckpoint,
EarlyStopping,
LearningRateMonitor,
)
from argpar... |
5950b10d8bcee69b764b103ed39f10bd90db9c9f225131a4a34d28200295247d | Python | 4,880 | 145 | #
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
afe68f35a0878876b4b6b974d29a4c2e532e1758ef2b4407396b34bd6a86528d | Python | 4,881 | 147 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""High level analog tiles (floating point)."""
from typing import Optional, Tuple, TYPE_CHECKING
from torch import Tensor
from aihwkit.simulator.rpu_base imp... |
e2bfb1f12175405d15c822bd2c6530bd951a8af181a57fb3ce025cdf60942975 | Python | 4,881 | 161 | import json
import numpy as np
import snntorch as snn
import argparse
from snntorch import functional as SF
from snntorch import surrogate
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import nir
# NOTE: this requires snntorch/nir (PR) and nirtorch/master (unreleased)
from snntorch import ... |
588563ea06e898a00109a146c0774e27dd0435eb7e381a4b6838a54b8152fece | Python | 4,883 | 147 | import numpy as np
import torch.nn as nn
import torch.optim as optim
from basetest_training import _TestTraining
from pfrl import q_functions, replay_buffers
from pfrl.envs.abc import ABC
from pfrl.explorers.epsilon_greedy import LinearDecayEpsilonGreedy
from pfrl.nn import RecurrentSequential
class _TestDQNLike(_Te... |
0d4b7940bb6a59dbd37bd09d97a94edd8ad0af4ebde763cb5a955e50f6626ada | Python | 4,885 | 205 |
import os
import ray
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import numpy as np
import pdb
from latent_time_stepping.oracle import ObjectStorageClientWrapper
from latent_time_stepping.utils import create_directory
def save_data(
idx: int,
pars: np.ndarray,
state: np.ndarray,
... |
5b2f6b523b4612c57fe895d5cbdbe9f0feabf4e38c298fed2a0c96c426878714 | Python | 4,886 | 160 | """ This camera object can inherit from the same genreal class as
basler and flir, but with some pecularities.
- Azures should await a trigger from the arduino before starting
- The camera grabs multiple images. RGB, IR, and depth.
- ???
"""
from multicamera_acquisition.interfaces.camera_base import BaseCamera, Came... |
12d17755eeec4e7c3a8650dd66301d9dd595cd600f69abd2f5034bb4d7f2b881 | Python | 4,887 | 138 | #!/usr/bin/python3
import numpy as np
import json
import os
import sys, getopt
# January 31, 2020
# February 27, 2020: Modified script to take command line arguments to make easier for others
# May 29, 2020: Added ouput folder flag instead of saving in the directory where this script was called
# Aug 24, 2020: Added ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.