sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a75370f89941210f3620ece38fcb759c24dbc00635df394636f4ac5b66222656 | Python | 11,123 | 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 os
import subprocess
import time
from datetime import timedelta
from typing impor... |
772ea1576f340cf9fa0ce2aee4c0e976d51bf440bd0a008b2f2922b7622d4781 | Python | 11,129 | 281 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from unicore import utils
from unicore.models import BaseUnicoreModel, register_mo... |
0f4d8b6752b49ee6e03ba58f61daba342b38d20edb5441680666d156666a1a2c | Python | 11,130 | 254 | """
A lot of this code is repurposed from https://github.com/chemprop. This code is used in order to make the proximity
graph dataset compatible with using the D-MPNN with edge messages.
"""
import numpy as np
import torch
from tqdm import tqdm
import multiprocessing
from torch_geometric.data import DataLoader
import w... |
28c74fa10f1bfee689e16525e7ced1de9263171c90be4df09657a1fd16090598 | Python | 11,137 | 288 | # Copyright 2026 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
20b390fcf3023d3f888f801466949ccc54db5c1f11603bb45504698b0427838b | Python | 11,144 | 314 | # -*- 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 Information utility.
This module prints relevant information about the model and its analog
execution.
"""
from functools import reduce
import opera... |
ba6c9ea051f99af51a92438bff4f343cd2f1e5f73859890c053d15f729248d6c | Python | 11,149 | 262 | import numpy as np
from typing import List, Dict, Any, Optional, Tuple, Union
from lib.data_utils.interaction_hashable import CellInteraction
class VertexInfo:
def __init__(self, cell_id: int, cell_type: str):
self.cell_id = cell_id
self.cell_type = cell_type
class InteractionGraphEdge:
... |
71eaf55aa3241deea5ca79cdcd9e596928b99443d3b7d69751a8616718b84419 | Python | 11,151 | 219 | import os
import glob
import numpy
import pandas
from typing import Sequence, Set, Tuple
from sv_utils import common, genomics_io
import pysam
import common_test_utils
class Keys:
id = genomics_io.Keys.id
contig = genomics_io.Keys.contig
begin = genomics_io.Keys.begin
end = genomics_io.Keys.end
cla... |
8441e17c4e48cd755353d8a5cb59167a516bddd124e16f1768eabc72048078f7 | Python | 11,154 | 264 | ###############################################################################
'''This code has functions which process the information in the .h5 files
datafile_{}_{}.h5 and convert them into a format usable by Keras.'''
###############################################################################
import torch
fro... |
c3e707b4aef2b0734555dfd776f674c907e5e949416700a42c59fcc5312069ab | Python | 11,155 | 296 | import collections
import numpy as np
import torch
from torch.utils.data import DataLoader, ConcatDataset, Dataset
from pytorch3dunet.unet3d.utils import get_logger, get_class
logger = get_logger('Dataset')
class ConfigDataset(Dataset):
def __getitem__(self, index):
raise NotImplementedError
def _... |
f8993f69e94f6958efcb709b5843b26742bae29c60a8bd56d1988444d2f7a663 | Python | 11,158 | 274 | import pandas as pd
import numpy as np
import scanpy as sc
import scipy.sparse as sp
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.optim as optim
from sklearn.cluster import KMeans
from tqdm import tqdm
import torch.nn.functional as F
from .layers import GraphAttentionLayer,Sp... |
3eacd433dd5f368d49001f7f18f1920804e41d2ac6cdbc6c56abf522ae7a99c0 | Python | 11,161 | 202 | import torch_pgn.graphs.graph_utils as gu
from torch_pgn.graphs.proximal_residues import *
from torch_pgn.featurization.simple_featurization import *
from torch_pgn.featurization.featurize import get_all_features
import networkx as nx
import matplotlib.pyplot as plt
import os.path as osp
#TODO: Add argument object f... |
e7e6cfea495c42b6ea376586e8bf5c867984e5a82e6c8526513583f02d1be000 | Python | 11,161 | 312 | import math
from typing import Optional, Tuple, Union, Sequence
import numpy as np
import torch
from axial_positional_embedding import AxialPositionalEmbedding
from performer_pytorch.performer_pytorch import Performer as BasePerformer
from performer_pytorch.performer_pytorch import (
cast_tuple,
exists,
Ab... |
75710f8915232a23ea6543b4753f35c474c20f6ec9044cdfa5228d7274170f66 | Python | 11,167 | 354 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import json
import os
import zipfile
from pathlib import Path
import pytest
from cvat_sdk.api_client import exceptions
from cvat_sdk.core.proxies.tasks import ResourceType, Task
from PIL import Image
from sdk.util import generate_coco_json
from sha... |
114d67f0b918a9dfaf8058da49e1ec4d1a890d9e512265b7ec6fae32ac6e5931 | Python | 11,170 | 310 | import pdb
import pickle
import time
from matplotlib.animation import FuncAnimation
import numpy as np
from tqdm import tqdm
import torch
import matplotlib.pyplot as plt
import yaml
from scipy.signal import savgol_filter
from latent_time_stepping.datasets.AE_dataset import AEDataset
from latent_time_stepping.oracle imp... |
ee32bcfae2101488ab826cdf76c658daeb35f16ba6410459e936aaccd6591c3d | Python | 11,173 | 371 | from typing import Dict, List, Tuple, Optional
import copy as cp
import logging
import numpy as np
import pandas as pd
import xarray as xr
from scipy.interpolate import RegularGridInterpolator
from shapely.geometry.polygon import Polygon
from shapely.geometry import LineString, Point
from argschema.argschema_parser i... |
84b8446ef890469207dd6841f1211b10dca72f3931255aa6bcd08b8d68b8dcf5 | Python | 11,174 | 327 | # -*- coding: utf-8 -*-
import sys
import importlib
try:
from vtkmodules.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor, PyQtImpl
# QVTKRenderWindowInteractor raises an error if this isn't loaded.
from vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer
except:
from vtk.qt.QVTKRen... |
f0296898834c52c73a545b64f60be28dfb74d9c52888580c220b995e21a72f97 | Python | 11,179 | 323 | import pdb
import numpy as np
import torch
from data_assimilation.particle_filter.base import BaseParticleFilter
import matplotlib.pyplot as plt
class NudgingFilter(BaseParticleFilter):
def __init__(
self,
**kwargs
) -> None:
super().__init__(**kwargs)
self._update... |
757bc06dbef8bad56788a1eb167def68e517ab5e0f9c8d176d7f60f48f9a3d9c | Python | 11,184 | 294 | import os
import cv2
import torch
import argparse
import numpy as np
from tqdm import tqdm
from torch.nn import functional as F
import warnings
import _thread
import skvideo.io
from queue import Queue, Empty
from model.pytorch_msssim import ssim_matlab
warnings.filterwarnings("ignore")
def transferAudio(sourceVideo, ... |
f272986ce0c6ca024ab22dd30688a5c45f4dfbd908c366b1fe1f7e9e0d65ddc8 | Python | 11,184 | 325 | # -*- coding: utf-8 -*-
"""
"""
import numpy as np
from vtkplotlib._get_vtk import vtk
from vtkplotlib.plots.BasePlot import Base2DPlot, BasePlot, as_rgb_a, PolyData
class Legend(Base2DPlot):
"""Creates a legend to label plots.
:param plots_source: Plots to use in the legend. Use `None` to include nothing.... |
1f4f62cb59c5bb4bc070ea9e37472647afed88ce8a8c678be826ffa3f495504f | Python | 11,185 | 270 | import os
import matplotlib.pyplot as plt
import yaml
import gdown
import zipfile
plt.ioff()
plt.switch_backend('agg')
########################################################################################################################
def create_feature_maps(init_channel_number, number_of_fmaps):
return [i... |
ed791a339e338e6991bd8dbe050d72b72ba6358b93bc36fd6497d6b0152d156d | Python | 11,188 | 311 | # __validation_fn_simple_start__
import os
import torch
import ray.train
import ray.data
# Define Ray Data validation dataset outside validation function because it is not json serializable
validation_dataset = ...
def validation_fn(checkpoint: ray.train.Checkpoint) -> dict:
# Load the checkpoint
model = ..... |
fa88463fb29fadd0c07f1061a7ed7c135d6f8c836489c51c5497f9c58db73436 | Python | 11,188 | 343 | """Graph construction for molecular data."""
import logging
import numpy as np
import rdkit.Chem as Chem
from rdkit.Chem import AllChem, rdMolDescriptors
from spektral.data import Dataset, Graph
from mol2ccs.constants import ATOM_MASSES, ATOM_RADII
from mol2ccs.utils import min_max_scaling, one_hot_encode
logger = ... |
b7c9dd63dda96a2dc3ab7c3e677617b88efea3e17910dfbfb6ece3107d5ec2ca | Python | 11,191 | 260 | r"""Compensation — undoing fluorescence spillover.
Every fluorochrome emits into detectors other than its own. A spillover matrix
``S`` records that: ``S[i, j]`` is the fraction of dye ``i``'s signal that lands
in detector ``j``, with ones on the diagonal. Observed values are ``true @ S``,
so recovering the true value... |
07536b33c09969dd00613c961e827f2ec26dfc07631e61eefa588c2ce3d1f27f | Python | 11,194 | 290 | import io
import json
import logging
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import pandas as pd
import pyarrow
import ray
from ray._private.dict import unflattened_lookup
from ray.air.constants import (
EXPR_ERROR_PICKLE_FILE... |
b319ab6809234609fdbb525b5364351842a5692514e4bb7cacccbe0400a72eca | Python | 11,196 | 316 | from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Any, Iterable, Optional
import geopandas as gpd
import numpy as np
import pandas as pd
from numpy.typing import NDArray
from shapely.geometry import LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon
... |
947067c331f1356f895844660b20e7c7e79e10746079b7de83ca2837b992ba80 | Python | 11,198 | 318 | # built-in dependencies
import os
import io
import ftplib
import hashlib
import posixpath
from abc import ABC, abstractmethod
from typing import Any, List, Optional, cast
from urllib.parse import urlparse, unquote
# 3rd party dependencies
import numpy as np
from numpy.typing import NDArray
import cv2
# project depend... |
1a81ea57f11c489e24fe249bef451454c34af910c142e287af933aa7c6a68718 | Python | 11,199 | 315 | 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... |
9a3e6a5d755d27af618cb3ae9ac92f8df3719da93a16d93452da41effab7ea0e | Python | 11,200 | 227 | import os
import sys
import torch
from tqdm import tqdm
import warnings
from sklearn.metrics import precision_recall_curve, roc_curve
from splam_dataset_Chromsome import *
from SPLAM import *
import torch.nn as nn
warnings.filterwarnings("ignore")
JUNC_THRESHOLD = 0.5
def parse_junction(name):
print("name: ",... |
9d77709ad7dd26430d84401567d28a82446c4deaeb4a8475a7d7c829468df5cd | Python | 11,200 | 237 | import sys
import torch
from math import sqrt
import torch.nn.functional as F
from lop.utils.AdamGnT import AdamGnT
class GnT(object):
"""
Generate-and-Test algorithm for feed forward neural networks, based on maturity-threshold based replacement
"""
def __init__(
self,
net,
... |
3493acd2193893c99041d69eb73b35963c44411a74b0cb5aecc1e50a0d666820 | Python | 11,209 | 288 | """
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 subprocess
import tempfile
from shutil import which
from typing import TYPE_CHECKING
... |
6ed4d564a92b31356d11f3c8090080fc1c6d2e0c1c40b5c436f741494283d153 | Python | 11,211 | 339 | import copy
import logging
import sys
from dataclasses import dataclass
from typing import List, Optional
import numpy as np
import torch
from pokeformer.datasets.base_dataset import BaseDataset
from pokeformer.receptor import Receptor
from pokeformer.utils.pickle_util import (conv_path, read_data, read_list_iter,
... |
4deebed8bfa0a1b036f9f8a5597fce4b7a0cbfe14562bbe8753e8791893008a1 | Python | 11,212 | 352 | # -*- 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 11: analog CNN.
SVHN dataset on Analog Network using weight scaling.
Learning rates of η = 0.1 for all the epochs with minibatch 128.
"""
# ... |
9ed6b61e644594e877bf914d8a8263f6d5ee0922bb0b429020840529d22b72d8 | Python | 11,216 | 368 | import argparse
import functools
import os
import gym
import gym.spaces
import numpy as np
import torch
from torch import nn
import pfrl
from pfrl import experiments, explorers, replay_buffers, utils
from pfrl.q_functions import DiscreteActionValueHead
class CastAction(gym.ActionWrapper):
"""Cast actions to a g... |
35e3654f533e7b134c088ff2997b72c06174699395018b292aa72c65d9aa9531 | Python | 11,218 | 282 | import os
import platform
import sys
import tempfile
from unittest import mock
import pytest
import requests
from ci.ray_ci.automation.crane_lib import (
CraneError,
_crane_binary,
_read_member_from_tar,
call_crane_copy,
call_crane_export,
call_crane_index,
call_crane_manifest,
read_fi... |
9aa9f08cdee42569d0d6d306f57023850f99847116634241026657f254435940 | Python | 11,221 | 280 | import torch
from torch.utils.data import Dataset, DataLoader, random_split
from pathlib import Path
import json
import random
import os
import math
from splam_utils import *
# MODEL_VERSION
project_root = '/ccb/cybertron/khchao/splam-analysis-results/'
def split_seq_name(seq):
return seq[1:]
class myDatasetEva... |
f6a7ab55c35b6a0953bb547fcfbd05ab336641c1a9b2c2425b2b29c7c052cf7c | Python | 11,221 | 356 | """
Functions for evaluating electrostatics between atom-centered multipoles
"""
import numpy as np
import h5py
from apnet import constants
def proc_molden(name):
""" Get coordinates (a.u.) and atom types from a molden.
Accounts for ghost atoms """
with open(name, 'r') as fp:
data = fp.read().sp... |
3aa499edff2e9e6ccb8c19d10a2c75c741471f6b0b2c4a0706c51d0ad8bc3c80 | Python | 11,222 | 344 | #
# 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... |
3cd98167c5a21da2ab9f6760e0983a45e14badba554af99acb36678bca8e1cbe | Python | 11,226 | 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.
Tests for the model inference interface methods.
"""
from __future__ import annotations
from unittest.mock import MagicMock, patch
import py... |
922b2103c7b81c0b460c136d9cd73d46404fc2e080aa4cdc65f2908bc56dd516 | Python | 11,226 | 265 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
from sklearn.model_selection import train_test_split
import tensorflow as tf
from image_preprocessing_keras_3mask import ImageDataGe... |
beca07a17a684adc9ade690b0c0e7732165b6c00672f0cfa4f61fa2bdb1f5bcf | Python | 11,229 | 280 | #Hang et al. 2020 https://arxiv.org/pdf/2005.11977.pdf
from torch.nn import Module
from torch.nn import functional as F
from torch import nn
import torch
def global_spectral_pool(x):
"""Helper function to keep the same dimensions after pooling to avoid resizing each time"""
global_pool = torch.mean(x,dim=(2,3)... |
27da0b9d992f7cf6cfc59b11c8db4c9c74f6200e646f7104a1fd1d1eaedd3cf7 | Python | 11,230 | 315 | '''
train CRP-NN, SEM, regular networks (all feed forward)
to learn multiple polynomials with a shared component
each task/poly = a shared component + a idio compoennt
'''
import os
import torch
import torch.nn as nn
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from copy import deepcopy
fr... |
319a24057844aa9ea0e8967e8a0ff429f61c0d36b0b89c8fea06c3500403b07d | Python | 11,230 | 266 | ####################################################################################################
# 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... |
481f7228bae814e14f43658b3d14f296f8d8f85bb05d28ed3ab814b45b111c28 | Python | 11,230 | 393 | 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
from scipy.optimize import fsolve, l... |
a17135152765b1be069d800d2d7659b8bf28067684992be6d3a969f3507ad754 | Python | 11,235 | 265 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import keras
from keras import backend as K
from sklearn.model_selection import train_test_split
import tensorflow as tf
from image_preprocessing_keras_3mask import ImageDataGe... |
bdd7695abc915ffa96faa3b0fa4246878dd9b1832b79244bc5343c7e34a9d093 | Python | 11,235 | 297 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024, 2025 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""aihwkit example 28: advanced (time-dependent) IR drop effects
Shows the effects of time-dependent IR drop on an analog layer us... |
b904708c245da8f06a5ca641fb54907f915a8d4342d788677b9bedf0b51c4134 | Python | 11,236 | 289 | import asyncio
import logging
import random
from abc import ABC, abstractmethod
from typing import Dict, Optional
from ray.dashboard.modules.aggregator.constants import (
CONSUMER_TAG_KEY,
)
from ray.dashboard.modules.aggregator.multi_consumer_event_buffer import (
MultiConsumerEventBuffer,
)
from ray.dashboar... |
7cc8962490d7146bb9001b3e968c9275b26dc5855de40a59feeb9c68351a5dc9 | Python | 11,237 | 314 | """Follow-up gate and convergence monitor for the agentic turn loop.
Extracted from ``turn_controller.py`` during Phase 2 decomposition.
FollowUpGate provides stateless helpers for the follow-up / retry heuristic.
ConvergenceMonitor detects read-only-tool plateaus and injects escalating
steering messages.
"""
from __... |
85aedc11b638062a8f00ff83a0e4acdfdd9aeca3f69c1b8b65128b989146d66c | Python | 11,238 | 404 | import numpy as np
import scipy.signal
import scipy.stats
from numpy.lib.stride_tricks import sliding_window_view
from numpy.core.multiarray import normalize_axis_index
def corrts(x, y, axis=-1, coef="pearson", p_value=True, correction="bh"):
"""
"""
shape = np.broadcast_shapes(x.shape, y.shape)
... |
0483a9aec2a6834a8adbf1795bfaca65f1e5c6ce8ad7bfaa29912d34d43ac7c5 | Python | 11,244 | 240 | '''
Usage: ngs_filter <readdir> [--threads=<threads>] [--drop-ns ] [--index-min=<index_min>] [--platforms <PLATFORMS>] [--outdir <DIR>] [--config <CONFIG>]
Options:
--outdir=<DIR>,-o=<DIR> outupt directory [Default: filtered]
--config=<CONFIG>,-c=<CONFIG> Derive options from provided YAML file instead of c... |
f9254513ab34caf4d6a0d2322d7a81ee0634002128c50167433205a802a781f6 | Python | 11,250 | 326 | from __future__ import annotations
import warnings
from functools import partial
from pathlib import Path
from typing import Literal
import anndata.utils
import h5py
import numpy as np
import pandas as pd
from anndata import AnnData
from ..._registry import register_function
try:
from anndata.io import read_h5ad... |
43e3e30f03518646f356ced853da6d35a0d6cd997991820ec48d6d0aa242c011 | Python | 11,251 | 346 | from __future__ import division
import numpy as np
from ..utils import *
from .. import gpu_utils
# Import manually defined functions
from .variational_nodes import BernoulliGaussian_Unobserved_Variational_Node
from .variational_nodes import UnivariateGaussian_Unobserved_Variational_Node
from .variational_nodes impor... |
a9c5805fb2ed4d646c7c34eccaed36668e7c9422ae6b43a81119b77c388d0263 | Python | 11,251 | 381 | import sys
from unittest import mock
import pytest
import responses
from click.testing import CliRunner
from ci.ray_ci.automation.get_contributors import _find_pr_numbers, run
BASE = "https://api.github.com"
REPO = "ray-project/ray"
_COMMIT_LOG = "\n".join(
[
"[core] Fix scheduler bug (#100)",
"... |
55888524dfc3a15ee1abf6153d29981387a88658b314010d9281ef6183aea15e | Python | 11,253 | 300 | from torch_pgn.data.data_utils import (parse_transforms,
normalize_targets, normalize_distance
)
from torch_pgn.data.ProximityGraphDataset import ProximityGraphDataset
from torch_pgn.data.FingerprintDataset import FingerprintDataset
import t... |
8fa6af236676b7b48fc7bbab70c39fcb254a244d0bd530a4746eba3f16c17d9d | Python | 11,255 | 265 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
from sklearn.model_selection import train_test_split
import tensorflow as tf
from image_preprocessing_keras_3mask import ImageDataGe... |
beae0aadc155c4aeb042e685dac58ae22678f9680c08357468686f0980370b1c | Python | 11,256 | 276 | """BGI Stereo-seq reader for OmicVerse spatial I/O.
Stereo-seq writes a GEM file: one row per (gene, x, y) with a count, at a spot
pitch of 500 nm. That resolution is below one cell, so nothing downstream is done
at native resolution — the first real decision in every Stereo-seq analysis is the
bin size, and it change... |
2ecafb02eef738022f615f1eb4be9b7afeed2afb1662de7726cbc31ade8d68dc | Python | 11,257 | 319 | """Methods to access and process network activity and currents based on cell types.
Example:
Get the activity of all cells of a certain cell type
(note, `LayerActivity` is not the network split into feedforward layers in the
machine learning sense but the activity of all cells by cell type):
```python
... |
c88f64e70e60210e73414f764efa5c4db4876daf2e1df8fb1bcef84527190163 | Python | 11,257 | 265 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
from sklearn.model_selection import train_test_split
import tensorflow as tf
from image_preprocessing_keras_3mask import ImageDataGe... |
7e5f9274ffb06cc91b24747d4ce0a9a6417f9580f556add58618e49b65536c47 | Python | 11,259 | 266 | # 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... |
28eb14d6b1a24384d0785f39c85733daf083ddb67fc7657d628c5c7e635a5cab | Python | 11,260 | 310 | #!usr/bin/python
"""Compute integrated neuronal representation using neuronal DEGs."""
# --------------------------------------------------------------
# Compute an integrated UMAP across all neuron subtypes:
# Updated: 03/01/22
# --------------------------------------------------------------
import re
import scanpy as... |
a6f0d8828c2ae39e84927d8e6b8831731b4c150715ed2b4707257ea2029b7093 | Python | 11,264 | 359 | # Code to train ResNet-Cox model in 5 folds cross-validation setting
# Load libraries
import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.models import DenseNet
import PIL
import matplotlib.pyplot as plt
import cv2
import numpy as np
import sys,... |
f868bc1c10b7bb204319214974f16591f7e4007f01d674cf30e98672e22c8deb | Python | 11,264 | 287 | """
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.
Tests: Extensivity of UMA-S forces and energies — E(N replicas) =
N * E(1 replica) and the equivalent force-tiling check, on
b... |
2d50e7e9342002e63bebd30db34d22c3262b524d8e7bee8c5eb65331ff6b55e2 | Python | 11,265 | 320 | from typing import Any, Dict, List, Optional, Tuple, Union
from weakref import ReferenceType
import ray
from ray.dag.constants import (
BIND_INDEX_KEY,
IS_CLASS_METHOD_OUTPUT_KEY,
PARENT_CLASS_NODE_KEY,
PREV_CLASS_METHOD_CALL_KEY,
)
from ray.dag.dag_node import DAGNode
from ray.dag.format_utils import ... |
384b35bf34bd7fdd88bebd95b1b472ac9eb262a1cd0ab8646ef6f0908655567a | Python | 11,265 | 278 | import torch
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.functional as F
from sklearn.m... |
3e455c6eb2a0b2e6118980edf8c6f99f62cdb9f5a96c3d34ec3d530bb1199bce | Python | 11,265 | 278 | import numpy as np
import argparse
import os
import tifffile as tiff
import time
import datetime
from skimage import io
import math
from torch.utils.data import Dataset
import torch
import random
class testset(Dataset):
def __init__(self,name_list,coordinate_list,noise_img):
self.name_list = name_list
... |
fea94f29f25d68a936363934592f7d06bc10c081bc18d58c38309391fa8b5a23 | Python | 11,267 | 273 | # Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
# and Applied Computer Vision Lab, Helmholtz Imaging Platform
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the L... |
69133ca2c4095d4ae05bd87a5c945cb2ef0c587cf4c488873e147289e6c523cc | Python | 11,269 | 325 | import numpy as np
import torch as th
import scanpy as sc
import scvelo as scv
import anndata as ad
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import cosine_similarity
from scipy.stats import spearmanr, pearsonr, sem
from ..utils import paired_cosine_similarity
from sklearn.metri... |
e91b9dc6ad3a63c098e376b1dc0f68f80e4a26eba2760463f0b6a4a14d7a9ba9 | Python | 11,269 | 251 | import sys, os
import argparse
import pickle
import datetime
import time
import yaml
import shutil
import numpy as np
import pandas as pd
import torch
os.environ.setdefault('PROJECT_DIR', ".")
sys.path.append(os.environ['PROJECT_DIR'])
RESULT_DIR = os.path.join(os.environ['PROJECT_DIR'], "training_results")... |
ebc1532452fe97b486afd975cd25e1846ed639040a7441b3890ae5d2110f9112 | Python | 11,274 | 201 | import numpy as np
import visionloader as vl
import argparse
import pickle
import os
import lib.data_utils.matched_cells_struct as mcs
import lib.data_utils.cell_curation as curate
import lib.data_utils.cosine_similarity as cossim
import lib.data_utils.sta_metadata
from lib.dataset_config_parser.dataset_config_parser... |
fa06a6637eeab6c1afbf86dd48fdea5f3d33c83a38a3fd41f06f7b19cc7cfc7d | Python | 11,275 | 203 | import os
import numpy as np
import nibabel as nib
import ivim
root = '/path/to/root'
input_root = os.path.join(root, 'data')
output_root = os.path.join(root, 'results')
steps = [1, 2, 3, 4]
subs = os.listdir(input_root)
for sub in subs:
input_folder = os.path.join(input_root,sub)
output_folder = os.path.jo... |
486cfefa45f3d81cee094e88a1022127eab96d9034ed07c6cfc436083e939942 | Python | 11,284 | 279 | import torch
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.functional as F
from sklearn.m... |
6cd0d721026bb8965e447f2fd9da919d33e150ad079772ab42d565338958cd93 | Python | 11,287 | 321 | import logging
import os
import platform
import subprocess
import sys
import tarfile
from pathlib import Path
import requests
from ray._private.authentication.authentication_token_setup import (
_get_default_token_path,
maybe_enable_token_auth_if_token_available,
)
from ray._private.authentication.authenticat... |
1b5bc5b8914fb397c9bb7677d30e20c969167feb098a231f546a7a77feed32e8 | Python | 11,293 | 334 | import sys
import os
import numpy as np
import scipy.sparse as sp
import torch
import pandas as pd
import scanpy as sc
import anndata
import io
import random
import itertools
import scipy
import anndata as ad
from numpy import inf
from scipy import sparse
import math
import anndata as ad
from sklearn.m... |
18a4dbb6f4ad3ec9e38b7a0064ff372cc121dc5aeb854c783bec2a0bdfe82366 | Python | 11,294 | 349 | import datetime
import os
import pandas as pd
import numpy as np
import torch.cuda
from joblib import Parallel, delayed
from neuralforecast import NeuralForecast
from neuralforecast.auto import AutoNHITS, AutoNBEATS
from neuralforecast.models import NHITS, NBEATS
from ray import tune
from ray.tune.search.hyperopt i... |
4a8575d65fce964c5dcfa97a8c858df621acf70c2d1a4e6d003613ad2c469a31 | Python | 11,294 | 223 | import os, sys, argparse
env_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(env_path + "/../")
sys.path.append(env_path + "/utils/")
import torch
import pandas as pd
from model import PretrainModel
from utils.loss import spearman_loss
from utils.metrics import spearman_corr
parser = argparse.Argum... |
c9e0052c0deb63b714ffa5001f6a05dc57d78d9ebaf5f439526da3f971745a15 | Python | 11,295 | 288 | #!/usr/bin/env python
# coding: utf-8
### Mini Prediction Using Bidirectional LSTM
import os
import argparse
parser = argparse.ArgumentParser(description='Input required arguments.')
parser.add_argument('--train_csv', required=True, type=str, default=None,
help='path to the training dataset file e... |
35dafb02d6fdfd90546f98f7fc0d5cde25d0b8fffc94797c825fd68745b0f667 | Python | 11,301 | 304 | # built-in dependencies
from typing import Union, cast, Any, Tuple, Dict
# 3rd party dependencies
from flask import Blueprint, request
from numpy.typing import NDArray
# project dependencies
from deepface import __version__
from deepface.api.src.modules.core import service
from deepface.api.src.dependencies.variables... |
db45f8b82e6ca29027ec1285873c82a4cbf2ddbdd0a866540d0172123ed1d701 | Python | 11,304 | 234 | import os
import sys
import torch
import pandas as pd
import numpy as np
import torch.nn.functional as F
import scanpy as sc
import anndata as ad
from .TOSICA_model import scTrans_model as create_model
#model_weight_path = "./weights20220429/model-5.pth"
#mask_path = os.getcwd()+'/mask.npy'
def todense(adata):
i... |
26601b908ddb2bdfc2e49419ae36922bfda3fea3756f8a4626f4310b4b6d78d6 | Python | 11,307 | 309 | #!/usr/bin/env python
## HiC-Pro
## Copyright (c) 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 BSD-3 licence.
## See the LICENCE file for details
"""
Scrip... |
86d04dac9ce45aea9d0e4966247e714f6a893bed5dc1b55727a68820789e64cf | Python | 11,307 | 343 | # -*- 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, Any
from dataclasses import dataclass, field
from torch import Tensor... |
f7cf7d1f1c0068d980bc1b3ffaedd695540baf9d0fc67d17d720b94e183cec1e | Python | 11,312 | 223 | import math
import unittest
import torch
from rising.utils.affine import (
deg_to_rad,
get_batched_eye,
matrix_revert_coordinate_order,
matrix_to_cartesian,
matrix_to_homogeneous,
points_to_cartesian,
points_to_homogeneous,
unit_box,
)
class AffineHelperTests(unittest.TestCase):
... |
810906cbec0c20da7a37cd39e1faea71e2775a8460d790e2afeec13b65805ecc | Python | 11,313 | 319 | # -*- 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.
#... |
6404d40528f1b3b944c111cfce3bf6d63c1765cd0947c2f186b5157170464db4 | Python | 11,315 | 379 | import os
import numpy as np
import torch
import torch.nn.functional as func
from sklearn.metrics import mean_squared_error as mse
from skimage.metrics import structural_similarity as ssim
from utils import load_xcf, robust_fit_ellipse, ellipse_to_mask
"""
> Similarity-based losses
"""
def xcor_loss(fixed, moved, m... |
3c555e53410ae233e8c47c6c7fb773894268e191bb5a688cfa7af73e64e77361 | Python | 11,316 | 376 | from datetime import datetime
from typing import Any, List
from urllib.parse import quote
from data_profiling.config import Settings
from data_profiling.model import BaseDescription
from data_profiling.model.alerts import AlertType
from data_profiling.model.description import TimeIndexAnalysis
from data_profiling.repo... |
8c0ed6f4a71f490b75059eeaf3558be7714c78df27c52d145b3626e19719312b | Python | 11,316 | 288 | # 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... |
7249a411cec1ee5c6b1d3aaa14996a2dd5fa3c68b29e233e226c6482bb5a6d9b | Python | 11,321 | 231 | ########################################################
######### Philipp R. Steen #########
######### Jungmann Lab #########
######### Max Planck Institute of Biochemistry #########
######### Ludwig Maximilian University #########
######### 2024 ... |
2dbe9d1d4c6b7e693a460b8558d1654259b2772b55186e6c68b395ec11bfa2af | Python | 11,324 | 265 | # 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... |
a0a209612afb41e3b475f83ca90d29467c0f09164c6054ed3cf79bc2707c8f06 | Python | 11,324 | 256 | '''
test_unit_k4atypes.py
Tests for the k4a types and enums.
Copyright (C) Microsoft Corporation. All rights reserved.
'''
import unittest
import ctypes
import k4a
def get_enum_values(n, start_value = 0):
value = start_value
while(value < n):
yield value
value = value + 1
class TestE... |
180bbd83c9e05ad8b7e322d4f712005c9ff3a705403fafa3ce6593ae833790dc | Python | 11,332 | 265 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
from sklearn.model_selection import train_test_split
import tensorflow as tf
from image_preprocessing_keras_3mask import ImageDataGe... |
aaee9347dd899e84ffdbc323a05d8f306af3a7d88743e520a261360169ccdfc2 | Python | 11,334 | 328 | """
Telegram message formatting utilities — OpenClaw-inspired design.
Design principles:
• HTML parse mode throughout
• Markdown → Telegram HTML conversion for agent output
• <blockquote expandable> for long prose (collapses to 3 lines)
• <pre> blocks for code/shell, auto-split at newlines
• Consistent struc... |
f392911f9a91737f852f7fa55e116ce25cabbdc04b52e775a3a3624a7f60eed1 | Python | 11,338 | 319 | # -*- 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.
#... |
02d3111da1b6cb5933eeeaa3dddbce031b52823d5318deef8d712f84e16471a1 | Python | 11,341 | 305 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# ========================================... |
fbe9fd821e028e3f96c5bd7c32c1962f31599fb251bc4b8a956a20622f740b4a | Python | 11,344 | 239 | # Ultralytics YOLO 🚀, GPL-3.0 license
import torch
import torch.nn as nn
import torch.nn.functional as F
from .checks import check_version
from .metrics import bbox_iou
TORCH_1_10 = check_version(torch.__version__, '1.10.0')
def select_candidates_in_gts(xy_centers, gt_bboxes, eps=1e-9, roll_out=False):
"""sel... |
16201cf455475ed14c0fafc5d61a50a727d6c8e86b382f2423e1d4dcb2c2edbe | Python | 11,345 | 265 | ####################################################################################################
# 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 ... |
0800bf0ccc3e4afbc0a43c21dd7e1ba9687b60901979df9016ecafc67d0726c4 | Python | 11,347 | 329 | import copy
import glob
from keras import layers
from keras.models import Model
import numpy as np
from numpy.random import seed
import os
import pandas as pd
import shutil
import sys
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.applica... |
09a8a20900e4ae87539055dd7acbbff571590373bdc77218950f8dc085f63455 | Python | 11,347 | 210 | """Select and summarize COMMOT outputs with explicit statistical meaning."""
import warnings
from itertools import product
import anndata as ad
import numpy as np
import pandas as pd
from .._registry import register_function
def _get_summarize_cluster_gpu():
from ..external.commot.tools._spatial_communication i... |
433299a2c8cce256b40221e109837522681399cc6c80b63353b3103d66dc0817 | Python | 11,348 | 348 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import argparse
import textwrap
from collections.abc import Sequence
import cvat_sdk.auto_annotation as cvataa
from cvat_sdk import Client, models
from cvat_sdk.core.helpers import DeferredTqdmProgressReporter
fro... |
82626ba54071f5a7549b851fae4a5676f5a55c11d83fa8a447baf01a369c80e4 | Python | 11,348 | 302 | #!/usr/bin/env python
#
# This script is used to generate a figure showing the inter-session variability for on 10 subjects (2 sessions) from
# the marseille-rootlets dataset (private).
#
# The script also computes a distance from the PMJ to the middle of each spinal level and COV. Results are saved to
# a CSV file.
#
... |
42f7b1439624aa09fd4306b64ac4b8343e648697b9f63a6b8825621e803a4c4f | Python | 11,349 | 316 | import asyncio
import json
from dataclasses import asdict
from unittest.mock import AsyncMock, MagicMock
import pytest
from google.protobuf.json_format import Parse
from ray.core.generated.events_submission_job_lifecycle_event_pb2 import (
SubmissionJobLifecycleEvent,
)
from ray.core.generated.gcs_pb2 import Jobs... |
9d0b7911006dc93510a0bc5d5e4c57548319f5c55d207df8d641546a3e38baca | Python | 11,352 | 352 | """Modules for decoding the DMN activity."""
import logging
from typing import Dict, List, Optional, Union
import numpy as np
import torch
import torch.nn.functional as nnf
from datamate import Namespace
from torch import nn
from flyvis import device
from flyvis.connectome import ConnectomeFromAvgFilters
from flyvis... |
048877147f1a96bf147e6dbfff7a5534465a4cc58084b70206d6341d6aa128cf | Python | 11,363 | 267 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
import pandas as pd
import numpy as np
from unicore import metrics
from unicore.losses import UnicoreLoss, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.