sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
44138f01e5725b8d8d04fad1f30456e26eccc07ff004a539bf919967e03518ee | Python | 4,677 | 122 | import pytest
from siapy.core.exceptions import InvalidInputError
from siapy.entities import SpectralImage, SpectralImageSet
from siapy.entities.images.rasterio_lib import RasterioLibImage
def test_spy_open_valid(configs):
header_paths = [
configs.image_vnir_hdr_path,
configs.image_swir_hdr_path,... |
ef8a941ea67d5a89399e5a7aa67b873f3b36ea2770a55457f738472bccb8d8b3 | Python | 4,678 | 134 | import argparse
import shutil
from importlib.resources import files
from pathlib import Path
def get_valid_config_groups(pkg_config_dir):
"""Get list of valid config groups from package config directory."""
config_path = Path(pkg_config_dir)
valid_groups = []
for path in config_path.rglob('*.yaml'):
... |
ea012e72d0e5b4e6754d4e987ad1158a5acf6c66b3e14b9441a96b690cd543dd | Python | 4,680 | 155 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 18 09:19:44 2022
@author: pbolan
"""
import glob
import os
import matplotlib
import numpy as np
import sys
from utility_functions import *
import evaluate_partA_byslice
import evaluate_partA_bypixel
#%%
def make_html(plot_dir):
# Make the a... |
eeff803893eb86dfd360d1d9bfcd05506c4035b78073eb3887828b0245b45c6d | Python | 4,680 | 150 | #!usr/bin/python
"""Experiments for co-expression v2."""
# -------------------------------------------------------------
# Compute co-expression modules within python scanpy framework,
# Using data loader + modules + graph handlers
# Created: 12/01/21
# -------------------------------------------------------------
impo... |
16ee473fd3e5ba4c2b65d5805f91e7bfeefb0db8d2af53139046b416f026ab82 | Python | 4,682 | 143 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
dc8055cdbc1a95f8a14a11f0f5d24f01087fd9607a34670bc10331dad912059f | Python | 4,684 | 139 | import os
import platform
import subprocess
import sys
from typing import List, Optional, Tuple
from ci.ray_ci.configs import DEFAULT_ARCHITECTURE, DEFAULT_PYTHON_VERSION
from ci.ray_ci.container import Container, get_docker_image
_DOCKER_CAP_ADD = [
"SYS_PTRACE",
"SYS_ADMIN",
"NET_ADMIN",
]
class Linux... |
6b86b30573a951791b434e20f301a82a3d24f2abb2494c12279cb404a1c7969e | Python | 4,687 | 122 | import os
import numpy as np
import numpy.random
numpy.random.seed(42)
from spinnaker2.configuration import PEConfig, ExperimentConfig, MemoryRegion, Experiment
from spinnaker2.coordinates import ByteAddr, WordAddr, PE
from spinnaker2.mla import mla_config, mla_helpers
import spinnaker2.hardware
"""
Simple experiment... |
131fcaa5dfd282f7c4b2c3998eda09b832547f4a8a762df8f780c0bb6fe72ba3 | Python | 4,688 | 140 | # importing required modules
import sys
import os
import numpy as np
import pandas as pd
import cv2
import torch
import torch.nn as nn
from efficientnet_pytorch import EfficientNet
from tqdm.notebook import tqdm
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
from tqdm import tqdm
fr... |
7c71a23c5b812600ed23cc520f2309c7abc26ad558a1480aae02d4590359f87b | Python | 4,689 | 132 | import torch
from diffusers import KDPM2DiscreteScheduler
from diffusers.utils import torch_device
from .test_schedulers import SchedulerCommonTest
class KDPM2DiscreteSchedulerTest(SchedulerCommonTest):
scheduler_classes = (KDPM2DiscreteScheduler,)
num_inference_steps = 10
def get_scheduler_config(self... |
43e3413f5dc68d353ad43184d69adad0c98babd9cdd58bfe747d56d7f5437f18 | Python | 4,691 | 139 | from typing import Optional
from ray.dashboard.consts import COMPONENT_METRICS_TAG_KEYS
class NullMetric:
"""Mock metric class to be used in case of prometheus_client import error."""
def set(self, *args, **kwargs):
pass
def observe(self, *args, **kwargs):
pass
def inc(self, *args,... |
e45e58e83b07ac6a866fce55a5f163e6613b7553140bdda060cb76c49f117727 | Python | 4,691 | 142 | import numpy as np
import pdb
import copy
from collections import defaultdict
from network import RateNetwork
class Measurement(object):
def __init__(self, *args, **kwargs):
pass
def attach(self, learning_process):
self.learning_process = learning_process
class Overlaps(Measurement):
def... |
249b13ab3c58a6591715b98c28a1caca1b8fdde15a74c79440f3d522a773beaa | Python | 4,692 | 125 | from __future__ import annotations
import logging
from pathlib import Path
import pandas as pd
from jinja2 import Environment, FileSystemLoader
from . import cauchy_combination
from ._config import CauchyCombinationConfig, ReportConfig
from ._style import Colors, EMOJI
from .diagnosis import run_diagnosis
logger = ... |
ce48e7d6571f0738aafda6ab2e38614899b6fb699814f0c2b2696d29dc490be9 | Python | 4,692 | 143 | import argparse
import hashlib
import io
import os
import zipfile
from typing import Dict
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseDownload
from flyvis import root_dir
checksums: Dict[str, str] = {
"results_pretrained_models.zip": (
"71c78d4070556a536b13b23e... |
1135209ca87e8cd6acf04e5f12347ee65f64cea6ba895e925563848db309d3d3 | Python | 4,695 | 136 | # Ultralytics YOLO 🚀, GPL-3.0 license
from collections import deque
import numpy as np
from ..utils import matching
from ..utils.gmc import GMC
from ..utils.kalman_filter import KalmanFilterXYWH
from .basetrack import TrackState
from .byte_tracker import BYTETracker, STrack
class BOTrack(STrack):
shared_kalma... |
218ef4e515945355bc0f9ef0f6304a79cf7ee5962dcd2eb87142f8b4a5aca896 | Python | 4,696 | 124 | #Utility functions for searching for NEON schema data given a bound or filename. Optionally generating .tif files from .h5 hyperspec files.
import os
import math
import re
import h5py
import numpy as np
from src import Hyperspectral
def bounds_to_geoindex(bounds):
"""Convert an extent into NEONs naming schema
... |
6eeb175b6e87e61792fdc70faf4cc8d8524b9df9940959eac3020b82c82f6f78 | Python | 4,696 | 132 | import os
from dataclasses import dataclass, field
from string import Template
from typing import Any, Dict, List, Optional
import yaml
@dataclass
class BuildArgSet:
build_args: Dict[str, str]
@dataclass
class Depset:
name: str
operation: str
output: str
config_name: str
constraints: Option... |
a010c35ecff3828e638d3575ed895b08df44619649bf2e8da68f64f877a784aa | Python | 4,696 | 125 | import logging
import threading
from typing import Any, Dict
from ray.autoscaler._private.vsphere.cluster_operator_client import (
ClusterOperatorClient,
)
from ray.autoscaler._private.vsphere.config import bootstrap_vsphere
from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler.tags import (
... |
e4fda498a3704973c842a4efa3ed63a83309e8837f02415791a2aee2814e32c4 | Python | 4,696 | 158 | import time
import numpy as np
from discontinuous_galerkin.base.base_model import BaseModel
from discontinuous_galerkin.polynomials.jacobi_polynomials import JacobiP
from discontinuous_galerkin.start_up_routines.start_up_1D import StartUp1D
import matplotlib.pyplot as plt
import pdb
class PipeflowEquations(BaseModel)... |
207ef781e0a0c09f51092c4a7a24c5093de485c590df34dbb716c4ff2ad5551e | Python | 4,697 | 141 | import nltk
import json
import logging
from os.path import exists
from tqdm import tqdm
from agent.data.entities.config import SENTENCES_TABLE, TWEETS_TABLE, FC_TRAIN_SENTENCES_FILTER
from agent.data.entities.config import TEXT8_PATH, TEXT8_VOC, TWEETS_VOC, CORPUS_VOC
from agent.data.sql.sql_mgmt import get_connectio... |
58a0746928c294cca12e2fe7817b4d1d327a21f0241d37a2556790bf9fbf9d66 | Python | 4,697 | 146 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""aihwkit example 31: customized conductance drift models
Simple 1-layer network that demonstrates user-defined drift model
capability and impact on output ove... |
9f71e6728a4c889c8cee43853efc097931d2e4f3ea0c7fdb7dbd938bc1dfe113 | Python | 4,697 | 136 | import sys
import pytest
from ci.ray_ci.automation.image_tags_lib import (
ImageTagsError,
format_platform_tag,
format_python_tag,
get_platform_suffixes,
get_python_suffixes,
get_variation_suffix,
)
from ci.ray_ci.configs import DEFAULT_PYTHON_TAG_VERSION
from ci.ray_ci.docker_container import... |
59ae98bca11cdec464afb911545ef6bb135cd29a7675b298769a61a19cce52a6 | Python | 4,699 | 138 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# mypy: disable-error-code=attr-defined
"""Utility funcitons for converting a module to... |
c62b22d8c4208a6ea5ecdc6f6f484083ba912f9bdf6da1bd8153b87b3d9f4eff | Python | 4,699 | 152 | from os.path import join
import numpy as np
import pandas as pd
from PIL import Image
import torch
from torch.utils.data import SubsetRandomSampler
from torch.utils.data.dataloader import DataLoader
from torch.utils.data.dataset import Dataset
from torchvision import transforms
class RetinaData(Dataset):
def __... |
dffbd003fadcd6a6bfd44224ccbd2fb4f3ca4013f7129f247348cfb82b18e131 | Python | 4,699 | 113 | ####################################################################################################
# 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... |
5f749195a067b663812313e86947b10b654be70045363697e19b22ca53eacba3 | Python | 4,702 | 66 | import numpy as np, json
from scipy.optimize import minimize
from scipy.stats import chi2, norm
def lr(a,sa,b,sb): # log ratio a/b and SE
return np.log(a/b), np.sqrt((sa/a)**2+(sb/b)**2)
out={}
# ---------------- Table S5: timing of M6 block (shi-ts), trained vs naive ----------------
S5=[# label, block, CI-,sem,n... |
8e07e9ed63dc7201399ba114146fed3ebd75c7f2971921a3d410a0171a62bff3 | Python | 4,702 | 151 | # 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, ... |
b5afaee33e9c098c354eacbbd2bc9037bdadb757a3962569388c1a8af1504f0b | Python | 4,702 | 142 | ####################################################################################################
# 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... |
fc940aad33f29e26ef8c522be011e068824038c2435adb1784b0a167a471923a | Python | 4,702 | 112 | import torch
import torch.nn as nn
import torch.nn.functional as F
from model.warplayer import warp
from model.refine import *
def deconv(in_planes, out_planes, kernel_size=4, stride=2, padding=1):
return nn.Sequential(
torch.nn.ConvTranspose2d(in_channels=in_planes, out_channels=out_planes, kernel_size=4,... |
b404256ab74561eeeb645bd46952a660d857612780e030714b5508f92d53a69e | Python | 4,703 | 130 | import numpy as np
from spinnaker2.neuron_models.application import BaseApplication
from spinnaker2.neuron_models.lif_neuron import LIFApplication
from spinnaker2.mapper import SynapseWordSize, SynapseWordSpec
from spinnaker2.coordinates import ByteAddr
class ChargeAndSpikeApplication(LIFApplication):
"""Applicat... |
30dd9b35cf2e57cf1690ba7d58ebeafa67ad8c22c11d618af186535b6f4ab348 | Python | 4,704 | 125 | # 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, software
# distributed under th... |
40d19a86e336907c661141d89886c7e8df87f704154e100a9fe956534d7912c7 | Python | 4,705 | 143 | """
Thie file contains all global parameters as well as commonly used filenames
and directories
"""
import os
import numpy as np
###############################################################################
# Plotting parameters #
##############################... |
72402220125cf528aa979341b19a7b9f0c658d5ad6e222c993e154f90987b2c0 | Python | 4,705 | 147 | from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, Any
import numpy as np
from numpy.typing import NDArray
from PIL import Image
if TYPE_CHECKING:
from siapy.core.types import XarrayType
__all__ = [
"ImageBase",
]
class ImageBase(ABC):
"""Abstract base class ... |
2278187587e5fb2db8f28686c4fb08e5d4d4cb542376c639335b7ea576c1c932 | Python | 4,706 | 140 | from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
import numpy as np
import xarray as xr
from numpy.typing import NDArray
from PIL import Image
from siapy.core.exceptions import InvalidFilepathError
from siapy.entities import SpectralImage
from siapy.entities.images import ImageBase
if TYPE_CHECKI... |
b7af9f43047842aef7a29b23ed017767bea32ba43da74b97c66602c97fdb4c5e | Python | 4,709 | 190 | import os
from itertools import repeat
import numpy as np
import torch
from descriptastorus.descriptors import rdDescriptors
from torch_geometric.data import Data, InMemoryDataset
from tqdm import tqdm
RDKIT_PROPS = [
"fr_Al_COO",
"fr_Al_OH",
"fr_Al_OH_noTert",
"fr_ArN",
"fr_Ar_COO",
"fr_Ar_N... |
61aff7e5313aec86577276c0a2018b25838f2d36dbfe910f69141090e945c2ad | Python | 4,710 | 116 | from __future__ import annotations
import logging
import os
import celltypist
import joblib
import numpy as np
import pandas as pd
import scanpy as sc
from scipy.stats import mode
from .. import settings
from ._base_algorithm import BaseAlgorithm
class CELLTYPIST(BaseAlgorithm):
"""
Class to compute Cellty... |
ca74fcaa253f907b90d28ec2de4584871a21a24238e67b8c55ec97debfccd38f | Python | 4,710 | 140 | """
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 traceback
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, Se... |
ced6e600d79deb7a343e47234357372e2af3f584127bcc9a2a7280cc8a78fbd7 | Python | 4,711 | 110 | # Training models built by the model factory
import os
import logging
from functools import partial
from typing import List, Tuple, Iterable, Union
import tensorflow as tf
import keras
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
import tensorflow as tf
from ml4h.explorations im... |
ce10a951f6b15267261e80c95465d43c8202acf7a64f5c41dfafa8a59a1e7d6c | Python | 4,712 | 150 | #!/gs/hs0/tga-science/yoda/pymol/bin/python
# -*- Coding: utf-8 -*-
# get images from pymol
# Usage: pymol_getimage_round input_file output_path [n_angles] [-d/--include_diagonal]
import sys
import os
import pymol
import glob
def get_angle(input_file, data_file="./degree.txt"):
### NOT USED NOW
filename = os.p... |
f58b99057f9cd58cfb66bf285c463cdf673c72496e0398cfa5b715ff77e03547 | Python | 4,712 | 161 | import os
from os.path import join
import uuid
import argparse
import pandas as pd
import numpy as np
import toml
from tqdm import tqdm
from pyplink import PyPlink
BOLT_DIR = '../BOLT-LMM_v2.3.4'
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--sample_size',
de... |
46eadc52b1e9fee5092f36d4731a5ba6b48dd2988c7d4288d02f1deac77e82a2 | Python | 4,715 | 175 | """Contains toy functions and classes for quick prototyping and
testing.
"""
from functools import partial
from torch import nn
class MLPModule(nn.Module):
"""A simple multi-layer perceptron module.
This can be adapted for usage in different contexts, e.g. binary
and multi-class classification, regres... |
fcdb8ae18a9a197287f94141e2fdc50efe70e57e74babbc656b27d056da061d0 | Python | 4,715 | 177 | from dataclasses import dataclass
import pickle
import numpy as np
import torch
from typing import Tuple, Dict, Union, Callable, Any
def batch_bernoulli_spiking_neg_ll_loss(generator_sig: torch.Tensor,
spike_vector: torch.Tensor) -> torch.Tensor:
'''
:param generato... |
c4b0c21f030f0b3e79593fcb3e31bfc4fb00b939e28de507fb1708a98d0eb8d0 | Python | 4,716 | 98 |
import numpy
import multiprocessing
from tqdm import trange
class Experiment():
"""
Implements an `Experiment` object that allows to store `Microscope` configurations,
their respective `Datamap`, and their respective acquisition parameters.
The `Experiment` object implements `acquire` and `acquire_a... |
83292a7e4971722d93b692123c6d6faf1b7d2b9d97f2f0255378c5ef4e9858de | Python | 4,717 | 136 | # 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, ... |
6f4a5fecd89a7fcd52594621e6aae8cd6945d5898d2c9f1cd9a76f25faa31d00 | Python | 4,720 | 167 | from data_profiling.config import Settings
from data_profiling.report.formatters import fmt, fmt_bytesize, fmt_numeric, fmt_percent
from data_profiling.report.presentation.core import (
Container,
FrequencyTable,
Table,
VariableInfo,
)
from data_profiling.report.structure.variables.render_common import ... |
a42e50b8777a11280771cc7d6449d825713b752913387941bb5cf975c87b2f1c | Python | 4,720 | 132 | import numpy as np
import pytest
import torch
from flyvis.network.stimulus import Stimulus
@pytest.fixture
def stimulus(connectome) -> Stimulus:
return Stimulus(connectome)
def test_stimulus_init(stimulus):
assert stimulus.buffer.shape == (1, 1, stimulus.n_nodes)
assert stimulus.buffer.sum() == 0.0
... |
82a5833c0ea854dfaa9836e3ebf299f1a6016d91115e9cd57fe0ce0778a4887b | Python | 4,721 | 162 | from samri.optimization.newreg import single_generic
NEWPHASES = {
"f_rigid":{
"transforms":"Rigid",
"transform_parameters":(0.1,),
"number_of_iterations":[300],
"metric":"MI",
"metric_weight":1,
"radius_or_number_of_bins":32,
"sampling_strategy":"Regular",
"sampling_percentage":0.5,
"convergence_th... |
4b7d4742357bd39939261ab7df0ccb40454c374e4aa939be1389c3fd22bf7031 | Python | 4,722 | 118 | # -*- 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.
#... |
71d712b3167c1694b0026a04ca0afe83e0956190148d8559ec9774a87e60126a | Python | 4,722 | 110 | """Regression tests for contour geometry, transforms and surface immutability."""
import numpy as np
import pytest
from vtk.util.numpy_support import vtk_to_numpy
from brainspace.mesh.mesh_creation import build_polydata
from brainspace.plotting import (make_contour_actor, add_contours_to_plotter,
... |
d01bce1be47171c5d112f1eeb910e2c5d818638f8ca530ec844d7a6920186a1b | Python | 4,723 | 131 | import torch
from diffusers import HeunDiscreteScheduler
from diffusers.utils import torch_device
from .test_schedulers import SchedulerCommonTest
class HeunDiscreteSchedulerTest(SchedulerCommonTest):
scheduler_classes = (HeunDiscreteScheduler,)
num_inference_steps = 10
def get_scheduler_config(self, *... |
5702c9d8e6eb12b3c24d63aa4d0da85da3d0ae6692d3af97cd5aef5df4921bda | Python | 4,724 | 175 | """
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 itertools
import logging
import math
from contextlib import contextmanager
from typing import Ca... |
ef22d46ab6f08a79541343f91ef374ea8f7724017758489ae509023da6e10958 | Python | 4,725 | 117 | ####################################################################################################
# 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... |
55b42e7d82d811c34a9cba1436a8c9bcf814305f0f1ed591b18a4c0ed8f445bd | Python | 4,726 | 166 | import numpy as np
from itertools import product
from m2snn.snn import run_snn, masked_inference
from tqdm import tqdm
from tqdm.notebook import tqdm as tqdm_n
import matplotlib.pyplot as plt
from seaborn import violinplot, swarmplot
import itertools
import seaborn as sns
import torch
def compute_additivity(act_pr... |
64c144fbfa6889c4ee79db36ade41cb36afd15bc693adccdbfdc4754184fd836 | Python | 4,726 | 169 | import numpy as np
from numpy import sqrt
from numba import jit, njit
import importlib
cupy_loader = importlib.find_loader('cupy')
if cupy_loader is not None:
import cupy as cp
else:
cp = np
# FIXME: Handle different libpython.so for parallelization with multiple python versions
from optimized_net.routines ... |
4f5f4bff1703495d0d671a9a214ded03a0dbf7ba812ab225c84c7a035398f63f | Python | 4,727 | 113 | import pathlib
path = pathlib.Path.cwd()
if path.stem == 'tmb_survival':
cwd = path
else:
cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')]
import sys
sys.path.append(str(cwd))
import numpy as np
from model.model import Encoders, NN
from model.layers import Losses, Activations
import tensorflow a... |
b72f4d99365c82a5eab6e7e8298170ae1ef7e6ee9bd9e680738a2b68abdc739b | Python | 4,727 | 130 | ####################################################################################################
# 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... |
f3ff3e7611d2d1af19d6f67d64a63a626bd7428fc6c64e2e0485d2658fd1a674 | Python | 4,727 | 135 | from __future__ import annotations
from typing import TYPE_CHECKING
import torch
import torch.nn.functional as F
if TYPE_CHECKING:
from fairchem.core.models.allscaip.configs import (
GlobalConfigs,
GraphNeuralNetworksConfigs,
RegularizationConfigs,
)
from fairchem.core.models.alls... |
56acc4234e06a2a461132a558808cc72be6717f3c9bb5115354f63736c1f0ac2 | Python | 4,729 | 139 | import os
import re
import argparse
import numpy as np
from glob import glob
from tqdm import tqdm
import nilearn.interfaces
from nilearn.maskers import NiftiMasker, NiftiSpheresMasker
from src.data.load_data import load_params
from src.tools import load_model
from src.data.preprocess import LOAD_CONFOUNDS_PARAMS
from... |
9702d0d90b6e076aa49719c202f127be65d6c3dc9c22166f7a4dce57f93d255b | Python | 4,730 | 165 | from os.path import join
import pickle
import numpy as np
import pandas as pd
from tqdm import tqdm
from util import LATENT_DIR, OUT_DIR, get_latent_pkl, get_out
def eval_simulation(
gan_name='stylegan2_healthy',
exp_vars=[0.5],
n_causal=1250,
mult_scale=2.,
model='resnet50',
... |
993157b193dd9e204815dcb96c1f4c7bbc287f44b80e962cfd002ea9e8ff2663 | Python | 4,731 | 97 | import logging
from datetime import datetime
from agent.classifiers.utils.device_mgmt import get_gradient_accumulation_steps
from agent.classifiers.transformer_classifier import transformer_classifier
from agent.classifiers.data.wrappers.transformer_text_fd_dataset_dev import get_datasets as get_fd_datasets_dev
from ... |
99c2fbd034b37c0cd6938b639d04c3d208ef79de0c7664d000b2538e642eb88a | Python | 4,731 | 160 | from pathlib import Path
import numpy as np
import pandas as pd
from data_profiling import ProfileReport
def check_assets(assets_dir: Path, file_type, n_css, n_js):
"""Check that files and dirs exist
Args:
assets_dir: directory of the assets
file_type: png/svg
"""
ass... |
425514a8020eda3e60f251f9c19b430d0edcc576d557a7a4790db29ef038192e | Python | 4,735 | 133 | import logging
from tqdm import tqdm
from agent.data.sql.sql_mgmt import get_connection, update_non_text_field, select_fields_where, select_one
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
ITEMS_TABLE = "annotate_item"
SENTENCES_TABLE = "annotate_sentence"
def update_sentence_revi... |
44a96713c4f9dd490706ab8a09318b8681dce5029ed4b0756d3e9944560777ab | Python | 4,735 | 143 | """
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 ase
import pytest
import torch
from ase.build import molecule
from ase.data impo... |
e52aaf3d50c0812ced388bb630863c65ea7579c6ad516f1a898b311bbaa0469a | Python | 4,735 | 149 | import os
import pandas as pd
from pyfaidx import Fasta
from progress.bar import Bar
'''Get the length of chromosomes'''
def get_chrom_size(path):
chrs = {}
with open(path, 'r') as file:
# read the file line by line
for line in file:
if line.startswith('#'):
conti... |
6bf3541c6cfe17f6087743567708ef043a97ecb0d0cb3acad4828e3434f67f65 | Python | 4,736 | 142 | import os
import pathlib
import numpy as np
import pytest
from openmm.app import CharmmParameterSet, CharmmPsfFile
import endstate_correction
from .test_system import setup_vacuum_simulation
@pytest.mark.skipif(
os.getenv("CI") == "true",
reason="Skipping tests that take too long in github actions",
)
def ... |
ed87b05f433b5c1c41b23870bd99638b96a92d26221b0fa8a6b8e7f7824d923c | Python | 4,736 | 141 | 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... |
a8510223f2d795fb412cf41de1a7adf015bd5278707a5a1c8aee10b11f4e7cb8 | Python | 4,737 | 132 | #------------------------------------------------------------------------------
# Libraries
#------------------------------------------------------------------------------
import torch
import torch.nn as nn
import torchsummary
import os, warnings, sys
from .flops_counter import add_flops_counting_methods, flops_to_s... |
6a29c12de4879a8e6ad3d976ddbf7885daced917964c196946dee79b8e22e47d | Python | 4,740 | 163 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Analog RNN layers"""
from typing import Any, List, Tuple, Type, Union
from torch import Tensor, stack, jit, cat
from torch.nn import ModuleList, Module
cla... |
99b4641d280cf4e5ae8f5da1bee7494b01c74a0f9316b4383103aa4431c53aaf | Python | 4,740 | 136 | import unittest
import sys
from shapely.geometry import LineString, Point
import neuron_morphology.snap_polygons.cortex_surfaces as cs
class TestStandalone(unittest.TestCase):
"""Tests for functions operating on shapely objects
"""
def test_remove_duplicates(self):
cases = [
[
... |
9bacccdaa54d68dff6b74b4096de819940a0ce2f046c99b1d34bee5961bd9a66 | Python | 4,740 | 121 | """
The code for the research presented in the paper titled "Enabling inverse design of plasmon-based nonlinear square resonators with deep neural networks."
This code corresponds to the article's Inverse Deep Neural Network (DNN) section.
Please cite the paper in any publication using this code.
"""
import nump... |
1a76e9ec9cbca5ec1b60940e28b3f620aaa7917bec9df4f4db18859ddf99282c | Python | 4,743 | 144 | import unittest
import numpy as np
import tempfile
import vamb
class TestDataLoader(unittest.TestCase):
def test_permute_indices(self):
indices = vamb.semisupervised_encode.permute_indices(10, 25, seed=1)
set_10 = set(range(10))
self.assertTrue(len(indices) == 25)
self.assertTrue(s... |
67c86c78aaf636d77f01ef61b7d5db9ecf0efc385cf234e39523b48f258b09fd | Python | 4,745 | 131 | import torch
from diffusers import DDPMScheduler
from .test_schedulers import SchedulerCommonTest
class DDPMSchedulerTest(SchedulerCommonTest):
scheduler_classes = (DDPMScheduler,)
def get_scheduler_config(self, **kwargs):
config = {
"num_train_timesteps": 1000,
"beta_start"... |
11e4589dbb94d9a5a6d04785d799296bd21e2ba72ff4c0af218b219da63f2e89 | Python | 4,746 | 102 | """ Fonctions génériques """
import os
from colorama import Fore, Style
# ==================================================
# region Gestion des fichiers
# ==================================================
##################################################
def get_files(path: str, ext: str = ".edf"):
"""
R... |
aba5c14924fdaa62797752df4b27b8e366d681e9a86db6085af88254eeda157a | Python | 4,748 | 153 | """
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.
"""
# example how to use checkpoint fixtures
from __future__ import annotations
import os
from functools import partial
import numpy as np
im... |
d1a9931e2b2e74dfc04379074c857b722d00628c4e2f7377508e495d01bbd5fb | Python | 4,748 | 151 | import torch
def dsc_binary_loss(pred, target, logits=True):
if logits:
pred = torch.sigmoid(pred)
pred = torch.flatten(pred >= 0.5, start_dim=1).to(pred.device)
target = torch.flatten(target, start_dim=1).type_as(pred).to(pred.device)
intersection = (
2 * torch.sum(pred & target,... |
ffa662a2ef9b5ccbe2e21b25fe3e8d83387779f54df88e75837f42956dbad0e5 | Python | 4,748 | 106 | import os
import numpy as np
import time
import torch
import torchvision
from reservoir import Reservoir2D
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
self.V_min = V_min
self.V_max = V_max
... |
658c1d8828429376e955c67caf88f78cc4a160fdeb4527b405c0bfb1a19f2667 | Python | 4,749 | 169 | # Plot all the results corresponding to the 5th fit
# (distinguish whether the points with R2 less than 0.98, and plot the points with error bars in one graph)
import numpy as np
import os
import matplotlib.pyplot as plt
from collections import OrderedDict
from matplotlib.ticker import MultipleLocator
from matplotlib... |
a614bdc23afb35570191f9b65e73967c1b807b7c774e216b26b0fec98152adfe | Python | 4,749 | 118 | import torch
from typing import Any, Dict, List, Tuple, Optional, Union
from ogb.graphproppred.mol_encoder import AtomEncoder, BondEncoder
from models.GATconv import SelfLoopGATConv as MyGATConv
import numpy as np
class SparseEdgeUpdateLayer(torch.nn.Module):
def __init__(self, edge_dim: int = 64, node_dim: int =... |
3271549ac69d7e41756ff69a6561958275d8e7c68bb4b6926e97580c1b831a93 | Python | 4,750 | 138 | r"""
Data preprocess and build graph
"""
from typing import Optional, Union, List
import pandas as pd
import numpy as np
import scanpy as sc
import torch
from torch_geometric.nn import knn_graph, radius_graph
from torch_geometric.utils import to_undirected
from anndata import AnnData
def Cal_Spatial_Net(adata:AnnDat... |
35244960934e240f471a10a5467d6fc56eb7673408bf718dd85cb891051ad8cd | Python | 4,751 | 150 | from PIL import Image
import numpy as np
from ctypes import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import matplotlib.pyplot as plt
from dataset import OCFlowerdata, NLOSdataMNIST_PCA
from tqdm import *
import matplotlib.pyplot as plt
from tensorboardX import SummaryWriter
class ... |
db76af44713e606ba9c4cda7f318cd32375d4601c48865fd47532b542358b494 | Python | 4,751 | 137 | ####################################################################################################
# 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>
#
# The code in this fi... |
e8ab742e0d17fdc42c7bb6073107f1be258b08802e2e82ca349b045d1df02d7a | Python | 4,751 | 130 | ####################################################################################################
# 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... |
9ff82e87626278eec48e94125ec83973109a24ac78b9cd61c6de2d087d684326 | Python | 4,752 | 162 | # flake8: noqa
# __function_api_start__
from ray import tune
def objective(x, a, b): # Define an objective function.
return a * (x**2) + b
def trainable(config): # Pass a "config" dictionary into your trainable.
for x in range(20): # "Train" for 20 iterations and compute intermediate scores.
sc... |
26388374cef0a270e3d2dedd57d98fd8301793ddfdabfc7fc842d0f16dd7925f | Python | 4,753 | 139 | # -*- 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.
#... |
4c3ea49627b4677ea7c44aed7e97c9075219bec6a99e0d0e4c50db61a863c4fc | Python | 4,754 | 149 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import re
import subprocess
import sys
from natsort import natsorted
# -- P... |
b648fe2e3b80b02a9dab1b5013c82da44d3ee5a27fc25796d2845640bf917976 | Python | 4,755 | 140 | #!/usr/bin/python
"""Functions for module enrichments on dataFrames."""
import logging
import numpy as np
import pandas as pd
# Plotting:
from matplotlib import pyplot as plt
import seaborn as sns
# For enrichment:
from scipy.stats import hypergeom
def calc_df_enrichment(df, col, genes, module_match):
"""
... |
70058e6728a129437e8bca5ad4ca4aafd324c05e95cf9998ebc8f903cf63de18 | Python | 4,761 | 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... |
bf48755ae5dcd7a556195a30ba548139097fb5b76db134869ac8254b261d737c | Python | 4,764 | 140 | from torch import nn
import numpy as np
import torch
import torch.nn.functional as F
class MultiHeadAttention(nn.Module):
def __init__(self, n_head, d_model, d_k, d_v, dropout=0.1):
super().__init__()
self.n_head = n_head
self.d_model = d_model
self.d_k ... |
ea8485d2e4a30d9a483afce925d577a24045d3b9902753122f8b5c6bd1355ca8 | Python | 4,764 | 112 | import pandas as pd
import numpy as np
import anndata
import scanpy as sc
import torch
from typing import Union
from ._nocd import scnocd
class scANNORL(object):
def __init__(self,adata,cluster_key):
self.adata=adata
self.cluster_key=cluster_key
def gnn_configure(self,gp... |
8e6674ffbbb00074a526abbd184563508396c47f65311ebf96c2526ef0fa274a | Python | 4,765 | 96 | import os
import json
import torch
import numpy as np
int2AA = {0: "GLY", 1: "ALA", 2: "CYS", 3: "GLU", 4: "ASP", 5: "PHE", 6: "ILE", 7: "HIS", 8: "LYS", 9: "MET", 10: "LEU", 11: "ASN", 12: "GLN", 13: "PRO", 14: "SER", 15: "ARG", 16: "THR", 17: "TRP", 18: "VAL", 19: "TYR"}
aa2int = {"G": 0, "A": 1, "C": 2, "E": 3, "D"... |
67c469ecad88cdf875dc2dd4af4004a23e49d1c259048f4b02dce17208e14400 | Python | 4,767 | 147 | import torch
from torch import nn
from models_.modules import BasicBlock, Bottleneck
resnet_spec = {
18: (BasicBlock, [2, 2, 2, 2]),
34: (BasicBlock, [3, 4, 6, 3]),
50: (Bottleneck, [3, 4, 6, 3]),
101: (Bottleneck, [3, 4, 23, 3]),
152: (Bottleneck, [3, 8, 36, 3])
}
# derived from https://github.... |
36f380eafa4e41d9747c409dd40a6c6d57e9ba93f8548c6131b8dcc3ecc31ba7 | Python | 4,768 | 133 | """Thin wrapper around :mod:`pyfunkyheatmap` for ``omicverse.pl``.
Re-exports the upstream :func:`pyfunkyheatmap.funky_heatmap` entry point and
helpers so users can call them via ``ov.pl.funky_heatmap(...)`` without
importing the third-party package explicitly. The dependency is loaded
lazily so that importing :mod:`o... |
5c46274bd1346005806e24473ca1b833951adb29d88311e9d460882fb3b979b8 | Python | 4,769 | 116 | # coding=utf-8
'''
Created on May 5, 2016
@author: jivan
'''
from __future__ import print_function
import cPickle
import os
import re
import sys
import urllib2
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
CACHE_DIR = os.path.join(ROOT_DIR, 'cache')
valid_species_directories = ['dla', 'bola', 'fla', 'fish', ... |
9a5c104e363776067404d7b4f9a14ab8cafdf497bf32c360474c472a1c633495 | Python | 4,769 | 141 | 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... |
d6fff7b56a23b0ef1fb90a6ee0b70c78eefc5ba1208d96cdcb5b8afd193cb9af | Python | 4,770 | 151 | #!/usr/bin/python
# System imports
import sys, os, re, math
import subprocess
import argparse
import numpy as np
import seaborn as sns
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.font_manager
from matplotlib.ticker import PercentFormatter
from matplotlib.ticker import Format... |
e0d80f0184e28745abf557b3af6a789b7b1ded492ecc0f13d77bdf83d5af0dc7 | Python | 4,773 | 132 | """Token authentication setup for Ray: enable token mode and make sure a token
exists. Token loading, caching and creation live in the C++
AuthenticationTokenLoader.
"""
import logging
import os
from pathlib import Path
from typing import Any, Dict, Optional
from ray._private.authentication.authentication_constants i... |
96a7b7a9b0012286c230e01332017112a0c9ac590d22d17806bef4e86136c9bd | Python | 4,775 | 144 | import argparse
import os
import time
import numpy as np
import torch
from VAE_model import VAE
import sys
sys.path.append("..")
# from guided_diffusion.cell_datasets import load_data
# from guided_diffusion.cell_datasets_sapiens import load_data
# from guided_diffusion.cell_datasets_WOT import load_data
# from guided... |
6c521313ac4d165be38aeb8cade96928d7385eefb118ab10957d4be980775092 | Python | 4,776 | 120 | #Imports relevant modules.
import os
import nibabel as nb
import numpy as np
#Defines the pipeline that we want to generate the SD map for. This will need to be updated each time.
pipeline = '0'
#Based on the above variable, finds the directory corresponding to this pipeline which contains fMRIPrep output.
pipeline_d... |
79c46b5511002dc2be1a391684df0a19db078c68464f9e8cceef41ef46d8af9f | Python | 4,776 | 122 | # 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... |
2510794d5c6ba519c95d35d4c50726d242b618a34a76e04d41cf2f5d9a694fc7 | Python | 4,777 | 106 | ####################################################################################################
# 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... |
31425542b778d17716ee8ee6076746334677af6f16aaaf9b1e082e9f8407d47d | Python | 4,777 | 160 | """CLI entry point and pipeline manager for ensemble operations.
Example usage:
```bash
# Run a pipeline of operations
flyvis \
--ensemble_id 0001 \
--task_name flow \
train \
validate \
record \
analysis \
notebook_per_model \
notebook_per_e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.