sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d94b6560b48e6cdddeac426ddee30dcfd1f461d4df748c28b383421191d6d93d | Python | 12,254 | 336 | import os
import sys
import unittest
# coding: utf-8
from unittest.mock import patch
import pytest
from ray.autoscaler.v2.instance_manager.common import InstanceUtil
from ray.core.generated.instance_manager_pb2 import Instance
class InstanceUtilTest(unittest.TestCase):
def test_basic(self):
# New insta... |
769f56a466d47b9d1df75e3791c78ab39658e5c715aca24808b2fad25d082f60 | Python | 12,256 | 294 | from typing import TYPE_CHECKING, Callable, Dict, Optional, Sequence, Tuple, Union
import torch
from monai.engines.trainer import Trainer
from monai.engines.utils import CommonKeys as Keys
from monai.engines.utils import default_prepare_batch
from monai.inferers import Inferer, SimpleInferer
from monai.transforms impo... |
a6f2673d7f1af03a01c35950a43b129c520de485aa899370720b9d5591b25eb5 | Python | 12,262 | 366 | import unittest
from collections import namedtuple
from unittest.mock import patch
from ray.air.integrations.comet import CometLoggerCallback
class MockTrial(
namedtuple("MockTrial", ["config", "trial_name", "trial_id", "logdir"])
):
def __hash__(self):
return hash(self.trial_id)
def __str__(sel... |
521f5e6a346c08c096654f6a5ebfc99b34250395a0725861c703f5b95dd3e373 | Python | 12,273 | 283 | from tqdm import tqdm
from pathlib import Path
import time
import numpy as np
import torch
from torch.nn.parallel import DistributedDataParallel
import torch.distributed as dist
from torch.utils.tensorboard import SummaryWriter
from .mask import mask_graph_batch
from .position import add_noise_to_batch_pos, scale_batc... |
dcf3131cab7eda81d8ccca953a4b465130081c995f81580fd2c4b02f2a6708c0 | Python | 12,277 | 408 | import numpy as np
import pyro
import torch
import sklearn.preprocessing as skp
import general.pyro_utility as gpu
import pyro.distributions as distribs
from pyro.ops.indexing import Vindex
import general.utility as u
def combine_pickles(data, targ_key="c_targ", dist_key="c_dist", resp_key="rc"):
targs = np.conc... |
99a4d0f3df60f3679d0271884e4fe9dcf566c77776fcf8b3b1f928d6adc209e9 | Python | 12,288 | 324 | from multicamera_acquisition.interfaces.camera_base import BaseCamera, CameraError
import numpy as np
from arena_api.__future__.save import Writer
from arena_api.buffer import BufferFactory
from arena_api.enums import PixelFormat
from arena_api.system import system
import logging
import time
import ctypes
class Luci... |
4772360dbcfe66f1e158da0a8de8858ed7c0cbb7478034fafe89377994674178 | Python | 12,300 | 342 | # 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... |
fd5c7251c18a279d8a7edf0181b078c4d825d0647e3172cb370b9bd7792f771b | Python | 12,303 | 260 |
import numpy
from functools import partial
from banditopt import algorithms, utils
from tqdm import trange
import time
import pandas as pd
import array
import random
from math import sqrt
from deap import base
from deap.benchmarks.tools import diversity, convergence, hypervolume
from deap import creator
from deap imp... |
02083b9eab8b6fcdeade2c583920a74b0ca737cc09fab09f4e530cfd0ecb769d | Python | 12,305 | 393 | from typing import Optional, Sequence, Union
import torch
from rising.random import AbstractParameter
from rising.transforms.abstract import BaseTransform, PerChannelTransform, PerSampleTransform
from rising.transforms.functional.intensity import (
add_noise,
add_value,
bezier_3rd_order,
clamp,
ga... |
fef53da14e9b9383c36585a6f1822f48c09ce7fcdfc51037a6dc5cbfd932da2a | Python | 12,306 | 405 | import pdb
import numpy as np
import torch
from data_assimilation.particle_filter.base import BaseParticleFilter
from ksddescent import ksdd_lbfgs, ksdd_gradient
from ksddescent.contenders import svgd, mmd_lbfgs
import matplotlib.pyplot as plt
class RBF(torch.nn.Module):
def __init__(self, sigma=None):
... |
aaba99e3fba57704bd47def8b28aa6c1cf265e8af5acb10769a56dac41b12fca | Python | 12,311 | 227 | import numpy as np
import tensorflow as tf
from tensorflow import keras
from keras.models import load_model
import pandas as pd
from flask import Flask, request, render_template #for modifying html template with python output
import shap
import gc
import cloudpickle as cp
#set the backend in headless environment to avo... |
e4101e23f3357cabf9798292cbd86ce7ae94e56cf3d66bb440a0bdaf65f869da | Python | 12,311 | 289 | """
The script does the following:
- project the nerve rootlets on the spinal cord segmentation to obtain spinal levels. This is done by dilating the
spinal cord segmentation by 1, 2 or 3 voxels (input argument) and then finding the intersection between the dilated
spinal cord segmentation and the rootlets ... |
3ee1acd2db08f863cb2ab8f05ea6f00cd85e076aaeb92083bb78b961a78dca93 | Python | 12,316 | 300 | import torch
import functools
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import MessagePassing
from torch_scatter import scatter_add
from utils import *
class GVP(nn.Module):
'''
From https://github.com/drorlab/gvp-pytorch
Geometric Vector Perceptron.
in... |
b77a42764040f6821f14eb6928d7094cd242ec09334fef99e9d775d34b5bd828 | Python | 12,317 | 291 | ####################################################################################################
# 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... |
d6544576a628ec94d9761d7172a897a840d5ffbbd64b30073986d37bc7035203 | Python | 12,318 | 408 | # coding: utf-8
import os
import sys
import pytest
import torch
import ray
import ray.cluster_utils
from ray._common.test_utils import wait_for_condition
from ray.dag import InputNode
from ray.exceptions import RayChannelError, RayTaskError
from ray.experimental.channel.conftest import (
Barrier,
start_nccl_m... |
ba799443103f78f0b335d21379c435dc4ab464d3a5d2de4a70c80520dc3a4231 | Python | 12,320 | 348 | from typing import NamedTuple, Optional, Dict, Sequence, Tuple, Type, Any, Union
from enum import Enum
from functools import lru_cache
from collections.abc import Collection
import numpy as np
import pandas as pd
from scipy.stats import wasserstein_distance
from neuron_morphology.features.layer.reference_layer_depths... |
9a8dfe2fff90438290e139eefcd7cd7be6f916af61a0e853fb5fbf498d2038f9 | Python | 12,329 | 317 | #!/usr/bin/env python
# HiC-Pro
# Copyleft 2015 Institut Curie
# Author(s): Nicolas Servant, Eric Viara
# Contact: nicolas.servant@curie.fr
# This software is distributed without any guarantee under the terms of the
# GNU General
# Public License, either Version 2, June 1991 or Version 3, June 2007.
"""
Script to kee... |
2894a1d88d8620a624dbba04c22b56a0bffb5ebfd3b9a5e696334b9d6102e9f6 | Python | 12,330 | 326 | import asyncio
import functools
import logging
import os
import shutil
import subprocess
from datetime import datetime
from pathlib import Path
from typing import Optional, Tuple
from ray.dashboard.modules.reporter.profile_manager import (
_format_failed_profiler_command,
)
import psutil
logger = logging.getLogg... |
4b06fba6d778e8b2fbbde7f6fdb1dbecc043594e7ec2a32bf09a4c5a9f7ba507 | Python | 12,330 | 402 | # ruff: noqa: E501
from ray.dashboard.modules.metrics.dashboards.common import (
DashboardConfig,
GridPos,
Panel,
Row,
Target,
)
# ---------------------------------------------------------------------------
# Reusable PromQL fragments
# -------------------------------------------------------------... |
7dc90acfae224356b9186e51c581d16ae97319b8a525e95cc8d629bae6f6d522 | Python | 12,332 | 373 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import operator
from abc import ABCMeta, abstractmethod
from collections.abc import Sequence
from functools import cached_property, reduce
from pathlib import Path
from typing... |
430f45e546962cef413de4ecd828a815b8820eb30691e178005a99e9baf2ffef | Python | 12,338 | 297 | import argparse
import huggingface_hub
import k_diffusion as K
import torch
from diffusers import UNet2DConditionModel
UPSCALER_REPO = "pcuenq/k-upscaler"
def resnet_to_diffusers_checkpoint(resnet, checkpoint, *, diffusers_resnet_prefix, resnet_prefix):
rv = {
# norm1
f"{diffusers_resnet_prefi... |
383f8144040f18294020cb71f820976c0c2fab96f37eaaffda4006cc4b620cb2 | Python | 12,342 | 347 | """
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.
"""
# ruff: noqa
from __future__ import annotations
import dataclasses
import logging
import os
import shutil
import subprocess
import time
fr... |
79b8bd4c120eeb30d2292da09aae2125e05df252061517a3d3ea5cc7f42debaa | Python | 12,345 | 255 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Applies REF_PANEL_GENOTYPES filter to a single sample VCF file given the cleaned final VCF for the reference panel
# cohort
#
# The general objective is to remove calls in the single sample VCF which do not match a call or calls in the reference
# panel VCF AND have vari... |
19e832b14bb585da4befd1b614e202431ae438ae2f3af88a6de002dca8799290 | Python | 12,346 | 455 | import time
from attr import dataclass
import ray
from data_assimilation.pytorch.PDE_models import PipeflowEquations
import numpy as np
import matplotlib.pyplot as plt
import pdb
from matplotlib.animation import FuncAnimation
from data_assimilation.pytorch.particle_filter import ParticleFilter
from data_assimilation.py... |
88c26a85ea992e103c69c415ed3ece7080508101c47d4401633e71bdf525b9d9 | Python | 12,368 | 339 | # 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, ... |
fcf049ea216e864ac3618d70ddb1c3976180dca9c3c54f4bb06324eb3e6f67d7 | Python | 12,369 | 297 | #/usr/bin/env python
import argparse
import json
import os
import time
import numpy as np
import pandas as pd
from clusterdiffex.util import load_txt, load_loom
from clusterdiffex.distance import select_markers, get_distance, \
select_markers_static_bins_unscaled
from clusterdiffex.cluster import run_phenograph,... |
02a3801d963ffd19f9a3be0c6f7ce4526e2c366aaa1a7defe59978e000f7483c | Python | 12,370 | 306 | """
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 gzip
import hashlib
import json
import math
import os
import traceback
from pathlib import Path
... |
1a760494ee795891ceb111b311875d639e710e769395a9d5191bcde6d79e9216 | Python | 12,370 | 374 | # !/usr/bin/python
# ----------------------------------------------
# Quantify the amount of ambient RNA in each batch
# In particular check for PLP1 cross contam
# Load in celltype annotations to look for incorrect cross-expr
# Use SoupX method (EM)
# ----------------------------------------------
import glob
import h... |
0052441b2e69a8df9011f24703973017f3b61cff8e17c742b241b320a5df9c07 | Python | 12,373 | 352 | SAVE_DIR = 'C:/Users/mmall/Documents/uni/columbia/multiclassification/saves/'
import os, sys, re
import pickle
JEFF_CODE_DIR = '/Users/wjj/Dropbox/research/analysis/repler/src/'
MATTEO_CODE_DIR = 'C:/Users/mmall/Documents/github/repler/src/'
if os.path.isdir(JEFF_CODE_DIR):
CODE_DIR = JEFF_CODE_DIR
elif os.path.... |
d75e5bbdcf774ca867b7a055354b3de37ac7e39facd0664927b4841b0f8371e3 | Python | 12,374 | 656 | import numpy as np
colors = {
"our": "#CC0000",
"porstata": "#21618C",
"thermonet": "#CCCC00",
"prosgnn": "#00CCCC",
"ddgun": "#CC6600",
"premps": "#00CC00",
"rosetta": "#CCCC00",
"dynamut": "#2cb276",
"sdm": "#d5558e",
"foldx": "#0866b3",
# "strum": "#E46C0A",
"duet": ... |
3f0dd5deaf9fde4ecbe4a6bb7cd42324d9dcebb0ca822b4d1742fc5ac0714c77 | Python | 12,375 | 378 | import soft_rank_isotonic
import numpy as np
from scipy import special
def isotonic_l2(input_s, input_w=None):
"""Solves an isotonic regression problem using PAV.
Formally, it solves argmin_{v_1 >= ... >= v_n} 0.5 ||v - (s-w)||^2.
Args:
input_s: input to isotonic regression, a 1d-array.
inpu... |
775b4b1a247a61ccc30ec86527d0ebe4e7cad20af2416f587525ae1183529bb4 | Python | 12,384 | 412 | import cv2 # noqa: F401 — preload libtiff before HIPT/torchvision shadows it (omicverse vendored patch)
import argparse
import multiprocessing
import torch
from torch.utils.data import Dataset
import pytorch_lightning as pl
from torch.optim import Adam
from torch import nn
import numpy as np
from impute_by_basic imp... |
9619cf8e7baccf20f48e740c781db01f534a3d7bce25eb321038dbf046e28913 | Python | 12,386 | 297 | """Merge per-chunk Experanto exports without loading Mozaik datastores."""
from dataclasses import dataclass
import json
import math
from pathlib import Path
import shutil
import tempfile
import numpy as np
import yaml
CHUNK_EXPORT_META = "chunk_export.json"
def _read_yaml(path):
with path.open() as stream:
... |
0320b5849002a4b9dbdcd5e8a6ec1e9f04b7661b55061c244d49bb602d5f0cc2 | Python | 12,391 | 491 | import sys
import textwrap
from typing import List
import pytest
from ci.ray_ci.doc import cmd_check_api_param_coverage as cmd
from ci.ray_ci.doc.api_param_coverage import (
ClassIndex,
Violation,
build_class_index,
documented_params,
new_violations_for_file,
public_callables,
signature_pa... |
75d53131e4e7160fe7234ce311f7b1b386b0e5ba9dc9b7c395353d7ed1934573 | Python | 12,393 | 351 | """
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.
Unit tests for UMA Nitro kernel orchestration: capacity recovery, CUDA graph
caching, architecture kernel policy, and portable fallback operato... |
cc2343099c448b6672ca992db6b11dc63f6c1e7c856860617f5494c61e98bc75 | Python | 12,399 | 373 | import logging
import os
import random
import sys
import pickle
from pathlib import Path
from typing import Any, Dict, Iterable, List, Optional, Tuple
import click
import dask.dataframe as dd
import h5py
import math
import numpy as np
import pandas as pd
import yaml
from deeprvat.data import DenseGTDataset
from scipy.... |
7fa6701aaa7fc94be8a8cd643ee3af4527a44ee746a37f87a3d2de1ab44b0d49 | Python | 12,401 | 440 | from skimage.measure import label
from tqdm import tqdm
import numpy as np
import csv
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
def labels_to_regions():
# Create Dict with label numbers and structures
labels = {
1:"spleen",
2:"kidney_right",
3:"kidney_left", ... |
32275607148976ba4cf8814e34dcdb6b5fe598b6f86b0fdb6debc0e79b12ffbb | Python | 12,405 | 339 | """GEO data collector."""
import logging
import json
from typing import Any, Dict, List, Optional, Union
from src.api.geo import GEOClient
from src.models.genomic import Gene, Expression
from .base import BaseCollector
from config.config import settings
logger = logging.getLogger(__name__)
class GEOCollector(Base... |
aaf6947a6fe0fe844787c19d6209fc558f9cf987884133e8723ad29b8d89c6a2 | Python | 12,410 | 403 | import argparse
from time import time
import numpy as np
from sklearn.cluster import MiniBatchKMeans, KMeans, AgglomerativeClustering
from sklearn.mixture import GaussianMixture
# from sklearn.neighbors import kneighbors_graph
# from hdbscan import HDBSCAN
# from einops import reduce
import matplotlib.pyplot as plt
fr... |
2cda33314293f9411064e66aa74308a0e15a2e9b5aee63e0326b8f164e5fb2e1 | Python | 12,415 | 319 | ####################################################################################################
# Copyright (c) 2025, Open Brain Institute
# Author(s): Marwan Abdellah <marwan.abdellah@openbraininstitute.org>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is ... |
e769f052e95068b5ab08f7b1ecb520afe905870b0c626655c0450fb109ebda47 | Python | 12,415 | 282 | import logging
from typing import Optional
import ray._common.utils
import ray._private.ray_constants as ray_constants
import ray._private.utils as utils
logger = logging.getLogger(__name__)
# See https://docs.kernel.org/admin-guide/cgroup-v2.html#weights
# for information about cpu weights
_CGROUP_CPU_MAX_WEIGHT: i... |
51850ae9abc0c9d942b279e84d3417b3ebe1c8017412b85388f01aa233f7dfe7 | Python | 12,422 | 303 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 19 11:52:05 2022
@author: sam
"""
import keras
from keras import backend as K
from keras_dynamicLayers_RNNcell_dualModel import rnnCell_dualNet_ as rnnCell_
import tensorflow as tf
class zeroConstraint(keras.constraints.Constraint):
"""Constrai... |
0eab34b5113c5ca8dd392607ba03fcb192e1fbc295cdfffb70944bbb1e704ec5 | Python | 12,426 | 341 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Class representing a time series.
author: Andrea Giovannucci
"""
#%%
import cv2
import h5py
import logging
import numpy as np
import os
import pylab as plt
import pickle as cpk
from scipy.io import savemat
import tifffile
import warnings
from datetime import datetime... |
8a7a02fcdacbbb6f5c3c4cea94560f2fcdf103cc0d280b657af6db5659742ff0 | Python | 12,433 | 347 | """Testing when to average functional data"""
import os
import glob
import nibabel as nb
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti'
# Define data dir
DATADIR = '/Users/sebastiandresbach/data/neur... |
bca534f1e724660cca5e163739f1b4b8dda3c42271399e3d52f70c6e3e0fac65 | Python | 12,433 | 343 | """
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.
"""
"""
AdsorbML evaluation script. This script expects the results-file to be
organized in a very specific structure in order to evaluate succ... |
872a85894b240343d57ed9e884a0e51fb51b9dc82ab66879817f5376144e89a6 | Python | 12,435 | 348 | import warnings
from enum import Enum
from typing import TYPE_CHECKING, Dict, List, Union
import numpy as np
from ray.air.constants import TENSOR_COLUMN_NAME
from ray.air.data_batch_type import DataBatchType
from ray.data.util.expression_utils import _get_setting_with_copy_warning
from ray.util.annotations import Dep... |
81ffc3ec60b5b508194e0f672cfe1c2b194c447c1ee16b24b0ec2d3b4dc400f2 | Python | 12,436 | 320 | """
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
import torch
from monty.dev import requires
from fairchem.core.grap... |
28db8ac8e5528c90d69c3d7f1d31e780e45c16b536a0c68b0a2896fa1a037443 | Python | 12,437 | 263 | from argparse import ArgumentParser
import os
import os.path
import skimage
import skimage.segmentation
import sklearn.preprocessing
import sklearn.model_selection
import math
import pathlib
import glob
import shutil
import uuid
import random
import platform
import itertools
import torch
import torchvision
import nump... |
bdf26e29b2ac616520011f176d4c8ed148ec1c878e84f6d1b6d1a255841770ac | Python | 12,438 | 317 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=too-many-instance-attributes
"""Phenomenological noise models for ReRAM devices for inference."""
from copy import deepcopy
from typing impor... |
e7db8a77fc5bbd25ef0956f3beca68a9dab2ebcf66d315d34034cebf6d9a4858 | Python | 12,440 | 232 | """ Fonctions utiles pour le traitement de signal """
import mne
import numpy as np
import pandas as pd
from scipy.signal import butter, filtfilt
from libs.utils import find_first_key_by_value, print_warning, print_error
# ==================================================
# region Gestion des fichiers EDF
# =======... |
aed9ee67afcce35920b98711f5615d75d385eebe15bf40fc00447d93a2eb6ce1 | Python | 12,443 | 281 | #!/usr/bin/env python3
from __future__ import print_function
import argparse
import glob
import sys
import matplotlib.pyplot as plt
import pysam
import collections
import numpy as np
import os
CHR_IDX = 0
START_IDX = 1
END_IDX = 2
SCORE_IDX = 4
STRAND_IDX = 5
COVERAGE_IDX = 9
METHYL_PERCENTAGE_IDX = 10
FWD = "+"
REV ... |
df7ba18555f24aaabbf53796e1f323dc4fa3a4bf7b8fdcea86e135f43e8a8c86 | Python | 12,449 | 299 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# 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... |
c885fccdbc6fad79d5b78bab75a89ed655cac32d42a4d474bb652a48c0e8d1c8 | Python | 12,450 | 263 | '''
We want to compute 4 different kinds of cross correlations
(1) Data cross-correlations
* Compute center cell vs. its neighbors, apply the stimulus-presentation correction by shuffling
with two trials away
(2) Shuffled data cross-correlations
* Center cell and its neighbors like before, but shufflin... |
57f256595dbb58f623488f770ab847b7189e443593ef0791800e0a5098272386 | Python | 12,456 | 376 | # Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
52c773729315dc0a075c3b4d4fefc51676f8fd420249e555521f13e431a3ad51 | Python | 12,467 | 330 | """
DataSourceV2 API - Unified Abstraction for Reading Data Sources
This module defines a unified, extensible API for reading data from diverse sources
in Ray Data. The API provides a common abstraction layer that enables datasources to
declaratively expose their capabilities—such as filter pushdown, projection prunin... |
e0cc35ca957319ae013c3e0036fb110c4b706febe52a4a1950431c123a370d77 | Python | 12,467 | 236 | """SAMPLING ONLY."""
import torch
import numpy as np
from tqdm import tqdm
from functools import partial
from stable_diffusion.ldm.modules.diffusionmodules.util import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like
class PLMSSampler(object):
def __init__(self, model, schedule="linear", **kwargs)... |
bd04434715a8725590497bd72e38a1b04959984fc3672387e281626737373630 | Python | 12,478 | 363 | """
Read and plot motion traces
"""
import ants
import os
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def my_ants_affine_to_distance(affine, unit):
dx, dy, dz = affine[9:]
rot_x = np.arcsin(affine[6])
cos_rot_x = np.cos(rot_x)
rot_y = n... |
1d06083a5fcfe505608ca437c4449d6c7ecd4a8c13f94ec32bae71457add0d1e | Python | 12,480 | 281 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
# Adrien Fleury <adrien.fleury@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.co... |
5b30418fdc2defec8894256143c8a6832356d09c87d65c9e79b1f4a9d3271c12 | Python | 12,482 | 359 | # Modified from https://github.com/InternLM/opencompass/
# Modified from https://github.com/InternLM/InternLM/
import json
import os
import signal
import time
import traceback
from contextlib import contextmanager
from threading import Thread
from typing import Dict, List, Optional, Union
import requests
from func_tim... |
99325e2c34e72b0e012bb7dca734851154d507415a934153b73ab083deb84d9e | Python | 12,483 | 299 | # Copyright 2023 UC Berkeley Team and 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 ... |
9e0e3e393fa4afdf2cb1f7ffd840e5b52e3fc76e9bf604cc4359d31cf1d2033d | Python | 12,488 | 353 | """
Tests for the Experanto spike export (mozaik.tools.experanto_export.MozaikTrialExporter).
Uses synthetic, duck-typed DataStoreView / segment objects with KNOWN spike trains, so the
export can be driven and checked end-to-end without running a model. Verifies:
a) the output format contract (meta.yml keys, CSR N+... |
ede99c9821713112ed77a2f6cfeb8203c8c85498aa345bcf75976a8b1c3a4f10 | Python | 12,492 | 342 | ####################################################################################################
# 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... |
a8a54e3528dad70ea1c4e6205015db2c9846767adbeb8b2e0aa0c65e27c59309 | Python | 12,505 | 330 | import numpy as np
import sys
import re
from aptnn.atom import Atom, Frame
from aptnn.box import Box
# Simplistic reader of xyz data
class Trajectory:
def __init__(self, filename):
self.fin = open(filename, "r")
self.frameno = 0
self.atoms = []
self.comment = ""
self.fil... |
bc1781317b879ba4e5c9a59607213ee412e6e4408d03ba95cbe1e25563657325 | Python | 12,507 | 332 | import exputils as eu
import ipywidgets
class MultiSelectionWidget(ipywidgets.VBox):
@staticmethod
def default_config():
dc = eu.AttrDict()
dc.title = 'SELECTED_CHOICES' # SELECTED_CHOICES, TITLE_LABELS
# labels for each possible choice that are then shown in the title if the 'TITL... |
9c5a91008adf148255afdb2546809a08568eaca2e177c0a330c0a749d1187e2c | Python | 12,508 | 399 | import json
import logging
import os
import random
import shutil
import subprocess
import sys
import tempfile
import threading
import time
from typing import Any, Dict, Optional
import yaml
import ray
from ray._common.network_utils import build_address
from ray._private.dict import deep_update
from ray.autoscaler._pr... |
ea2df2de6ee59146da65b3bbfeab29c986d4f799d50d0312688c2fb1fb102ab8 | Python | 12,518 | 239 | from datetime import datetime
import pickle
import numpy as np
from tqdm import tqdm
import os
import utils
import pandas as pd
from univariate_statistics import statistics_from_df
def pre_user_cohort_triplet(prescription_taken_by_patient, user_cohort_rx, user_cohort_dx,
save_cohort_outco... |
a7369dd909deb4744e64303c00af9b4c15b910db0a323c50f782663cc9c9b5cd | Python | 12,524 | 265 | """
Cache final decoding models for all recording sites.
Original analysis ran parallelized on David lab compute cluster.
Reproduced here running all analyses in series. Could take a little while.
"""
import os
rdir = os.path.dirname(os.path.dirname(__file__))
import sys
sys.path.append(rdir)
from settings import RE... |
2b5cfcba446518fac16ff6782bfea9810b54358ae581d0dd1f6593922e45f467 | Python | 12,527 | 355 | """
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 os
from abc import ABCMeta, abstractmethod
from glob import glob
from typing impo... |
ac9abe959ba8cfbe2867979110d6b60b421b92de53f17cd47759c74aaadf3d3e | Python | 12,530 | 369 | import asyncio
import logging
import random
from collections import deque
from typing import List, Optional, Tuple
import grpc
from grpc import aio as aiogrpc
import ray._private.gcs_utils as gcs_utils
from ray._common.utils import get_or_create_event_loop
from ray.core.generated import (
gcs_pb2,
gcs_service... |
2d5621763b19e62de96f9a3f42f82da2afb083e380685bbbe21bb48e559ea2cc | Python | 12,531 | 299 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=too-many-instance-attributes
"""Phenomenological noise models for PCM devices for inference."""
from copy import deepcopy
from typing import ... |
e8e8b5a67461ed021c1a02d389c0e84bc0bfd26b94427f8764aba54b7bbe8275 | Python | 12,532 | 317 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# mypy: disable-error-code=attr-defined
"""Implements analog tile module array ."""
from typing import Any, Optional, Tuple, List, TYPE_CHECKING
from torch im... |
4a15504dd83650a2e91f558a0a0b96744d077bfbbf408ae72d9cdd740e3be213 | Python | 12,533 | 365 | # -*- coding: utf-8 -*-
'''
Document Module
'''
from __future__ import division
import numpy as np
from scipy.special import erf
from ..utils import utils
from ..core.modeling_framework import ModelProperties
from ..core.signal_model_properties import (
IsotropicSignalModelProperties, AnisotropicSignalModelProper... |
246c4c3a270a8f600d2c8d570b510e5bdc16c7eabdcb83290c3874befaffaee6 | Python | 12,539 | 329 | import collections
import copy
from logging import getLogger
import numpy as np
import torch
from torch.nn import functional as F
import pfrl
from pfrl.agent import AttributeSavingMixin, BatchAgent
from pfrl.replay_buffer import ReplayUpdater, batch_experiences
from pfrl.utils import clip_l2_grad_norm_
from pfrl.util... |
376648badd4b56973659bdd23e849af67f9b3072910eafda1e954e7a6f765962 | Python | 12,543 | 324 | # -*- coding: utf-8 -*-
"""
Compute the composition, transition and distribution descriptors based on the
different properties of AADs.
The AADs with the same properties is marked as the same number. You can get 147
descriptors for a given protein sequence.
References
----------
.. [1] Inna Dubchak, Ilya Muchin... |
3892f685516d2e0d5efb52d1da4a77bc79bb3b4c6ac2472d6d941ada787ccf81 | Python | 12,543 | 293 | # 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... |
99d6649e6915eef3a3d48dc12432fd64fe7398129b70cf561b12e1bf59825fe6 | Python | 12,548 | 326 | from __future__ import division
import numpy as np
from .basic_nodes import *
from ..distributions import *
"""
This module is used to define nodes that are inferred using the variational bayes framework.
All variational nodes share the property of having a lower bound associated with it.
We divide variational nodes... |
f9311d43f7aa3fcfb055c07d95f56fff2f258ad8d34e78f841b0e191408671f1 | Python | 12,549 | 302 | ####################################################################################################
# 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... |
4338f06bcbcbc0c72f6ca36ff752681e505d9c5ad28a2281e05df8b99dc62824 | Python | 12,554 | 365 | # built-in dependencies
import os
import json
import hashlib
import struct
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional, Union
# 3rd party dependencies
import numpy as np
# project dependencies
from deepface.modules.database.types import Database
from deepface.modules.exception... |
45f0ed5dc1899d5353ff95fb0a8eb2693cb79c07c1cc3a47212eb9f74b33cbab | Python | 12,555 | 396 | import numpy as np
import pytest
import tensorflow as tf
from ml4h.models.transformer_blocks_embedding import (
build_embedding_transformer,
build_general_embedding_transformer,
evaluate_multitask_on_dataset,
)
try:
tf.config.set_visible_devices([], "GPU")
except (RuntimeError, ValueError):
# It'... |
3e0b858273f1a7773b3bf917158aa522967e3e8073e8bd25ce464435ee94f010 | Python | 12,557 | 299 |
import numpy as np
import matplotlib.pyplot as plt
import general.utility as u
import general.plotting as gpl
import ring_attractor.ring as ring
default_wf_params = (-10, 7, 0)
class FourRingModel:
def __init__(self, n_units, tau=10, transfer_func=ring.relu_transfer,
weight_func=ring.cosine_we... |
e06f6364582d2b4d632940670a2a4df926bab4de4f5edf85eba206db43ecaf06 | Python | 12,567 | 240 | import os
import argparse
import torch
import copy
import pandas as pd
from deltasplice.constant import default_model_paths, model, Fapath, EL, CL,SeqTable, repdict, IN_MAP, default_anno_file
from pyfasta import Fasta
import numpy as np
import json
from bisect import bisect_left
def main():
# load conf... |
6fc37e02965d1600c95956331e425da6c25da76a252d34130b31ef619c606073 | Python | 12,568 | 390 | from os.path import join
import argparse
import os
import numpy as np
import pandas as pd
from PIL import Image
from tqdm import tqdm
from sklearn.decomposition import PCA
import torch
from torch.utils.data.dataset import Dataset
from torchvision import transforms, models
LAYERS_RES18 = [
lambda m: m.layer... |
120d9eb135af6b8a4cc2128d8aabd4e0719d7907f4452193142285301a05095e | Python | 12,571 | 326 | #
# 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... |
e8bfb176489139a720d1c688e9e18f42b7d0c0ea610a8d92be37b727d86c4804 | Python | 12,580 | 298 | # 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... |
c9c0923d4080285dbdb7555688c5e4b2c367a53c9be3c3db59d9b6c2fc998d4f | Python | 12,583 | 423 | """Workspace tool handlers: tasks, plan mode, worktree, skill, MCP.
Extracted from ``tool_runtime.py`` during Phase 3 decomposition.
These handler functions receive the ``AgentContext`` (and optionally a
plan-mode checker or read callback) as explicit parameters.
"""
from __future__ import annotations
import json
im... |
c17f10966ade127d324e123865f28ff6ec6fb8d72281636e0f3784d57434acc1 | Python | 12,585 | 431 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=missing-function-docstring, too-few-public-methods, no-member
"""Layer helpers for aihwkit tests."""
from unittest import SkipTest
from torc... |
712b94552c29751db184839265965b59bab2abb8d8ac483b1fda902185af5fc4 | Python | 12,589 | 393 | import math
import torch
import torch.nn as nn
from einops import rearrange, repeat
from ntd.modules import (
EfficientMaskedConv1d,
SLConv,
get_in_mask,
get_mid_mask,
get_out_mask,
)
class CatConvBlock(nn.Module):
def __init__(
self,
hidden_channel_full,
slconv_kern... |
0e9f4ca4abffc9e61bd93e94f1c8dba28aba9059814f8c31cae87f024aaf24bd | Python | 12,598 | 280 | r"""Design evaluation — quantitative "did it get better?" metrics.
A generative design is only useful if you can *score* it. This module packages
the ov.synbio predictors into an in-silico **scorecard** that compares a designed
sequence/structure against a reference (wild-type / baseline), plus the
structural **self-c... |
ccbff05cc496d744f1e1fd97e4c9ba11bfeaac7bc5bb9f975435e943506bd854 | Python | 12,598 | 395 | #!/usr/bin/env python3
# Written by Kit Joll, 31/10/2024
import socket
import argparse
import numpy as np
from mpi4py import MPI
import sys
import warnings
from time import time
import configparser
from ase.io import read
from aptnn.atom import Atom, Frame
from aptnn.box import Box
from aptnn.committee import Committ... |
21046a5861bd52d57262e61b8dc903f5f6311d7431278f4ac17454b72c7ffa0d | Python | 12,607 | 351 | """Lightweight per-step provenance recorded into ``adata.uns``.
The pipeline-report system is structured as a small, explicit contract
between the dispatcher and the report:
@tracked('umap', 'ov.pp.umap')
def umap(adata, **kwargs):
if settings.mode == 'cpu':
...
note(backend='o... |
1c4a96cc2a936f82c67b3cbee79732eb9d095dcccea8f49053d13b3cd4297791 | Python | 12,621 | 344 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# =========================================... |
e064458e1184c78a2cf9bc2cdd6ee348aca1bc155d16847c019f64f0eaa29b5e | Python | 12,621 | 310 | #!/usr/bin/env python3
__doc__ = \
"""The Developmental Cognition and Neuroimaging (DCAN) Labs fMRI Pipeline [1].
This BIDS application initiates a functional MRI processing pipeline built
upon the Human Connectome Project's minimal processing pipelines [2]. The
application requires only a dataset conformed to the BID... |
300f166147f98eb1062b22bc0846ee155adb16de95dddaa0491d2c6f1b58a915 | Python | 12,623 | 350 | import copy
import logging
import time
from functools import wraps
from threading import RLock
from types import ModuleType
from typing import Any, Dict, List, Optional, Tuple
import googleapiclient
from ray.autoscaler._private.gcp.config import (
bootstrap_gcp,
construct_clients_from_provider_config,
get... |
6734b9e9e51a663a288383a5cfc92f562bb2edafaac6898d86b949814fa1edc0 | Python | 12,631 | 288 | import argparse
import datetime
import pickle
import sys
import time
import numpy as np
import os
from torch.utils.data import DataLoader, Dataset
from torchnet import meter
import torch
from sklearn.model_selection import train_test_split
# from model import AIMP
from model_extract_representation impor... |
c894e907b3df84cad07bd70afb4a16826195a6842c61cb325452ea8eace088cc | Python | 12,632 | 406 | # 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... |
81bfa3bb7750abb2a799dc0b2da499576272020d0193b5cc9296f84588ac6e7c | Python | 12,638 | 346 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# pylint: disable=line-too-long
# pylint: disable=multiple-statements
# pylint: disable=too-many-lines
# pylint: disable=wrong-import-position
#-------------------------------------------------------------------------------
'''
This program... |
7b585e513020e82249812990553c9cb98c866b72722766b7a81cc76320f15730 | Python | 12,641 | 370 | """Animations of traces."""
from typing import List, Optional, Tuple, Union
import numpy as np
from matplotlib import colormaps as cm
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from flyvis import utils
from ..visualization import plots, plt_utils
from .animations import Animation
class ... |
c222de91aae156870cb3654c6a22226f0a71457dae4ef44e23f9edf837721834 | Python | 12,642 | 343 | #!/usr/bin/env python
# Author(s): Nicolas Servant
# Contact: nicolas.servant@curie.fr
# This software is distributed without any guarantee under the terms of the GNU General
# Public License, either Version 2, June 1991 or Version 3, June 2007.
"""
Script to extract informative SNPs from a multisamples VCF
If no --r... |
cb164b712e1cef2a8211fcb3be897a6d8b5555b4e71f7e98e6a5baa6099730f1 | Python | 12,642 | 356 | r"""Univariate statistics for metabolomics differential analysis.
Provides the same interface for t-test, Wilcoxon, and moderated
(limma-style) tests, operating on an AnnData with a two-group factor
in ``adata.obs['group']`` (or a configurable column). Returns a
``pd.DataFrame`` indexed by metabolite with columns:
... |
922805973375b3b56335b959b4020053826a7a1d6172c18fdde55b87b128351f | Python | 12,643 | 384 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
For the selected k, calculate the correlation between total FC strength and variability
across states, plot the FC strength and variability within each state as 2D matrices with limits,
and plot the FC strength and variability within each state as histograms.
Output:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.