sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
74c99bfe762d5d6e5c3e73c21d4323ec22c2c1859d48a40235cbbc4875deaee7 | Python | 11,368 | 343 | """
Estimate T2 and S0, and optimally combine data across TEs.
"""
import argparse
import logging
import os
import os.path as op
import numpy as np
from scipy import stats
from threadpoolctl import threadpool_limits
from tedana import __version__, combine, decay, io, utils
from tedana.workflows.parser_utils import is... |
f0ec3795d6246a7729e8e04a7c27d579e2a1cd97262557b3b171225cd907f7f2 | Python | 11,369 | 279 | import os
from collections import defaultdict, Counter
import pysam
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
from statsmodels.multivariate.manova import MANOVA
from sklearn.linear_model import LogisticRegression, LinearRegression, ElasticNet, Ridge
ADJUST = [
#'PC1', 'PC2', 'P... |
1d8fb2bc6709ba78fb91a7bdff857018072a7dc7e339b352106a7c693eb8c6fd | Python | 11,371 | 318 | #!/bin/env python
import argparse
import gzip
import pysam
import sys
from operator import attrgetter
from typing import Optional, List, Text, Set, Dict, IO, Iterable
# Sort batches with matching contig/start
BATCH_SORT_SPEC = [
('contig', False),
('start', False),
('end', False),
('svtype', False)
]... |
d3ae931fb9fd5ee1ce446fac70494293e6d021b0a25c8c874015669ab951da9f | Python | 11,371 | 277 | # Modified from https://github.com/abrinkk/psg-age-estimation/blob/main/m_psg2label.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
# from base.base_model import BaseModel
# from config import Config
class M_PSG2FEAT(nn.Module):
def __init__(self, config = 'nev... |
74bd7da35b6f11b26ac82babd549ee65e86ffcc8725ce86656fedb2b0b2c3d16 | Python | 11,373 | 263 | r"""Combinatorial library & directed-evolution design.
Design the *libraries* you screen, and let a sequence model guide them:
* :func:`degenerate_codon` — the minimal IUPAC codon covering a target amino-acid
set (e.g. NNK for all 20), with its off-target load.
* :func:`saturation_library` — size / diversity of a s... |
16afcc9c49d857bbd6e305c1dcf7d4db59a692cfedc7e3ab70eb36f2d2b33793 | Python | 11,378 | 212 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
bf2f80674d65ec27a16481908c46c180085ffa5595c8c9f4fb1d1c7598284ab4 | Python | 11,379 | 336 | # Ultralytics YOLO 🚀, GPL-3.0 license
from collections import abc
from itertools import repeat
from numbers import Number
from typing import List
import numpy as np
from .ops import ltwh2xywh, ltwh2xyxy, resample_segments, xywh2ltwh, xywh2xyxy, xyxy2ltwh, xyxy2xywh
def _ntuple(n):
# From PyTorch internals
... |
ed8982cb1a628f91d669558a0ff0c4ec916671ebcf2e9f6411d44eec34df2bba | Python | 11,384 | 313 | # -*- 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.
#... |
b61a10579bfc63bafc3972f23e2edf2c4b35b9ff950bd2fefe9a887839dbc4e3 | Python | 11,396 | 326 | #!/usr/bin/env python
#
# Generate a scatter plot for F1 or Dice score showing the inter-rater variability between the spinal cord nerve
# rootlets segmented by individual raters and the reference segmentation created using the STAPLE algorithm.
#
# Usage:
# python 03b_generate_scatter_plot_inter_rater_variability-... |
899393ad99c594605754e89a09f6a63857a5e30718943d7e890c97a10232d2fe | Python | 11,397 | 241 | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import os
import torch
import torch.distributed as dist
def split_moe_... |
1ffead74e7901379eb7f71f5dc345f83f54809abf9723360ec540131adcf3eb0 | Python | 11,399 | 267 | from functools import partial
from collections import OrderedDict
import torch
import torch.nn as nn
import copy
from .customized_linear import CustomizedLinear
import random
import numpy as np
import pandas as pd
def drop_path(x, drop_prob: float = 0., training: bool = False):
if drop_prob == 0. or not training:... |
a91b354ef21454c1ddc2d16e203f1992e897a192d0d8dd43142cf3c8089a9b56 | Python | 11,399 | 281 | 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... |
eea2948ae87d4598be385f01070ae5ba74a6b81f30c4f62a40e2183dcd91dc25 | Python | 11,399 | 273 | # 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.
from __future__ import absolute_import, division, print_function
import os
import torch
import torch.nn as nn
from torch.nn import functional as F
import joblib
fr... |
a7879463e8559a1d5d5e2b5757891c51ebd67b48cbdbbcbdf83e1c63a9945522 | Python | 11,401 | 278 | import anndata
import numpy as np
import pandas as pd
from scipy.sparse import issparse
from tqdm import tqdm
from numpy.random import choice
import numpy as np
import random
import torch
# 固定随机种子
def set_seed(seed=42):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_av... |
e70254e7933ffc6c2457f6bdde68a56439b3aa7156d649e3a27608d5347773bc | Python | 11,404 | 287 | import os
import torch
import torch.nn as nn
import torchvision
import pytorch_lightning as pl
from networks.unet import Generator, Discriminator
from utils.batch_utils import Dataset_train, Dataset_test
from utils.loss import SSIM_loss, GANLoss, TVLoss
from PIL import Image
class GAN(pl.LightningModule):
def __in... |
c508c6ed2ea2eff1fb83d4deec7420c81d0f70db053de974e8a34c7a858ec1ec | Python | 11,405 | 248 | import torch
import torch.nn as nn
import torch.nn.functional as F
eps = 1e-8
class IRCN(nn.Module):
def __init__(self, channel):
super().__init__()
self.gammaRow = torch.nn.Parameter(torch.ones((1, channel, 1, 1)))
self.betaRow = torch.nn.Parameter(torch.zeros((1, channel, 1... |
03a064227e1fac09103900fdb76971fb55341829063e16eb92efe73869d6799e | Python | 11,408 | 308 | # 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... |
bcd36e7aae8259769e24ade9b1b057398c8491e638edf0e40ce3d959a44081c8 | Python | 11,408 | 296 | '''
Standard VASO-pipeline things like:
- temporal upsampling
- BOLD-correction
- QA
'''
import subprocess
import glob
import os
import nibabel as nb
import numpy as np
import re
import sys
# Define current dir
ROOT = os.getcwd()
sys.path.append('./code/misc')
from findTr import *
ROOT = '/Users/sebastiandresbach... |
237e4e60fe465932b9c31a6215be0f4849e588fa790f5e055cf4489fa2b5abd7 | Python | 11,413 | 216 | #!/usr/bin/env python
# alternative promoter and alternative terminator
import pandas as pd
import numpy as np
from prepare_and_parse import class_by_transcript_pd
from prepare_and_parse import generate_split_table
from prepare_and_parse import determine_order
def novel_exon_stats(args, NE, NE_classify):
'''... |
320f8495fa1b155fb2f83d0be6bcd543cc15461552b274d61cf3ec28f11cbd24 | Python | 11,415 | 343 | # -*- 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.
#... |
7a1ab02a585e819387e54cddbd8964438f6a2bb1c688f3e187cb69d94aee92d8 | Python | 11,423 | 230 | import torch
import logging
from torch.utils.data import TensorDataset
from sklearn.model_selection import train_test_split
from scipy.special import softmax
from nltk.stem import WordNetLemmatizer
from agent.data.entities.config import FC_CLASS_VALUES, SENTENCES_TABLE, UNK_TOKEN, FC_TRAIN_TEST_SENTENCE_FIELDS, CUIS_... |
82aff60ddf9c58644c710a7d4baf087841e1070eb0967cb338780da7942d950f | Python | 11,426 | 289 | # source activate exprKerasWork
import numpy as np
import argparse
import pandas as pd
import math
import pdb
exec(open("/net/trapnell/vol1/home/readdf/trapLabDir/hubmap/results/2021_08_16_fitCNN_model_nobackup/cnnModelFile.py").read())
np.random.seed(7)
parser = argparse.ArgumentParser(description="Parse args for... |
bfedc75f1f5c32d9137e43379cc8eb04511a935338c4ef8b47d6b4ade7af3756 | Python | 11,428 | 269 | 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... |
be33f56db1212d6d7c9d51279d4a2330b106216b1071e82ddea8141a6ecb1bf4 | Python | 11,429 | 214 | import unittest
import mne
import numpy as np
from general_utilities.simulate_malfunction import jitter_trials
def create_onset_epochs(sfreq=1000, onset_time=0, offset_time=0.1, n_trials=500, tmin=-0.2, tmax=2.0):
"""
This function creates an epochs object with an onset and offset at precise time points to al... |
d6cbaf9f310eda1d87d790cebc53728f59d49896e793ed58fc321c8105a47d84 | Python | 11,432 | 343 | # Modified from https://github.com/dbolya/tide
# This work is licensed under MIT license.
import json
import os
import shutil
import urllib.request
import zipfile
from collections import defaultdict
from pathlib import Path
from appdirs import user_data_dir
from .data import Data
from .functions import polyToBox, toR... |
6ccd69400e2e37bc7efe47940ca1a0c97bcb12b53e59f3cf765ebf675194c0f7 | Python | 11,441 | 323 | # -*- 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.
#... |
df2811a1a65de59f62d8a045032032300840865c329342d3ff9243d765a9cd2d | Python | 11,445 | 340 | ####################################################################################################
# Copyright (c) 2020 - 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... |
7f860fae3871217da50390cc77ee44b65985b2ba253e1a78d10ffd56e65f028a | Python | 11,450 | 285 | # built-in dependencies
import os
import json
from concurrent import futures
from typing import Any, Dict, Tuple, Union
# 3rd party dependencies
import cv2
import numpy as np
from numpy.typing import NDArray
try:
import grpc
from google.protobuf.struct_pb2 import Struct
from dotenv import load_dotenv
exce... |
7afe4fabc83551998e2de3781d247e7d91ac4b8dae19c4a77a00ff3a51e31cac | Python | 11,452 | 360 | from defusedxml import sax
import plyvel
import requests
import pandas as pd
import tables as tb
from rich.progress import track
from requests.adapters import HTTPAdapter, Retry
import re
import os
import csv
import gzip
from pathlib import Path
from random import sample
from itertools import product
from typing impor... |
0e2a857ad731e3cd0007df53c1afd6387842592921d6ed2a75443b00a823cc61 | Python | 11,453 | 370 | import geopandas as gpd
import numpy as np
import pandas as pd
import pytest
from shapely.geometry import Point
from siapy.core.exceptions import ConfigurationError, InvalidFilepathError, InvalidTypeError
from siapy.entities import Shape
from siapy.entities.pixels import PixelCoordinate, Pixels
@pytest.fixture(scope... |
476b63fb27012b1cfbb360e6524689eeb2b1fe0dd1e43a7a60d63ed26f850cc7 | Python | 11,453 | 311 | # -*- 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.
#... |
f511792b9299c2109fdc3a19178f140726604dd74f92e964e47e77806a89f9fc | Python | 11,458 | 299 | """Fluorine chemical shift prediction model"""
import json
import logging
from pathlib import Path
import pandas as pd
from rdkit import Chem
from rdkit.DataStructs import BulkDiceSimilarity
from xgboost import XGBRegressor
from lefshift import constants, utils
from lefshift.fp import LEFFingerprint
class FluorineM... |
25f00e3600606676c771bd7fa9ff744805dba7e9e82a45167ab5f09e85f2892d | Python | 11,459 | 361 | # 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... |
a95c12e4975175f091c070ee5fee335d3cc9356e32ffcb003474ecdc77852d04 | Python | 11,466 | 327 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 24 11:45:11 2023
@author: ingvieb
"""
import numpy as np
import pandas as pd
from glob import glob
import os.path
from os import path
import matplotlib.pyplot as plt
import nutil_scripts.graphing_functions as grf
def split_array(arr):
n = len(arr)
q, r = divmod... |
0b00d04b59b6000a1e1929e0732b0a82848fb58181df4456f24f5f75654950f0 | Python | 11,478 | 327 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# =========================================... |
3e334d12434ed66b514a213042ff0c30a5e524eec9479ac28b4285438754bc52 | Python | 11,478 | 320 | import re, os,sys
import torch
import argparse
from Bio import SeqIO
import itertools
from collections import Counter
import pandas as pd
from model import GNNm
from graphData import mRNAGraphDataset,mRNAGraphDataset_1
from torch_geometric.data import DataLoader
parser = argparse.ArgumentParser()
parser.add_argument('... |
8f0ccf52dc2738cca3892d69081138b6c0c9ba02460e49f7560c758a8ed7e033 | Python | 11,478 | 302 | # 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... |
960c02a9d03530862465bda3f863d387a550bd0713b92df1e2f6bb4c7a70ef9e | Python | 11,481 | 395 | """OpenTargets Genetics API client."""
import logging
from typing import Any, Dict, List, Optional
import time
import requests
import json
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class OpenTargetsGeneticsClient(BaseAPIClient):
"""Client for OpenTarget... |
94d1b047544cb1d7c6571afe5d010d2335238c73b1ebcff21a9d9b29be4bab4c | Python | 11,483 | 395 | """OpenTargets Genetics API client."""
import logging
from typing import Any, Dict, List, Optional
import json
import time
import requests
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class OpenTargetsGeneticsClient(BaseAPIClient):
"""Client for OpenTarg... |
310adba27311e2ee7dc7bb138684018a67b12b90ab4dd72f3f387862a29588e7 | Python | 11,485 | 342 | # -*- coding: utf-8 -*-
"""
"""
from unittest import TestCase, skipUnless
import pytest
from vtkplotlib import NUMPY_STL_AVAILABLE
import vtkplotlib as vpl
pytestmark = pytest.mark.order(12)
class TestDocs(TestCase):
"""These are automatically extracted from the docstrings."""
def test_doc_00(self):
... |
ced3852a28a18840adc6dc0fc8b85a076b2b3c6852aa9d6e29ebd9cc5063983d | Python | 11,485 | 269 | 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... |
4da0c57dbec376af2b46eefa5e6edef674fc1484bf43a5962c8b36df959c7c9a | Python | 11,486 | 313 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import functools as ft
import seaborn as sea
import anndata as ad
import scanpy as sc
import scanpy.external as sce
from sklearn import linear_model
from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay
from scipy.io import mmread
fro... |
4d671e578d2a7e0c37bc8b04bb0e89c66362c19a535f4a70ab49eb75f4cd5ab4 | Python | 11,487 | 344 | """
LLM Skill Selector - Phase 2
Uses pure LLM reasoning to select skills based on task descriptions,
mimicking how Claude Code autonomously selects skills.
Key principle: No algorithmic routing, embeddings, or classifiers.
The LLM reads skill descriptions and uses language understanding to match tasks.
"""
import a... |
85d57029703d30f69c920ed41e8e7f515bb14b049790b8b74b79bc026fd1a072 | Python | 11,488 | 255 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 25 16:06:06 2019
@author: istone
Class for fitting generalized linear models (GLMs).
Updated: April 8th, 2020
"""
#import numpy as np
import autograd.numpy as np
from scipy import optimize
from autograd import value_and_grad, hessian
from warnings im... |
c6dd8942bf2421a294bea5bd8b658d691c001413a5933fa990bedf44ca608a78 | Python | 11,492 | 383 | r"""
This file contains code extracted from the NeuroTools package (http://neuralensemble.org/NeuroTools).
"""
from numpy import array, log
import numpy
import mozaik
logger = mozaik.getMozaikLogger()
class SpikeTrain(object):
r"""
SpikeTrain(spikes_times, t_start=None, t_stop=None)
This class defines a s... |
b569ce383e5f927254d9413a11a5785c2e98c22176cf87a2ba9dd9724ccc814a | Python | 11,499 | 371 | from data_profiling.config import Settings
from data_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_monotonic,
fmt_numeric,
fmt_percent,
fmt_timespan_timedelta,
)
from data_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
Varia... |
ac2d04d4909ec70d174a894c1546b6234dc8035b9fda17c3c0b46b2242d42123 | Python | 11,500 | 320 | # -*- 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.
#... |
1117fcfc914c9e7fcbac3fdafd722a331029ce5a5aa2652ae6e926ecf030177d | Python | 11,505 | 277 | from __future__ import annotations
"""Vendored gsMap latent-to-gene workflow for OmicVerse."""
import logging
from pathlib import Path
import numpy as np
import pandas as pd
import scanpy as sc
import scipy
from scipy.stats import gmean, rankdata
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.ne... |
990314c487be8c5ce5cdd699bf53690d4c33320f25b158ea055276a70583a15f | Python | 11,512 | 299 | import torch
import sys
import argparse
import time
import shutil
from utils import *
from config import TrainConfig
from inputs import train_arg_parser
import pprint
import pickle
class ModelConfig(TrainConfig):
def __init__(self, inputs:dict) -> None:
super().__init__()
for param, value in inputs... |
29eae16867ebfaed9427159f6e0aa15063eeb1fd21055d09683242f295c230c4 | Python | 11,513 | 253 | from PIL import Image, ImageEnhance, ImageOps
import numpy as np
import random
class ImageNetPolicy(object):
"""Randomly choose one of the best 24 Sub-policies on ImageNet.
Example:
>>> policy = ImageNetPolicy()
>>> transformed = policy(image)
Example as a PyTorch Transform:
>>> transform=tr... |
b5cb61cf07b472673301d0994f9c4ed56a0a2fd6c4c48024c32ca6c44f367910 | Python | 11,513 | 325 | #
# 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... |
969d0f52e4baabc4b574162231ee9260e92e72fb864615a71852a8beb5e22291 | Python | 11,514 | 372 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
0375e83ef82d18c14ad5c3f5e914af4ede74a69d0258ac2112256c40aa6b2517 | Python | 11,515 | 290 | #!/usr/bin/python
import sys
import os
from os.path import join
import uuid
import argparse
from subprocess import Popen, PIPE, STDOUT
import requests
import tarfile
import numpy as np
import pandas as pd
from scipy import stats
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import OneHot... |
8e6a53243d473a0a38ef6c4fdf950c63e9ed8c29d3941d09d4d29205e34bbf80 | Python | 11,518 | 284 | """Discrete null distributions on the log1p expression grid (FastCCC ``distrib``).
Port of ``fastccc/distrib.py`` (FastCCC 1.0.1, MIT, Hou, Ma & Zhou 2025).
Every operation keeps the original numerical recipe -- same grid, same
FFT convolutions, same normal (CLT) shortcuts, same trimming -- so p-values
match the refer... |
2332f11ee4e671acb8b5f4e3e8c4951001db618b15093c5bc59b8953a77f3dbe | Python | 11,521 | 382 | #!/usr/local/bin/python
"""
***********************************************
- PROGRAM: getEigenVectors.py
- CONTACT: Bryan lajoie (bryan.lajoie@umassmed.edu)
***********************************************
"""
from __future__ import print_function
# Built in modules
import argparse
import os.path
import sys
import gz... |
5bb45b0aa7f65257e8e154e23ad651ee3887cded13e5e74f14ab679d0304ebf4 | Python | 11,529 | 271 | import asyncio
import logging
import os
from concurrent.futures import ThreadPoolExecutor
import ray
import ray.dashboard.utils as dashboard_utils
from ray._private import ray_constants
from ray._private.telemetry.open_telemetry_metric_recorder import (
OpenTelemetryMetricRecorder,
)
from ray.core.generated import... |
e3c38697b82af74d3465a5ed42ae309ccd065bfe26994bbff16e60675cd967d8 | Python | 11,532 | 385 | import copy
import datetime
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
# lava-dl
import nir
import nirtorch
from lava_rnn import from_nir
i... |
06b96778d69f61831ed3b0505d0c1d2413b1a9259d0bc895d82262d24d1cf18c | Python | 11,533 | 316 | import numpy as np
from sklearn.neighbors import KernelDensity
# from scipy.stats import ttest_ind
from stats import compute_stats
class PEKDECRP():
'''a prediction error based 1NN
if PE is high, it make a decision between
- assigns new input to the cloest exisiting cluster
- or create a new c... |
da4ebb3aab9e9689f1ff9abb365b3d5b947239dada5837a616f20fbc17bab30a | Python | 11,534 | 315 | ####################################################################################################
# Copyright (c) 2020 - 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... |
c96fee2bce210951175ae213964f69b8f10eb50d4cab56180e151d97b360cba4 | Python | 11,535 | 351 | # 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, ... |
af7221052c7204cc4c1f2806744195e802d33f15b1b37e3146f245edc44a039b | Python | 11,540 | 318 |
import gym
import json
import os
import gym_sted
import pfrl
import torch
import sys
import random
import pickle
import logging
import functools
import numpy
import h5py
import datetime
import matplotlib
import yaml
# matplotlib.use("TkAgg")
from tqdm.auto import trange, tqdm
from matplotlib import pyplot
from collec... |
9ff31e702922cd8e062782f04b945485a7fbd16da66f22f16a060bc882a02141 | Python | 11,545 | 349 | import numpy as np
import warnings
def pps(knn, rnn, order, use_gpu=True, verbose=True):
"""
Plum Pudding Sampling (PPS)
This function returns the ID of landmarks.
Now supports GPU acceleration via MLX (Apple Silicon) or Torch (CUDA).
Parameters
----------
knn : array-like
... |
d422a2ea296c2ef7379bb765242c2a99766cfe5223090b1fe129039cccf036d3 | Python | 11,548 | 322 | '''
Copyright 2023 Tashreque Mohammed Haq
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 ... |
e44fa9aa1cdec17a02627708b4abe06c1b252605b892bddaec3609561b5034b3 | Python | 11,551 | 332 | """
Clustering functions for monocle2_py.
Implements clusterCells (Louvain, Leiden) and clusterGenes.
"""
import numpy as np
import pandas as pd
from scipy.spatial.distance import pdist, squareform
from sklearn.neighbors import NearestNeighbors
import igraph as ig
def _jaccard_coeff(nn_matrix, weighted=False):
... |
6e638f7a8a216962d8af3eb4153c6dad7e420c6aee62c15760cc7ee2c05925a7 | Python | 11,557 | 293 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Tabulate Mendelian violation rate (MVR) per SV & append other info
"""
import argparse
import sys
import csv
import pysam
import numpy as np
# Convert famfile into list of dicts for complete trios present in vcf
def parse_famfile(famfile, vcf):
# Get list of ... |
a304a1dc8bf94eb4e7a8f60e70f602818a705618a4d7cc5e6ac40837fd130c23 | Python | 11,561 | 354 | import os
import argparse
try:
print('SlURM_JOB_ID',os.environ["SLURM_JOB_ID"])
except:
print("no slurm id")
import matplotlib
import scipy
import tables
import matplotlib
matplotlib.use('agg')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
import tensorflow.keras... |
b2f8f142c03c45352fb5df43ab5d14cc221600c56a61e7be651abaa4e55cffa3 | Python | 11,561 | 281 | """
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 json
import math
import os
from glob import glob
from pathlib import Path
from typin... |
3dea4ccee1c8c6e572d96db67abc19b7409664ec937d3a08ee34de30ee16a4c5 | Python | 11,563 | 358 | # -*- 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.
#... |
c26fa5a25c5344a7cb741bfa9f3b3b17711e1d5b8e7f3f48408ce8227dd6305b | Python | 11,564 | 314 | from imports import *
from ngs_mapper import compat
class Base(common.BaseBamRef):
modulepath = 'ngs_mapper.runsample'
reads_by_sample = ''
f = ''
r = ''
@classmethod
def setUpClass(klass):
# Sets up a ReadsBySample directory and a reference to map to
super(Base,klass).setUpCla... |
e5c9097cbe4f5a969c71e093df58bc622bb22e8879ebcc139b03a2c97a647837 | Python | 11,569 | 288 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from models.DeepLab.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
def fixed_padding(inputs, kernel_size, dilation):
kernel_size_effective = kernel_size + (kernel_size - 1) * (... |
5b772130c1e246358a36f0782826563a69aabd5ce558fb6fe62d72ddb5ca15c0 | Python | 11,570 | 414 | import datetime
from dataclasses import asdict
import numpy as np
import pandas as pd
import pytest
from data_profiling.config import SparkSettings
from data_profiling.model.describe import describe
check_is_NaN = "data_profiling.check_is_NaN"
@pytest.fixture
def describe_data():
data = {
"id": [chr(97... |
6ceef16762ad7bad712c93bd5a7ec6ec3199d4aa4163f7c14b6b302205d8289b | Python | 11,570 | 289 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
A list of commonly used multiple correction routines
"""
from __future__ import print_function
from __future__ import absolute_import
import sys
import random
import numpy as np
import collections as cx
from functools import lru_cache
__copyright__ = "Copyright (C) 20... |
4870c9315a2a54e3f6c8d8c954b7f0775ae3d0bf5ba72c82a2e9ec8fa923e1a2 | Python | 11,575 | 361 | import importlib
import logging
import os
import shutil
import sys
import h5py
import numpy as np
import torch
from torch import optim
def save_checkpoint(state, is_best, checkpoint_dir):
"""Saves model and training parameters at '{checkpoint_dir}/last_checkpoint.pytorch'.
If is_best==True saves '{checkpoint... |
bd0efee2fd3b05cfda470db70cdc348253f3643e0b7faf4dcb748f492afaf4f6 | Python | 11,577 | 335 | r"""iStar backend — super-resolve a paired (Visium, H&E) sample.
Vendored copy lives at ``omicverse.external.istar``. iStar's
``run.sh``-style pipeline is wrapped here as a single Python call:
1. stage ``cnts.tsv``, ``locs-raw.tsv``, ``he-raw.jpg``,
``pixel-size-raw.txt`` and ``radius-raw.txt`` into a working dire... |
668945f3e6929f92c5162f46f37a41194ca05bafc9dccb92793bec6f5b066689 | Python | 11,578 | 365 | import warnings
from abc import ABCMeta, abstractmethod, abstractproperty
import torch
import torch.nn.functional as F
from torch.distributions.utils import lazy_property
class ActionValue(object, metaclass=ABCMeta):
"""Struct that holds state-fixed Q-functions and its subproducts.
Every operation it suppor... |
237b1f1321089f2a9294068c0649690196099f814ca49e2f38ada2e1a54f28f3 | Python | 11,582 | 296 | """Kafka datasink
This module provides a Kafka datasink implementation for Ray Data.
Requires:
- confluent-kafka: https://docs.confluent.io/platform/current/clients/confluent-kafka-python/html/
"""
import json
import logging
from collections.abc import Iterable, Mapping
from enum import Enum
from typing import A... |
0a23c64bb3de0856646f201a3c3b5ee44abfe626243a826eb5fd080f034ff1dd | Python | 11,587 | 351 | """Autoscaler monitoring loop daemon.
See autoscaler._private/monitor.py for the legacy implementation. All the legacy flags
are supported here, but the new implementation uses the new autoscaler v2.
"""
import argparse
import logging
import os
import sys
import time
from typing import Optional
import ray
import ray... |
7642f1679b8ec2cb999c32d6d9e2def2bd870b69e1ec28d5052109562c7f0f1f | Python | 11,587 | 392 | import copy
import logging
import os
import math
import shutil
import sys
import pickle
from typing import Any, Callable, Dict, Iterable
import optuna
import numpy as np
import pandas as pd
import torch
from sklearn.preprocessing import quantile_transform
from statsmodels.stats.multitest import fdrcorrection
logging.... |
a25cce639a138696d9610da5d4d3814ca8684e093557a5b8ee76494cfeaf19a2 | Python | 11,587 | 249 | __author__ = "Simon Andermatt"
__copyright__ = "Copyright (C) 2017 Simon Andermatt"
import logging
from copy import deepcopy
import numpy as np
import tensorflow as tf
from tensorflow.contrib.rnn import LayerRNNCell
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import variable_scope as vs
from... |
65aa9cce9f4c13abd2c417730457a0e86dd561ef0cee84b0e1a57dd15646d9ce | Python | 11,589 | 250 | from typing import List, Tuple, Optional
import numpy as np
import scanpy as sc
import pandas as pd
def subset_for_flow_type(adata: sc.AnnData,
var_type: str = 'all',
flowsig_expr_key: str = 'X_flow',
flowsig_network_key: str = 'flowsig_networ... |
c8cdc717390aefc5a9ecdb1c5b44bea3b7c2e9dac812febb6cd545dd05da6b0a | Python | 11,591 | 266 | #
# 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... |
7a9d818201540b0cda947a6ea55dd97fdb4500a2e19b399d73eeb75e2cc6618a | Python | 11,594 | 326 | # This file allows separating the most CPU intensive routines from the
# main code. This allows them to be optimized with Cython. If you
# don't have Cython, this will run normally. However, if you use
# Cython, you'll get speed boosts from 10-100x automatically.
#
# THE ONLY CATCH IS THAT IF YOU MODIFY THIS FILE, Y... |
40a79118c2b877175a9dd9aaddbc1b147b80f1f0e5d35de39986e16b542d064b | Python | 11,598 | 255 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
'''
This code is to train the matrix W_{out} for n... |
5204aa09902659653f3207efa1a85798075d3e006d5a178b716714ad32dd6a38 | Python | 11,602 | 267 | import argparse
import pickle
from typing import List, Tuple, Callable, Optional
import numpy as np
import torch
import tqdm
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 convex_optim_base.unconstrained_optim imp... |
d74321b835c07f2fd7706092f56a87e6bb5a5ca48aee54d464fbb565417699c0 | Python | 11,604 | 250 | #
# Author: Eugene Gardner (eugene.gardner at mrc.epid.cam.ac.uk)
#
# Prior to using this script PLEASE make sure test_data either has the following files:
# base_covar.scrambled.tsv covar.tsv exclude.txt include.txt
# pheno_covar.scrambled.tsv pheno_covar.txt transcri... |
134fa04de1befb960d6b3fdd6374cb3cada966af97aa047db236e0178059bb50 | Python | 11,605 | 283 | # 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... |
269b87190468fc256dfe6b0149c6473dd75bc654d954d455654248d97d8c89dc | Python | 11,608 | 312 | #!/usr/bin/env python
#
# This script is used to generate a figure showing the inter-session variability for individual sessions from the
# spine-generic single subject dataset.
# 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.
#
# Usage:
#... |
57a110722ea8704af96dd9932a6dade9abfecee0fe9c1a90623d8e1211aafcc3 | Python | 11,608 | 276 | r"""Real public flow-cytometry datasets for the ``ov.flow`` tutorials.
The simulated sample in :mod:`omicverse.datasets._flow` teaches the mechanics —
it can show what spillover *did*, because it applied it. These are real
experiments, and the point of them is that nothing is arranged for the reader's
convenience.
Bo... |
f2bada0dc74f699a6d6a57a536885fffe5213c7bb2c8c440763b6d63080b5006 | Python | 11,608 | 246 | import torch
import torch.nn as nn
import torch.nn.functional as F
eps = 1e-8
class IRCN(nn.Module):
def __init__(self, channel):
super().__init__()
self.gammaRow = torch.nn.Parameter(torch.ones((1, channel, 1, 1)))
self.betaRow = torch.nn.Parameter(torch.zeros((1, channel, 1, ... |
7a870b2c11dd667bd28b72d64faf0aec8cc4b36536dd72b87af84eeee1cbdb3b | Python | 11,610 | 245 | '''
We want to compute several different kinds of cross-correlations, so that we can isolate
the stimulus-driven and noise contributions to the cross-correlations
(1) Data cross-correlations
* Compute center cell vs neighbors, apply the stimulus-presentation correction by shuffling
with two trials awa... |
9f7eab78e4252f4011751107f6f09e468e0528a8fe4ec5ef4e14c29d4d11472e | Python | 11,612 | 288 | """
This script is used to generate:
- boxplot showing the overlap between spinal and vertebral levels for individual subjects and spinal levels; hue is
used to show sex and age
- scatter plot showing the overlap distribution for each level considering age and sex
The script reads CSV files generated by th... |
23abc57366b81cc11e0fb34e72de799f1aa7de8ee62170f6d72db25ee8eec68f | Python | 11,613 | 339 | import os
import warnings
warnings.filterwarnings('ignore')
import cellxgene_census
from tqdm import tqdm
import scanpy as sc
from collections import defaultdict
from typing import Dict, List, Optional, Tuple
import torch
import torch.utils.data as data
import torch
import numpy as np
import scanpy as sc
from nump... |
38f395755f1725501221609831d719d7a647c9ad282d10939bc7dce58235e093 | Python | 11,614 | 253 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
'''
This code is to train the matrix W_{out} for n... |
b2e07ef57d09717ebb76f1b29b296e1bee2ed8d56be780da2a0fecf783fcb5ff | Python | 11,620 | 254 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
'''
This code is to train the matrix W_{out} for n... |
e2ebda5565c733bb07df07762e41d59fc6fa279354a44419e564b4ce17432a23 | Python | 11,623 | 332 | # 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, ... |
5566a87741bceb6d25b57a2891b5fd821daa9f0ae1f6fd5e823f18a735c378cb | Python | 11,624 | 266 | from typing import Union, Tuple, Optional
from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType,
OptTensor)
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter
import torch.nn as nn
from torch_geometric.nn.dense.linea... |
e92f3798377bd00b4c9ff2c1cfb227a2850660a0c42da8e58afa5a92e4a180ab | Python | 11,624 | 261 | import inspect
from typing import Callable, List, Optional, Union
import torch
from transformers import (
CLIPImageProcessor,
CLIPTextModel,
CLIPTokenizer,
WhisperForConditionalGeneration,
WhisperProcessor,
)
from diffusers import (
AutoencoderKL,
DDIMScheduler,
DiffusionPipeline,
... |
d633c33acd0bccf09ce86559867cc57bb8bc64b7eac1b56c39a93e9640ae0184 | Python | 11,629 | 349 | """LD score regression for ``ov.genetics`` — LDSC backend.
Wraps the standalone :mod:`pyldsc` package (Bulik-Sullivan *et al.*
2015; Finucane *et al.* 2015, 2018). Covers SNP-heritability
(:func:`heritability`), genetic correlation (:func:`genetic_correlation`),
partitioned heritability (:func:`partitioned_heritabilit... |
6fe40a188682d6a9977b99f64133cf1b0891351bf82cf13879610b558843380d | Python | 11,630 | 348 | from abc import abstractmethod
from discontinuous_galerkin.base.base_model import BaseModel
import numpy as np
from attr import dataclass
import pdb
import matplotlib.pyplot as plt
import torch
from tqdm import tqdm
import ray
from scipy.stats import norm
from data_assimilation.numpy.model_error import BaseModelError
... |
61d6e0052e2085c09f287f9ab18c54c523332fc758568a76018432fa8e10b5a6 | Python | 11,633 | 335 | r"""PLS-DA and OPLS-DA for multivariate metabolomics analysis.
The discriminant-analysis standard in metabolomics. OPLS-DA (Trygg &
Wold 2002) is preferred over plain PLS-DA because it splits variance
into a single predictive component and one or more orthogonal
components, so the loadings are more interpretable — the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.