sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a5febd740ebde30664a231d50044d2ce4ce5f97ed13b832614ebf18d970c3505
Python
15,282
519
"""Stimulus response functions with caching using xarray.""" from __future__ import annotations from typing import Dict, Optional, Union import numpy as np import xarray as xr import flyvis from flyvis.datasets.datasets import StimulusDataset from flyvis.datasets.dots import CentralImpulses, SpatialImpulses from fl...
90691b2c328f339cf7c4b18ccb1fe34c7073a5a30daa2a6ebaf1616604927ffa
Python
15,283
473
import random from typing import List, Tuple, Union import numpy as np try: from colormath.color_conversions import Lab_to_XYZ, XYZ_to_Luv, convert_color from colormath.color_objects import LabColor, XYZColor, sRGBColor except ImportError: raise ImportError( "The 'colormath' package is required for...
574991fe89edc4c7994402d77daedb9591d9357bfe57181a90818fe827874fdd
Python
15,290
377
from imports import * class TrimBase(common.BaseClass): modulepath = 'ngs_mapper.trim_reads' def setUp( self ): super(TrimBase,self).setUp() # Contains sanger, miseq and 454 fastq self.read_dir = join( THIS, 'fixtures', 'trim_reads' ) # Only fastq files self.se = [ ...
504dabdf761a70f7b99b0e70e21a6391be20ffb1ac2a1b713cf3403f54e74c17
Python
15,291
307
import matplotlib.pyplot as plt import pickle import numpy as np import os from util import * from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay def plot_scatter_plot(label_d, score_d, label_a, score_a, filename): junc_prob = label...
578d6c6ab5db16319c77c4615fc3592051cfaf9efef335ecb16eff90a26e89c5
Python
15,293
390
from typing import Callable, Optional, Union import torch import torch.nn as nn from sinabs.activation import MembraneSubtract, MultiSpike, SingleExponential from . import functional from .reshape import SqueezeMixin from .stateful_layer import StatefulLayer class LIF(StatefulLayer): """Leaky Integrate and Fir...
7d2386513a99535087f7170f975a7fc17855a19fe6cd855471283b290f3ea71b
Python
15,300
372
# Ultralytics YOLO 🚀, GPL-3.0 license import sys from pathlib import Path from ultralytics import yolo # noqa from ultralytics.nn.tasks import (ClassificationModel, DetectionModel, SegmentationModel, attempt_load_one_weight, guess_model_task, nn) from ultralytics.yolo.cfg import ge...
af937c8a8bec176fa32089981c4a7564c12fabd348f1649d08e0c1ab201ecbfc
Python
15,313
382
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import logging from collections import Counter from functools import partial from typing import TYPE_CH...
d0d32e9ed4504fa2e4d4178919a6373b82cd89460f99887c30074a6eb8ea9427
Python
15,315
531
import os import sys from typing import List, Optional, Set, Tuple import click import yaml from ci.ray_ci.configs import ( PYTHON_VERSIONS, ) from ci.ray_ci.container import _DOCKER_ECR_REPO from ci.ray_ci.linux_tester_container import LinuxTesterContainer from ci.ray_ci.tester_container import TesterContainer f...
f5a9bc56f99ab7ebe5ebf14585e9adf4255b9d5258da3565c154e657f926915f
Python
15,320
372
import os from datetime import datetime import tensorboardX as tb import torch from torch.optim import SGD, Adam from torch.optim.lr_scheduler import MultiStepLR from torch.utils.data.dataloader import DataLoader from tqdm import tqdm from datasets.HumanPoseEstimation import HumanPoseEstimationDataset from losses.los...
6ab8d7a76203d59ae6d06dc18b35ff135eec687f8143cb7515b8efacb4bed301
Python
15,328
414
import os import sys import unittest from collections import defaultdict from unittest.mock import MagicMock # coding: utf-8 import pytest from ray.autoscaler.v2.instance_manager.instance_manager import InstanceManager from ray.autoscaler.v2.instance_manager.instance_storage import InstanceStorage from ray.autoscaler...
d2fa7fe3ccf3e98cfb00698170cf6b45fa6c7d62b3f080df2a0f3110f305cc7a
Python
15,329
430
import rdkit import rdkit.Chem as Chem import numpy as np import random elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', 'Co', 'Se', 'Ti', 'Zn', 'H', 'Li', 'Ge', 'Cu', 'Au', 'Ni', 'Cd', 'In', 'Mn', 'Zr', 'Cr', 'Pt',...
6e4259efb13f7e2344c2f24238410e7bf2c62a1f1eaefe87b7bea00544147f03
Python
15,331
427
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Tile module base.""" # pylint: disable=too-few-public-methods, abstract-method, bad-super-call from typing import Dict, List, Optional, Union, Any, Callable...
216d6bd21734a5d9299c6375e7b443c3d9d210b81c7972bbbd49fe62c2236f58
Python
15,334
352
# Copyright 2023 Katherine Crowson, The HuggingFace Team and hlky. 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 # # ...
33a6d94eee55910ad5bfdfda90301d3a352c65376ad3841147da42e2a3102b79
Python
15,335
425
""" Core data model and preprocessing functions for monocle2_py. Operates on AnnData objects. Monocle2 metadata is stored in adata.uns['monocle']. """ import numpy as np import pandas as pd from scipy import sparse from scipy.stats import gmean def _init_monocle_uns(adata): """Initialize monocle namespace in ad...
f6003dafd7871e050a21f784e46990736a9208314d2b61ecf8a395af74d223d8
Python
15,336
348
#!/usr/bin/env python # coding: utf-8 # author: Maruthi Mutnuri (maruthi2008@gmail.com) # loading libraries import pandas as pd import numpy as np import random from sklearn.model_selection import PredefinedSplit, GridSearchCV, train_test_split from sklearn.linear_model import LogisticRegression, Lasso from imblear...
486b27b3037125ff6fdf787cdcb0fee8238ba28023ce0cf29a820fd370b2d24a
Python
15,341
331
import os import time import argparse import torch import tqdm import numpy as np import matplotlib.pyplot as plt from torch.utils.data import DataLoader from torch import nn from sklearn.utils import shuffle from dataset import Dataset from preprocessor import train_normalization, valid_normalization from tester impo...
8d153c0b3a0b4fea67dd4c86838015fc36098621fd68103a5f187620ae0d6420
Python
15,344
421
# -*- 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=raise-missing-from """Tests for inference tiles.""" from typing import Optional, List, Type from unittest import SkipTest from parameterized...
e22df15ff51502eb1357db070cccc0ed1ae8369de240dac21a401a8382cdf8cb
Python
15,358
332
import argparse import pickle from typing import Dict, List import numpy as np import torch import tqdm import visionloader as vl from whitenoise import RandomNoiseFrameGenerator from basis_functions.spatial_basis_functions import make_spatial_basis_from_hyperparameters from lib.data_utils.matched_cells_struct impo...
447016869d7117edea034532790906d565c071e2efe453e36261d16eb5954c0c
Python
15,361
482
import os import gzip import random from csv import DictReader from pathlib import Path from typing import List, Dict, Set, Optional from rich.progress import track import tables as tb import plyvel from ppi_origami.sources.utils import upkb_query import requests from requests.adapters import HTTPAdapter, Retry class...
be641f37ffd250202209ddf9e42fdcf11f6311a7191d2e2fa58b211a605886bb
Python
15,366
342
# coding: utf-8 """ # # SCRIPT: FIRST LEVEL GLM IN EEG-BASED TASK REPLAY # # PROJECT: FMRIREPLAY # # WRITTEN BY QI HUANG 2022 # # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY """ # In[1]: import relevant packages import os import warnings import numpy as np import pan...
fd6bd85f4ab560e16546a967b0ee4cc37b97f042727164db361614217fc1ba87
Python
15,368
398
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Basic inferencing Experiment.""" # pylint: disable=too-many-locals from typing import Any, Dict, Tuple, Type, Optional from os import path, mkdir from copy ...
659f9b8b027d280218994629bb17e4a6aeab7edc0ca9e679a065a4daeae38105
Python
15,376
304
import os import exputils as eu from glob import glob import re import numpy as np import warnings import collections import importlib.util # TODO: Feature - allow to load data from several campaigns # TODO: allow to load single experiments by just providing the id def load_experiment_descriptions(experiments_directo...
c2da1384fd9c1a8bce158325ba7b2645e3751192462505dadc078ae2f59899e2
Python
15,389
426
import asyncio import hashlib import json import logging import os import re import shutil import sys from asyncio import create_task, get_running_loop from typing import Dict, List, Optional from ray._common.runtime_env_uri import parse_uri from ray._common.utils import try_to_create_directory from ray._private.runti...
8331fd40737f8206189ac2f2adb4d232e6d035588ba57ac7ca9d941c4c2690a7
Python
15,392
491
# Copyright (C) 2019-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import inspect import os import os.path as osp import re import tempfile import zipfile from collections.abc import Callable, Generator, Iterable from contextlib import contextmanager from copy import deepc...
9d80110050a71f6a941db69b22b5f578529e04dd52e5131e8bda82ab16afdbb8
Python
15,392
494
import os import numpy as np import torch import xarray as xr from scipy import io from torch.utils.data.dataset import Dataset from ntd.utils.utils import standardize_array ### Datasets # Macaque ECoG session times # Session : 1 # time: 12.28 [s] : AwakeEyesOpened-Start # time: 908.91 [s] : AwakeEyesOpened-End # t...
6d5486a9623e868f6722798087815111b9653445ad3cb2e0aac6beb2854580f1
Python
15,401
484
import os import gzip import random from csv import DictReader from pathlib import Path from typing import List, Dict, Set, Optional from rich.progress import track import tables as tb import plyvel from ppi_origami.sources.utils import upkb_query import requests from requests.adapters import HTTPAdapter, Retry class...
3d16f5234a7f6c084e328db1a87037fd2db045cd11eecdbe4a8082241cd46c71
Python
15,405
453
# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
0f569b94f03f376ff7b5a752f2cb7d9ed42a25649c5e43e24c8175fbea264e03
Python
15,412
440
import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.patheffects as path_effects import numpy as np import pandas as pd import seaborn as sns from os import path from matplotlib import rcParams EXTRA_COLORSET = ["#797979","#000000","#505050","#FFFFFF","#B0B0B0",] def apply_label(x, color, label,...
8d2415b2a0a01ca71728b429615dd819300349356a0ca9af43634569f3d738c6
Python
15,412
346
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 18 14:53:08 2022 @author: Saad Idrees, Joel Zylberberg's Lab, York University idrees.sa@gmail.com This is a custom keras layer that converts light stimulus (R*/rod/s) into photoreceptor currents by using a biophysical model of the photoreceptor by ...
b366e4ef2ca022156e577d6906aad9c60f04e0d4abed7893f6a38af6c682aac0
Python
15,416
375
import torch import random from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, auc, precision_recall_curve, precision_score import matplotlib.pyplot as plt from torch.utils.data import DataLoader, Dataset import calibration as cal import logging import yaml import os import pandas as pd import ...
6054804b3199441972d7d490d6706fde448a60e1a36a094dbe4cd4920803d067
Python
15,417
433
# -*- 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 (inference).""" # pylint: disable=too-many-ancestors from typing import Optional, Union, Any, Tuple, List, Dict, TYPE_CHECKING from...
0893fa5be3a8be9b7c517bb38ed4f8d5dae5dbc5aee7a871eaf09b6b795afa38
Python
15,420
482
import pdb,sys,os import anndata import scanpy as sc import argparse import copy import torch import numpy as np import gc import pandas as pd import timeit import scipy import warnings warnings.filterwarnings('ignore') import faiss from sklearn.cluster import KMeans import sklearn from scipy import stats from sklearn....
d10a93c22e5c150032aaa259ed2ccd5885e615f6f3c6ca080b3960a01eac7b51
Python
15,423
404
""" 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 glob import glob from typing import TYPE_CHECKING, Any import pandas as ...
eefe12dba52a5d99720043e0b99e877547b39da4f7d1edfe7d36402079f82d2c
Python
15,427
354
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Calculate enrichment of clipped reads or discordant pairs at SV breakpoints. """ import argparse import sys import pysam import pandas as pd from svtk.pesr import SRTestRunner, PETestRunner, PETest, SRTest def sr_test(argv): parser = argparse.ArgumentParser( ...
e308ec26b3af36feb76f3354cea7fad0d28a058da8b2a83ea839d21b17abda54
Python
15,430
462
""" MemoryStore — SQLite-backed persistent memory for OmicVerse Jarvis. Inspired by metabot's MemoryStorage design: • Hierarchical folders (path-based) • Markdown documents with tags • FTS5 full-text search across title / content / tags • Channel + session metadata for provenance • Pure stdlib (sqlite3) — no...
3d32f0e31813ac53c4dbacd4d2956d149b56d24e8c51cdac6acd65f888fe4020
Python
15,434
469
import numpy as np import scipy import torch, h5py import os import argparse from collections import defaultdict parser = argparse.ArgumentParser() parser.add_argument("--sample_list_file", type=str, help="path of dir storing original asm files") parser.add_argument("--pred_pdb_dir", type=str, default="", hel...
2cb8feecd782dc07cce5f9e4256af32cfe0b83465b39c722c17d2fb72794a49d
Python
15,435
439
# 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...
ff11643316e636550e9228269a0d8fc23e3ad02ec23df3206ba270110fad451a
Python
15,440
326
import argparse import pickle from typing import Dict, List, Optional, Any, Iterator import numpy as np import torch import lib.data_utils.data_util as du import lib.data_utils.dynamic_data_util as ddu import lib.dataset_config_parser.dataset_config_parser as dcp from denoise_inverse_alg.glm_inverse_alg import noredu...
b8c6f10e9b9302e9b2afd3de6fb01776d19be1adac08b36956828a1cbaa14e56
Python
15,458
539
from __future__ import annotations import typing from typing import Literal, Union, overload, TYPE_CHECKING, cast from . import fastcc3d from .fastcc3d import ( DimensionError, connected_components, statistics, each, contacts, region_graph, voxel_connectivity_graph, color_connectivity_graph, estimat...
784be613b9ff71c8143e4b3125290ee68f1adcfa8d627681ac9f2a8c7d1d9804
Python
15,461
500
""" AutoPrerequisiteInserter - Automatic prerequisite insertion into generated code. This module provides automatic insertion of simple prerequisites into generated code, creating complete executable workflows with proper dependency ordering. Main Components: AutoPrerequisiteInserter: Automatic prerequisite inser...
85fbebef1baa77bbc744ae5d6d478663ac9898ea89b55cba08f608e07bcd05c2
Python
15,461
322
import sys import json import datetime import numpy as np from tqdm import tqdm from spiking_readout.snn import forward from spiking_readout.train import stdp, get_winners from spiking_readout.utils import weight_norm, Logger, EarlyStopper, decision_making # Class storing all the parameters for training the readout #...
ad5dbced6b3f0a57d86fbcd4a54819816366745f42e5b789906a9435890bcd0f
Python
15,463
352
# -*- coding: utf-8 -*- # Development work, e.g. for higher level functions. # These functions are not intended to work on any machine or pass the tests. # They are early drafts (e.g. of higher level workflows) intended to be shared among select collaborators or multiple machines of one collaborator. # Please don't ed...
b3c6ff4c71efe06159ef2ec2a5f561b09aff605df8e848ada954a0225cbb69a4
Python
15,474
386
from scipy.stats import mode import numpy as np import matplotlib.pyplot as plt import seaborn as sns import os from scipy.sparse import issparse from .dp_related import rotate_by_theta def bin_data(counts_mat, gaston_labels, gaston_isodepth, cell_type_df, gene_labels, num_bins=70, num_bins_per_domain=...
3c3edfc07e4311f9f1571b788e469e9d6861f33f5a962560c63dde09f35519ce
Python
15,478
324
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ pandas version: 1.5.0 numpy version: 1.23.3 seaborn version: 0.11.0 matplotlib version: 3.6.3 pingouin version: 0.5.3 """ #%% Import Modules import pandas as pd import seaborn as sns import matplotlib.pylab as plt import pingouin as pg from matplotlib.patches import R...
dae2bc442330a429737b1312447776439b361520ad4472b12dc46751b0d07cbf
Python
15,479
429
""" Module matching %GC compo distribution b/w fg and bg w/i a sliding win. """ import sys import random import numpy from utils import GC from Bio import SeqIO from GC_compo_matching import print_in_bg_dir, get_bins_from_bg_dir from GC_compo_matching import get_bins_len_from_bg_dir def GC_info(seq, win_len, step):...
732511149206f75c20b40ea65da9f75142924d419d990508e63d890eb99effe5
Python
15,491
428
""" 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 pytest import torch import torch.nn as nn from fairchem.core.models.uma.outputs import ( co...
20a3abc21e08936857783784aaa78c44c5625b7d946b282723ad2f2b314e749d
Python
15,498
417
import sys import numpy as np import os # os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Flatten, Add, Input from keras.layers import Conv2D, MaxPooling2D, BatchN...
0fe5816f2e06da6c25fcfb04b12b6b8b2592de1e8f02a904c0cfd297dca9f213
Python
15,499
399
from __future__ import annotations import asyncio import collections from typing import TYPE_CHECKING, Deque, Iterator, Optional import ray from ray.exceptions import GetTimeoutError, ObjectRefStreamEndOfStreamError from ray.util.annotations import DeveloperAPI, PublicAPI if TYPE_CHECKING: from ray._private.work...
199da599921dced82c00d629f136fa6fea59a6b9b335df3e6272b00822fe5a40
Python
15,499
330
""" Script for computing the effective rank, stable rank, number of dormant neurons, and average weight magnitude of the models trained during the incremental cifar experiment. """ # built-in libraries import time import os import argparse # third party libraries from tqdm import tqdm import torch from torch.utils.da...
e20b62adf08605f5708bcaeb1de8230270b207df0f5e658f2f04fe7fc8d703f0
Python
15,506
386
#################################################################################################### # 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...
ce0fd9a980f1ec7e7a9b900f3882fc2f0edfeb2ba835c5777f1fcb0156823fc5
Python
15,519
326
# Location for utility functions that are used at various stages during the model training and validation process import torch import numpy as np import time import os import Dataset_Generator # load the full dataset into RAM class Full_Load_Dataset(torch.utils.data.Dataset): def __init__(self, inpu...
78850f3c45027e9b5562d51567fd3d8cf06afdc92d27a15b45c076622bc30d6b
Python
15,523
325
# -*- 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 """Quantization configuration parameters""" from dataclasses import dataclass, field from typing import Any, Dict, List...
9c0bc0597e02eafaed36f4bad7a417d1b0075f3961fa3c8a63b2729ffb5bfd5d
Python
15,526
332
r"""``pyMetabo`` — AnnData-native lifecycle class for metabolomics QC/stats. Same lifecycle as ``omicverse.pp._scdblfinder.ScDblFinder`` and ``omicverse.single.Milo`` — a class that holds the AnnData, exposes chainable methods for each pipeline stage, and stashes intermediate artifacts on ``self`` for later inspection...
8a9f99a7e9930261267c77d9b8939886462b9d6a18c268b8bc301757774bfacf
Python
15,532
480
"""An example of training DQN, with Optuna-powered hyperparameters tuning. An example script of training a DQN agent with [Optuna](https://optuna.org/)-powered hyperparameter tuning. To keep this script simple, the target environment (``--env``) must have: - 1d continuous observation space - discrete action space T...
9a5dcb4a4fb274fc85bb510178fb95ffa478d6c0d72d80ca1c16d39afa948527
Python
15,533
455
#!/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...
4a76f19605086b921626fcf5c3efc6ce58a039646f08bebad328908f6c632613
Python
15,534
389
import torch from torch import Tensor import torch.nn as nn from typing import Type, Any, Callable, Union, List, Optional from torchvision.models.utils import load_state_dict_from_url __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', ...
b51f89f1a4060f0f856f399b3e5edda4e696ad131e6487eb41d20cff67f09718
Python
15,534
459
import json import os import numpy as np import snntorch as snn from snntorch import functional as SF from snntorch import surrogate import torch import torch.nn as nn from torch.utils.data import DataLoader, TensorDataset # NIR stuff import nir # NOTE: this requires snntorch/nir (PR) and nirtorch/master (unreleased)...
6e87ba5839f0d56f13bd73fe39e22f80600f961ab963bc2d2d3775e0457792a8
Python
15,541
430
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # =========================================...
e8d353aed50adc894048fbb3bc6c0ca1063066d392f3e8cdb4d37a7f36db20ad
Python
15,545
299
import numpy as np from typing import Dict from basis_functions.time_basis_functions import make_cosine_bump_family, backshift_n_samples, \ trim_basis_reduce_condition_number, trim_basis_by_cond_index, basis_shift_forward from lib.dataset_specific_hyperparams.glm_hyperparameters import GLMModelHyperparameters ...
fe65779544059417aa7a6964e94ab1fd0372045caad67754fddc83aa8fbe9f80
Python
15,552
325
#!/usr/bin/env python3 ################################################################################ # -- Preprocessing and analysis of the simulation results ################################################################################ import numpy as np; import pylab as pl; import os, pickle import matplotlib...
9836469bc216b7253cb62f2c0e70720921e6961a5e960d5bd3218bea78372f1f
Python
15,561
429
# ML4H is released under the following BSD 3-Clause License: # # Copyright (c) 2020, Broad Institute, Inc. and The General Hospital Corporation. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # ...
7da93c67dcf0b0e44d8205d2d6b91e56b7629ded1776852ffbb7abef30320a1a
Python
15,565
319
# taken from Github, yjkimnada/ns_decoding # Original Author: Young Joon Kim # Original License ''' Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTI...
fdc8467a95a636f3deba9e7c83b7eae6c29ee22102c0d6234e2c77ba41a0f59b
Python
15,566
294
import sys sys.path.insert(1,'../src_simulation/') sys.path.insert(1,'../src_VI/') sys.path.insert(1,'../src_MCMC/') import pandas as pd import torch from torch.utils.data import Dataset, DataLoader import data_sim from full_slab_spike_model_constructor import * from training_func import * from sklearn.preprocessing im...
d2ff4d13db47c698a1d8ca50c3cf5f8a1ec40439617dd7114088bff23f50eab5
Python
15,573
307
import tifffile as tiff import cv2 import numpy as np from skimage import io import time import datetime import scipy.io as scio import multiprocessing as mp import math import os from DWonder.MN.utils import Split_Neuron, listAddtrace from DWonder.MN.utils import Neuron_List_Initial, list2mask, listAddtrace, centroi...
63c19aad744ae588ee72b438aca6f436492986aa73d0be784af4d57bae92c4a4
Python
15,584
475
""" Chefer et al., CVPR 2021 — "Transformer Interpretability Beyond Attention Visualization" Gradient-weighted attention rollout for encoder-only transformers. Usage (inference only — model weights are never modified): relevancy = compute_relevancy_scores( model=trained_model, inputs=batch_inputs_...
ca1f848c8181a878162041b4e6a3a0bf9435d82baac164c6a39dfb815d8aa9ea
Python
15,591
416
from __future__ import annotations import warnings from contextlib import contextmanager, suppress from datetime import datetime from typing import TYPE_CHECKING import importlib.util import numpy as np import pandas as pd from natsort import natsorted if TYPE_CHECKING: from collections.abc import Generator, It...
82191737c67f54e3f3f1eabcd52e0fed3defe2d6865032c5273d28b9334a0a22
Python
15,600
368
import logging import math from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Tuple from ray.data._internal.object_extensions.arrow import raise_on_pickle_object_columns from ray.data._internal.util import _check_import from ray.data.block import Block, BlockAccessor, BlockMetadata from r...
8fd2cb5605a6cadd225721e4b0a2f9cd6dcf18bc9959663e6402c8f276d3fdde
Python
15,600
409
from typing import Optional import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from lqit.registry import MODELS from lqit.utils import OptConfigType @MODELS.register_module() class StructureFFTLoss(nn.Module): """`FFT-based Structure Loss. <https://link.springer.com...
c30edadf1d3baabdcc62f83bea3c2aea25b68aee0283806e544cecc8c6460977
Python
15,605
453
""" Taken from https://github.com/tugstugi/pytorch-speech-commands and modified by Karan Goel. """ import argparse import os import torch import numpy as np from functools import reduce from natsort import natsorted from scipy import linalg from scipy.stats import norm, entropy from sklearn.cluster import KMeans fro...
1da4dda1b12cd1b43edc00d577ad0fab2db3f00d89f517d9b3937656587bf7c7
Python
15,622
381
#!/usr/bin/env python # Python Version: 3.10 # Author: Reese Wilkinson, Nick Souter # Institution: University of Sussex # Last Update: 01/11/2023 # Version 0.2.2 ## Example 1: # -bash$ qacct -j 3744147 | python3 calc_carbon.py # Job ID: 3744147 # 1: # kWh: 0.000000 # ...
8a74eb48f4336807f1e625412c44d6984095f50b33d2ffd857000bc62c6e6042
Python
15,625
405
# data generator code for training CNN import sys import numpy as np import tensorflow as tf import msprime import tskit from attrs import define,field from read_input import * from process_input import coords2array import gc # garbage collect @define class DataGenerator(tf.keras.utils.Sequence): "Generates data ...
b9f6a301634122c1fa0d28503ba9b7be42a127e89cb8c46778905fb8191dd9bf
Python
15,625
450
# -*- coding: utf-8 -*- import numpy as np from pathlib import Path from vtkplotlib._get_vtk import vtk try: # Doing this allows the current figure to be remembered if vtkplotlib gets # re-imported. _figure except NameError: _figure = None _auto_fig = True def auto_figure(auto=None): """Enable...
9a34f65908bbb5de68d5dd90439654db17de995eb55c941ee0462551ca9afb85
Python
15,632
470
import h5py import numpy as np import datetime from ml4h.TensorMap import TensorMap, Interpretation, str2date from ml4h.defines import StorageType from ml4h.metrics import weighted_crossentropy from ml4h.tensormap.ukb.demographics import prevalent_tensor DAYS_IN_5_YEARS = 365 * 5 DAYS_IN_10_YEARS = 365 * 10 def _sur...
7cb74e7f94271aac97e35bfbd470f150032ac2d45a729213269ef4570230546b
Python
15,633
356
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # -------------------------------------------------------- # References: # DeiT: https://github.com/facebookresearch/deit #...
d18df784aa6c9110723f013c4a610a300265f4be97762a770e85a6bf71c2a568
Python
15,636
426
# # 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...
ffe21303826f40a961661d6365e3702ce56349c1197fc374e8e3fceae4cf7e11
Python
15,638
356
from imports import * from ngs_mapper import compat class Base(BaseClass): modulepath = 'ngs_mapper.run_bwa' class TestUnitBWAMem(Base): functionname = 'bwa_mem' def test_bwa_mem_nonpaired(self): with patch('ngs_mapper.run_bwa.BWAMem', return_value=Mock( run=Mock( return_value=0 ) ) ) as b: ...
b7860a26359785ce137a33cdab5e978e4818cd38ba21b71216fd5c160abf94ea
Python
15,644
370
"""Prompt construction for OVAgent agentic and subagent loops. Extracted from ``smart_agent.py`` to keep prompt assembly in one place. All methods are pure string construction with no side effects. Since task-034, the heavy lifting is delegated to the ``PromptTemplateEngine`` in ``prompt_templates.py``; this module r...
e65bbd30460f52556b50ca1968da18448e77d9b4abfcf6b89532b5a95ebcda72
Python
15,650
361
# # 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...
f71b0776e0bd0bb7c4a9e762b3793ca5edf70db848f0df0b0082e157a096f043
Python
15,680
442
import os import shutil import sys import tempfile import unittest from collections import namedtuple from unittest.mock import MagicMock, patch import pytest from mlflow.tracking import MlflowClient import ray from ray._private.dict import flatten_dict from ray.air._internal.mlflow import _MLflowLoggerUtil from ray....
341bb36dbf5ccf05101a3567bf888a13c30584fe9fbebe2de965b6dec2545685
Python
15,687
375
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 12 20:50:03 2021 @author: irisstone """ import numpy as np import autograd.numpy as npa from autograd import hessian from glmhmm.hmm import HMM from glmhmm.init_params import init_transitions, init_states, init_weights from glmhmm import glm from g...
657ab50c37a582d0044336c10997b23dc87ddb146ef3c10e4536e2053f307c1f
Python
15,696
397
#!/usr/bin/env python from __future__ import print_function import subprocess import os import shutil import math import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib import rcParams rcParams.update({'font.size': 16}) rcParams.update({'figure.autolayout': True}) COVERAGE_BEDS = [ ...
08e3b6e3766c27668829f6da8f98afb1c1f31695e7621e61aa437bd933ef4864
Python
15,703
383
"""Self library author: Ting-Ting Gao""" import pandas as pd import numpy as np import itertools as it def elementary_functions_name(dimensionList,order): Combination_func = list(it.combinations_with_replacement(dimensionList,order)) Num_of_func = len(Combination_func) Name_of_func = [] for i in ra...
2da0956d60b514d0228f3ac5e99fc23675f9b06d32b63dfaa13e9bdc87b03df7
Python
15,703
423
"""Implementation of scoring methods.""" import numpy as np import pandas as pd from typing import Dict, List, Union from scipy import stats import warnings def aucell_score( expression: np.ndarray, pathways: Dict[str, List[str]], gene_names: List[str], ncores: int = 1, aucMaxRank: int = None, ) ...
d6e87a6b4c1767472c30ad8c3971554ee9d5518a93763f72505028a23372b2de
Python
15,703
404
# -*- 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. #...
3a1077bcbb523e6278ae1bf9c4fca175b8ddd126c7a59262dc9b876b617c94d6
Python
15,706
511
import cv2 # noqa: F401 — preload libtiff before HIPT/torchvision shadows it (omicverse vendored patch) import os from time import time import argparse from einops import rearrange, reduce, repeat import numpy as np import skimage import torch from utils import load_image from hipt_model_utils import eval_transforms...
fb698d0dc7d6aa733d9f842cef2cf6bbb18f84b33b569dd464ac1d95a2ba711d
Python
15,712
448
from typing import Optional, Sequence, Tuple, Union, Callable, Any from jaxtyping import Key import jax import jax.lax as lax import jax.numpy as jnp from jax.nn import initializers import jax.random as jrandom import jax.tree_util as jtu import equinox as eqx from .initializers import lecun_normal from ..global_defs i...
b5f8266d1766091992dfad017acc7ce7f0e71bc6a13b09ff55716616dd80573b
Python
15,714
411
import numpy as np import random import matplotlib.pyplot as plt from matplotlib.collections import LineCollection from matplotlib.patches import FancyArrowPatch from ._palette import palette_112 from .._registry import register_function def curved_line(x0, y0, x1, y1, eps=0.8, pointn=30): r""" Generate poin...
8e48715905f1cc921c2892a0e5dce79899a75e1354e6f3f3c764744287fa7012
Python
15,719
439
"""DADA2 backend for 16S ASV inference. Wraps the pure-Python re-implementation `pydada2` (https://github.com/omicverse/py-dada2) — no R / rpy2 dependency. Submodule-style layout (like ``ov.alignment.vsearch``): each function is a thin wrapper around the corresponding pydada2 call, plus one orchestrator :func:`dada2_...
194b99d1b6bf88f9c25e72c3b2e6e73bfbfc2a0642935de22b7039a66030d422
Python
15,723
438
# ML4H is released under the following BSD 3-Clause License: # # Copyright (c) 2020, Broad Institute, Inc. and The General Hospital Corporation. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # ...
afa03bc351aaa09e470a9aab719e667a4234a45851b402fc4e30e94c065e3bcc
Python
15,729
311
import os import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler def load_subjectiid(inputtxt): ''' Load the sujectID file from the RPN output to easily pair the indices(RPNID) with the appropriate participants' id (subjid): create a dictionary in which the keys are the s...
983d9ee3194ce3c63eb4f24c25e4e9d0df04b9e117baa740a45ffec9a116ed09
Python
15,735
298
"""Matching and evaluation, including ports of the supplied MATLAB helpers.""" from collections import Counter import numpy as np from scipy import sparse def pairwise_distances(x, y=None, metric="euclidean", max_pairs=25_000_000): same_input = y is None x = sparse.csr_matrix(x, dtype=np.float64) y = x if...
40901748ebcc448fbc7fad7e6cb47e8d8f2365418ba98d0a1182702d5713c796
Python
15,738
353
import os import csv import logging import operator import h5py import numpy as np import pandas as pd from typing.io import TextIO from typing import List, Tuple from ml4h.metrics import sparse_cross_entropy, weighted_crossentropy from ml4h.TensorMap import TensorMap, Interpretation from ml4h.DatabaseClient import B...
90e43535f4b0256a051d60ab728bd335f5255cbd255ac0b1a060172ca332e66c
Python
15,739
436
# built-in dependencies import os import json import struct import hashlib from typing import Any, Dict, Optional, List, Union # 3rd party dependencies import numpy as np # project dependencies from deepface.modules.modeling import build_model from deepface.modules.database.types import Database from deepface.modules...
ce4b47a9743a7685352d369f5a547c29cf9d64f2567ba62d3e07aa47584b9962
Python
15,744
407
from fractions import Fraction import numpy as np import pytest from stl import mesh from .test_mesh_mass_sliver import _unit_cube, sliver def mixed_components(zero_volume_subset=False, ordinary_sign=1): ordinary, volume, cog, inertia = _unit_cube() ordinary = subdivide(ordinary) ordinary['vectors'] +=...
805ae0efe340bce3688a704c729373af9a5ff86669a799a6b95b22716e85f61f
Python
15,745
467
"""plotting functions.""" import logging import os import matplotlib import matplotlib.pyplot as plt import numpy as np import seaborn as sns import shap import pandas as pd from matplotlib.backends.backend_pdf import PdfPages from matplotlib.gridspec import GridSpec from mpl_toolkits.axes_grid1.inset_locator import ...
1148c9080ad0012eaa65a6c43c6bf8b00b96ad52919951fc88921cd88a38b016
Python
15,749
519
# -*- coding: utf-8 -*- """Module implementing alignment estimators on ndarrays.""" import warnings import ot import numpy as np import scipy from joblib import Parallel, delayed from scipy import linalg from scipy.optimize import linear_sum_assignment from scipy.sparse import diags, csr_matrix from scipy.spatial.dist...
82a12c966c3b42b45b6074f3358724aa8c88978f2135d951a1d90a3efcfaed24
Python
15,749
379
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ The functions used to do selective recruitment analysis Authors: Ladan Shahshahani, Joern Diedrichsen """ import os import numpy as np import deepdish as dd import pandas as pd from scipy import stats as sps # to calcualte confidence intervals, etc import Functional...
964c8e5cf6b5b0fe29f640f796094e4e1b7b20f753a31380f7a6ff1ce2b3541d
Python
15,767
434
# built-in dependencies import os import json import hashlib import struct from typing import Any, Dict, Optional, List, Union, cast # 3rd party dependencies import numpy as np # project dependencies from deepface.modules.database.types import Database from deepface.modules.exceptions import DuplicateEntryError from ...
83fba1661d1f922a5f3611961fbfb858fe5ea85d2c781f5805cfe318061d0826
Python
15,783
256
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.ffnn_classifier import ffnn from agent.classifiers.tr_ffnn_ensemble_classifier import tr_ffnn ...
bbc9da4b9703a40be66436067cbee4fd633276863df526d24e6d2ccae2347053
Python
15,784
359
""" This file evaluate the testing dataset for the SPLAM model. Parameters: MODEL_VERSION : the version of the model. Input directory : "./INPUTS/"+SEQ_LEN+"bp/input_pos/" Output directory: "../src_tools_evaluation/splam_result/"+MODEL_VERSION+"/" """ import os, sys sys.path.append(os.path.dirname(os.p...