sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fee4c56dd4f408d17c6d262be3989ab8936d77cf5af1c5585d050914ef537d81 | Python | 7,613 | 200 | # 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, ... |
9a9bf9d3a01f6ff460dd497f2dd56db0073d05afbaf7e03e18155c7c527efa33 | Python | 7,617 | 199 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
Intersect SV called by PE/SR-based algorithms.
Paired-end and split-read callers provide a reasonably precise estimation of
an SV breakpoint. This program identifies variant calls that fall within
the expected margin of error made by these programs and clusters the... |
3ab3ef0a679dc73dd370137d3550207d1e412096ce23c09700ddca2b93dc1f61 | Python | 7,619 | 198 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard library imports
from pathlib import Path
# External imports
import pytest
import pyspark.sql.types as T
from pyspark.ml.linalg import VectorUDT
from pyspark.sql impo... |
61e36f4e632417bd9995e0348a4bf160f1f19e1fb6e6862cccbb84d9227012d2 | Python | 7,619 | 222 | #!/usr/bin/env python3
"""
Calculates non-duplicate primary-aligned binned coverage
of a chromosome from an input BAM file
"""
# Import libraries
import argparse
import sys
from subprocess import call
import pysam
import pybedtools
import gzip
import shutil
import os
def countable_read(read):
"""
Requireme... |
7d8ec3ca01a153b852c2bdbc4e54227892836552ec2c538eb363f229328f0bde | Python | 7,619 | 173 | from configobj import ConfigObj
import numpy as np
def isnumeric(string):
try:
float(string)
return True
except ValueError:
return False
class config(ConfigObj):
def __init__(self,configfile):
ConfigObj.__init__(self,configfile, encoding="utf-8-sig")
... |
7d1b81e6c9af89281d31a65cc54f99a5dde4d8ac271fa8441658a6238d324952 | Python | 7,621 | 199 | from imports import *
#from test_install import Base
import json
import sh
# Derive from installer base to make life easier
class BaseFunctional(BaseClass):
@classmethod
def setUpClass( klass ):
super(Base,klass).setUpClass()
# Uninstall first since __init__.py already installed for us
... |
b397110d35956dabc910dd9d718d18a53b79f5686507f083465e5694a23bd060 | Python | 7,624 | 215 | from numpy.random import seed
seed(1)
import tensorflow as tf
tf.random.set_seed(1)
import random
random.seed(1)
import tensorflow as tf
import csv
import numpy as np
import SimpleITK as sitk
import matplotlib.pyplot as plt
from numpy import argmax
import pandas as pd
import tensorflow.keras.backend as K
... |
69510fccb65e478a573447f4565b1c03be8e4137e377dbf90c0e6c4d6b78427d | Python | 7,632 | 181 | """
Experimental module exposing variants of the HiC3DeFDR model for benchmarking
purposes.
"""
import numpy as np
import scipy.stats as stats
from hic3defdr.analysis import HiC3DeFDR
from hic3defdr.util.printing import eprint
from hic3defdr.util.dispersion import mme_per_pixel
from hic3defdr.util.clusters import loa... |
43c13fc9bf4a2def2ad62c9717b222a9b717e74c8acf8119193dbc0b23ca66ec | Python | 7,642 | 176 | # 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... |
1f6b614d58cf859db9d43a149c61209e2dbc75b31aa159757671b18cab96af67 | Python | 7,643 | 171 |
TEMPL = """
<style>
th, td {{
border: 2px solid black;
padding: 8px;
}}
th {{
width: 100px;
vertical-align: text-top;
font-weight: normal;
}}
.noborder {{
border: 0px solid black;
}}
.thlab {{
margin-bottom: 1em;
}}
.td {{
text-align: center;
vertical-align: middle;
}}
input[ty... |
825202e1e06e4d32c34c0b9895157b62e0b5c282d3341caff16489f2638b0615 | Python | 7,643 | 206 | """
Resource utilities for accessing package data files with fallback methods.
This module provides robust methods to access resource files in different
packaging scenarios, including support for pkg_resources and importlib.resources.
"""
import warnings
from pathlib import Path
from typing import Optional, Union
d... |
7f42b6736834f877ff9108fee0cc9d4178b4f176b00a9787f89c8b18f029997a | Python | 7,646 | 152 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
import seaborn as sns
from sklearn import svm
# define a function to calculate precision, recall, F1 score, and queue rate
def calculate_metrics(threshold, true_labels, predict_probabilities):
predictions = (predict_prob... |
2afedf28d76788b86c9bc05e633c6b68d83d85ec58d76bf3ff94af1f2d87a5e2 | Python | 7,647 | 194 | import os
import time
from subprocess import call
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import stats
import seaborn as sns
import matplotlib.pyplot as plt
import scipy as sc
from matplotlib.colors import ListedColormap
import scipy.sparse as sparse
import importlib
import copy
import ... |
507f5493ec72e63f45ede19bb74295ef42798d104ed29d142a8ee6287150822b | Python | 7,652 | 182 | import time
import inspect, sys #Losses
import csv
import math
import tqdm
import os
import os.path
import numpy as np
import keras
import keras.backend
import tensorflow as tf
from sak.check import check_weights_exist
from sak.check import shuffle_split_array
from sak.logger import write_summary
from sak.data_structu... |
df1c922d24c83da3b1cd25efccf1f194fceae3ec2e14a2109869f9511033ef5c | Python | 7,656 | 180 | """
STEP THREE
data_pth needs to be customised
Generate EMG signals given default motor unit pools and changes of parameters during a movement
"""
import argparse
import os
import pickle
import sys
import torch
import numpy as np
from scipy.signal import butter, filtfilt
from tqdm import tqdm
sys.path.append('.')
... |
790de5e5249d1451be63313e5270c3e487f96395d56936b6ba7d7eacbaf8ca18 | Python | 7,657 | 173 | from copy import copy
import os
import numpy as np
from os.path import join as opj
from os.path import dirname as opd
from os.path import basename as opb
import argparse
import json
import shutil
import copy
import time
from omegaconf import OmegaConf
from utils.logger import MyLogger, reproduc
from utils.Multiprocess... |
7df62e20c34dd5c8f19a7613fac645f72133dccd1202049d2358eb8cf07fa5c0 | Python | 7,662 | 234 | # 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... |
155f70ee53bfadab9ef6f5048e9a4a96a4816d715cf422dcb9ae078836214281 | Python | 7,666 | 117 | import gzip
import json
import os
import re
from functools import lru_cache
import numpy as np
import pytest
from candycrunch.analysis import CandyCrumbs, rank_glycopeptide_compositions, rank_glycopeptide_sites, deisotope_ms2
# Glycopeptide regression benchmark: 270 MS2 spectra of O-glycoprotease and tryptic glycoprot... |
247d59236c5519692dbc27d5d5bc69fea572ef9ebf6917f7e0c718e6173b18fe | Python | 7,666 | 234 | from dataclasses import dataclass
import numpy as np
import pytest
import torch
from datamate import Namespace
import flyvis
from flyvis import Network
from flyvis.connectome.connectome import init_connectome, register_connectome
from flyvis.network.network import IntegrationWarning
from flyvis.utils.tensor_utils imp... |
643680463fc129f15f1fde182d1e3ad836f5e486ad921afb3831ef8ec4d911f1 | Python | 7,666 | 164 | from stitch_images import CompositeImage, stitch_grid_m2stitch, stitch_grid_manual, downscale_mean, illum_correction
from common import ImageLoader
import sys
import skimage.io
import numpy as np
import concurrent.futures
import os
import matplotlib.pyplot as plt
def get_position_leica(image, path):
fulldata = ope... |
85f4819342c6948489a46408ed6068fc98bb7671270b79684d9adcd26ce7ba98 | Python | 7,666 | 252 | """
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
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING
import ase... |
977ee9162da19577167b647c9038ed4cf8352cc83a58407c3ea6751b8f73cea5 | Python | 7,666 | 263 | """Utilites for writing diagnostic overlay images
"""
import os
import itertools as it
from typing import Sequence, Tuple, Dict, Optional
import copy as cp
import glymur
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import imageio
from neuron_morphology.snap_polygons.geometries import Ge... |
ef8784ab3beaab9c4abbd1e03517c2c37be62849e2fed0357313b52c26558e27 | Python | 7,667 | 283 | from typing import Optional, Sequence, Union
import torch
from rising.utils import check_scalar
from rising.utils.torchinterp1d import Interp1d
__all__ = [
"norm_range",
"norm_min_max",
"norm_zero_mean_unit_std",
"norm_mean_std",
"add_noise",
"add_value",
"gamma_correction",
"scale_by... |
9a67f56c974fd085bb75d598caef3a91e90cf2635c8ad2d86db42529ac33ad4f | Python | 7,668 | 174 | # 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... |
79015a90b9aac59f3b5375bf930a0180a159fcf4791cb3a85ffc9849e9030b77 | Python | 7,674 | 210 | import asyncio
import collections
import fnmatch
import itertools
import json
import logging.handlers
import mmap
import os
import time
from concurrent.futures import ThreadPoolExecutor
from typing import Callable, Dict, List, Optional
from ray._common.utils import get_or_create_event_loop, run_background_task
from ra... |
31e1d04e8bb44672bbfc1213ef2cfab89eff23e554de03c38817cff51c7b2fcd | Python | 7,675 | 240 | """
Diff test to ensure ReleaseTestImagePushContext produces identical tags
to the original AnyscaleDockerContainer/DockerContainer implementation.
"""
import os
import sys
from unittest import mock
import pytest
from ci.ray_ci.anyscale_docker_container import AnyscaleDockerContainer
from ci.ray_ci.automation.push_r... |
811197a18c662b90e8dcdf6d50bb42fc794ea10de2f19043d1e895ebd99e137b | Python | 7,678 | 184 | import numpy as np
import scipy
import time
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
import numpy as np
import pickle
import os
import argparse
from glmsingle.glmsingle import GLM_single
import nibabel as nib
import subprocess
#compute glm using glmsingle
# https://github.com/cvnlab/GLMsin... |
d10be8f2b9c53a9de6330f3658a7bb859072ccebe0b7efbd8c7bf5ee6e92c90e | Python | 7,678 | 154 | """
Quick analysis to calculate d-prime between each target and catch
for each neuron. Save in one big dataframe.
"""
import os
rdir = os.path.dirname(os.path.dirname(__file__))
import sys
sys.path.append(rdir)
from nems.tools import recording
from itertools import combinations
from dDR.utils.decoding import compute_... |
cc09c9d3e1f0aa1709d20da5ec72b786640475990c28af8303850c5d20db1248 | Python | 7,679 | 195 | """
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 typing import TYPE_CHECKING, Optional, Protocol, Union, runtime_checkable... |
5f0920cbc3509b39d6c81be1449e6a879c693c617f9f7382a1a5d5e967d0cb00 | Python | 7,680 | 240 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Update variant VCF representations to be compatible with the letter and spirit of the VCF spec when possible.
Currently the major change made are to:
-populate the reference allele with the actual reference base indicated by POS
-re-write records with SVTYPE=BND, ALT... |
de5c50ae5fba3828a31ca94d55fad3c15db668327a4e3d139d5fffccbc2cfaac | Python | 7,680 | 191 | from typing import Optional, Callable, Tuple
from anndata import AnnData
import networkx as nx
import numpy as np
import pandas as pd
import graphical_models as gpm
def _total_edge_weights(
adjacency: np.ndarray
) -> dict[Tuple[int, int], float]:
nz_rows, nz_cols = adjacency.nonzero()
edge_weights: dic... |
d4cbf44da465032262664c5315b2030db6acdbdaf9f88b5c664f63a80da51d61 | Python | 7,682 | 220 | from typing import List, Optional, Tuple, Union
import numpy as np
import sklearn.metrics
import torch
import torch.nn as nn
import torch.optim as optim
from sklearn.linear_model import Ridge
from sklearn.model_selection import GridSearchCV
from torch.utils.data import DataLoader
from torch.utils.data import TensorDat... |
e220beadd62ca5289e5066e9242bbacebe283c603317954cddb28a70b10082b8 | Python | 7,687 | 224 | """Statistical fine-mapping for ``ov.genetics`` — SuSiE backend.
Wraps the standalone :mod:`pysusie` package (the Sum of Single Effects
model, Wang *et al.* 2020). :func:`finemap` dispatches between SuSiE on
individual-level data (``method='susie'``) and SuSiE-RSS on GWAS
summary statistics + an LD matrix (``method='s... |
ff21f1ddd7be6205ddb9be3fc9d8ef2d9df1d40566fcee37f5f607aa4009ad3f | Python | 7,690 | 188 | import gzip
import os
import tarfile
import math
import os
import matplotlib.pyplot as plt
max_length = 1400
pLDDT_row = "ATOM"
pLDDT_atom = "CA "
pLDDT_atom_column = 2
pLDDT_amino_acid_column = 3
pLDDT_position_column = 5
pLDDT_amino_acids = {"SER", "THR", "TYR"}
pLDDT_value_column = 10
class P... |
9e04bf36a3fbb83b895f69df55274f5337fc75dd373390b64146ae524a637b90 | Python | 7,693 | 172 | #!/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 numpy as np
import seaborn as sns
import matplotlib.pylab as plt
import pingouin as pg
from matplotl... |
a6f5165b4dc8855753c1d83eddb3e8d8364b6dc43fa2f5e39f6d2556c2e50099 | Python | 7,696 | 192 | # Ultralytics YOLO 🚀, GPL-3.0 license
import os
import random
from pathlib import Path
import numpy as np
import torch
from PIL import Image
from torch.utils.data import DataLoader, dataloader, distributed
from ultralytics.yolo.data.dataloaders.stream_loaders import (LOADERS, LoadImages, LoadPilAndNumpy, LoadScreen... |
a6947628f5923095acbed5ea2495e6e385853fbfc9ec88999af23ff26b14d082 | Python | 7,699 | 213 | import time
import logging
from datetime import date
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
from agent.data.entities.config import ROOT_LOGGER_ID
from agent.crawlers.twitter_crawler import get_tweets
from agent.crawlers.utils.scraping_utils import get_paragraphs
from agent.crawlers.utils... |
e36ec0f3927c844bff48b00fae79fe1e0060044a3187b653385b9e30ceebc999 | Python | 7,699 | 179 | # biolgca is a Python package for simulating different kinds of lattice-gas
# cellular automata (LGCA) in the biological context.
# It is made available under the BSD 3-clause license (see LICENSE.txt or
# https://opensource.org/licenses/BSD-3-Clause).
# Copyright (C) 2018-2022 Technische Universität Dresden, Germany.
... |
8fc7cdaf9b3636b36ef60809afc980932a64a81ba773e3b80a1cb4966c29f52d | Python | 7,701 | 208 | import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from cooltools import numutils
import cv2
def get_compartment_bins(eigenvector):
"""
Get indexes of compartments A/B and NaN (zero) bins from eigenvector.
Parameters:
eigenvector -- A list with eigenvector values for specific c... |
f48da5c778f436a7a5843e25f6c6938eb4d5b760d8a0f29a62fbc2ad77f4ef55 | Python | 7,701 | 211 | # -*- coding: utf-8 -*-
### ------------------------------ IMPORTS ------------------------------ ###
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from train.feature_settings import param_list, cross_ch_param_list
from train.feature_settings im... |
a497965b52bd622756adc8508cab455637aef4fc1677b97e990315b46c69651c | Python | 7,703 | 209 | import nengo
import numpy as np
import nir
model = nengo.Network(seed=3)
with model:
model.config[nengo.Ensemble].neuron_type = nengo.LIF(tau_rc=0.02, tau_ref=0)
x = nengo.Ensemble(n_neurons=600, dimensions=3, radius=30)
synapse = 0.1
def lorenz(x):
sigma = 10
beta = 8.0 / 3
... |
f01d47f87a6845a2d556bf9392e12a384c6d6f018e75edb25f6f0031f4a83941 | Python | 7,706 | 203 | import copy
from typing import List, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmdet.utils import OptConfigType
from mmengine.model import BaseModule
from lqit.registry import MODELS
@MODELS.register_module()
class DFFPN(BaseModule):
"""Dynamic... |
8b8e5340f889125d765a9d69e7f56d1b7d78051d16dcebd5ac3f132a79596d06 | Python | 7,710 | 243 | #
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# 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 ... |
68c0c8e6bc44d0da3cea20de69bff1e02aab291fed3c8e25e2e3d016ccaaaead | Python | 7,713 | 216 | # Modified from https://github.com/InternLM/opencompass/
# Modified from https://github.com/InternLM/InternLM/
import datetime
import os
import time
from typing import Dict, Optional
from mmengine.hooks import Hook
from mmengine.hooks.hook import DATA_BATCH
from lqit.common.utils.lark_manager import get_user_name, se... |
bd98c03c887bd568827378a2080d0746426f55fad7083fb9f07aedfbfac9cecb | Python | 7,714 | 187 | import argparse
import os
import warnings
from pathlib import Path
from time import time
import torch
from rdkit import Chem
from tqdm import tqdm
from lightning_modules import LigandPocketDDPM
import utils
from analysis.molecule_builder import process_molecule
MAXITER = 10
MAXNTRIES = 3
if __name__ == "__main__"... |
7e421e2bf9a599ffcc72fc5bb89de8b90a8806045ca13c66644a9dc8462d2e33 | Python | 7,715 | 221 | """
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 numpy as np
import torch
from ase.geometry.minkowski_reduction import minkowski_reduce
def wra... |
f53b4ac0d49974eea60a884c19ac07c2141a5492b2265b66b985d1c2e021e3e5 | Python | 7,719 | 231 | import argparse
import json
import os
import numpy as np
import torch
from torch import nn
import pfrl
from pfrl import experiments, explorers, replay_buffers, utils
from pfrl.wrappers import atari_wrappers
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--env", type=str, default="Breako... |
a60673b64363086913b8a22aae9ab3e3dad1fabd92174cac4ec29d52de470939 | Python | 7,721 | 217 | """Per-tool permission policy for OVAgent tool dispatch.
Maps tool names to allow/ask/deny permission verdicts based on registry
metadata, explicit overrides, and allowlist/denylist constraints. The
policy layer sits between the turn loop / subagent controller and tool
dispatch, enforcing per-tool and per-class permi... |
4b534fbae4f4035b3fddbb5efe1fd4868aa5f01a96bd84d56e28274ea5e60015 | Python | 7,726 | 199 | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
0c7026772e26e1c2ae3c26982f76eea0ef85b181279ca7bc2ef5832a24a7b577 | Python | 7,728 | 239 | """
This script simulates the conjunctive grid by head-direction cell hypothesis
for different proportions of conjunctive grid cells. This is done for each
of the three trajectory types in the manuscript. The results are plotted and
used in Figure 2-figure supplement 2.
"""
import os
import pickle
import matplotlib.pyp... |
4885edf06102cf6847f29c5bc7d4a05cc9a19d4be812eeac7f2cd3c7c2c91e4c | Python | 7,734 | 260 | """
Base classes for scLLM models.
Provides a unified interface for different single-cell language models.
"""
from abc import ABC, abstractmethod
from typing import Dict, Any, Optional, Union, List, Tuple
from pathlib import Path
import torch
import numpy as np
from anndata import AnnData
class ModelExecutionBlocke... |
aeb9eacf501e6470411317fb0b38a75955f624da23c1863f1da59b7d5735c5a8 | Python | 7,735 | 242 | import argparse
import gym
import gym.spaces
import numpy as np
import torch
from torch import nn
import pfrl
from pfrl import agents, experiments, explorers
from pfrl import nn as pnn
from pfrl import replay_buffers, utils
class MultiBinaryAsDiscreteAction(gym.ActionWrapper):
"""Transforms MultiBinary action s... |
3ea68956c9ead8bfc4a6ef15ed62572288665bacfc396c41779d5b7c6c2ad2af | Python | 7,737 | 205 | # 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... |
7092a889a54fb246e3fe0e2198deaf7bbcda4a96f2ec9098ae07077989b1015a | Python | 7,737 | 157 | import torch
import logging
from pynvml import *
from transformers import logging as transformers_logging
from accelerate import Accelerator
from os.path import exists
from agent.data.entities.config import MODELS_CACHE_PATH
from agent.data.entities.config import DATA_CACHE_PATH, EXPORT_CHECK_INPUT_DATA_RESULTS_FIL... |
f05d5e229223e2d8c0ac403fa74cf5cea4d51fe99f0ca24cb230f98b39b4f55b | Python | 7,737 | 210 | # 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... |
861e23ad0cda0b6172e109eb30071e5c55e127cef167c78f4756e5735ebaba5a | Python | 7,738 | 176 | import torch
import utility
import loss
torch.backends.cudnn.enabled = False
import argparse
from div2k import Flouresceneiso
from trainer import Trainer
from torch.utils.data import dataloader
import model
def options():
parser = argparse.ArgumentParser(description='EDSR and MDSR')
parser.add_argument('--mod... |
d1d97ac7970529b4b2d5f22b5e1c4f383ebd52c60c5e56ed24cdd0856dbd244d | Python | 7,740 | 191 | import asyncio
import collections
import json
import logging
import os
import ray.dashboard.optional_utils as dashboard_optional_utils
import ray.dashboard.utils as dashboard_utils
from ray._private import ray_constants
from ray.core.generated.events_base_event_pb2 import RayEvent
from ray.dashboard.consts import (
... |
98db7a58daea76308cc49e3b24530bc3766340f5d36d8343212e599a38a2b01a | Python | 7,742 | 216 | """
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.
GPU tests for UMA Nitro running through MLIPPredictUnit and FAIRChemCalculator
on the pinned uma-s-1p2p1 checkpoint. Fallbacks are in
test_uma_... |
cea7a0c211195ea2fe5e3d66b05c77639abfca9cca881d5487f2b8ac9fd62d99 | Python | 7,742 | 227 | # flake8: noqa
# __begin_define_uniform_request_router__
import random
from ray.serve.request_router import (
PendingRequest,
RequestRouter,
ReplicaID,
ReplicaResult,
RunningReplica,
)
from typing import (
List,
Optional,
)
class UniformRequestRouter(RequestRouter):
async def choose_re... |
c2d6e057def9f972d7e569336038ffea7ef28195752ce94da0f7d8e17962b770 | Python | 7,743 | 176 | import argparse
import subprocess
from io import StringIO
import pandas as pd
from tqdm import tqdm
import torch
import torch.nn.functional as F
from torch import nn
from transformers import AutoModelForTokenClassification, AutoTokenizer
from Bio import SeqIO
from Bio.Seq import Seq
def phanotate_processing(inpu... |
08c273f45ab3b9f7528c3eb6adb9086a190424c6f8a0d9f21a21b626aa19dcc8 | Python | 7,748 | 202 | """
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 torch
from fairchem.core.graph.radius_graph_pbc import (
radius_graph_pbc,
radius_graph... |
1eb28a65d3d0f9d77f896ff0a2f0457fa31350f583442ed8c9a46c8976893a70 | Python | 7,749 | 220 | from numpy.random import seed
seed(1)
import tensorflow as tf
tf.random.set_seed(1)
import random
random.seed(1)
import tensorflow as tf
import csv
import numpy as np
import SimpleITK as sitk
import matplotlib.pyplot as plt
from numpy import argmax
import pandas as pd
import tensorflow.keras.backend as K
... |
39b2c7c51433a426afc873b8600eea246feaf3da466fbe6e90431eb4f9acb5e6 | Python | 7,749 | 196 | import time
import logging
from datetime import date
import re
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
from agent.data.entities.config import ROOT_LOGGER_ID
from agent.crawlers.twitter_crawler import get_tweets
from agent.crawlers.utils.scraping_utils import get_paragraphs
from agent.crawl... |
6ac6859a53b8097ac80ffb4e621983faf95b0456ec16df5bb42da0ca34ed012b | Python | 7,749 | 211 | import logging
import math
from contextlib import contextmanager
from typing import TYPE_CHECKING, Any, Callable, Iterable, Iterator, List, Optional
from ray.data.block import Block, BlockMetadata
from ray.data.datasource.datasource import Datasource, ReadTask
Connection = Any # A Python DB API2-compliant `Connectio... |
c5c56b01b761031d1632e72a78b4384a29bab2f9c414f66b8075d5ea09a247f7 | Python | 7,750 | 224 | """
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 typing import TYPE_CHECKING
import torch
if TYPE_CHECKING:
from fairchem.core... |
8837d49d5c22107d20b72807988aafe9865538d9a7213f724f5c472541add007 | Python | 7,751 | 221 | import os
import threading
from contextlib import contextmanager
from functools import wraps
from typing import Any, Callable, Optional, Tuple, TypeVar, cast, overload
from ray._private.auto_init_hook import auto_init_ray
F = TypeVar("F", bound=Callable[..., Any])
# Attr set on func defs to mark they have been conve... |
20b6869c138d6f18bfd66806c005a8ca08ad380151ef2739d697ab1481d98869 | Python | 7,752 | 124 | import numpy as np
import xarray as xr
#### general analysis ####
time_period = slice("1850-01-01", "2014-12-31")
hgt_level = 500
###################################################
################### Regions #######################
###################################################
##### southcentral_north_americ... |
912e8012d52eb59b13daede5a7ad47739965bff8c4ef6723023322ca2f199553 | Python | 7,752 | 245 | import torch
import argparse
import json
from torch.utils.data import DataLoader
from models import PretrainModel, load_model_arch
from utils.Dataset import TransDataset, col_fn_pretrain
from utils.training import ddp_pretrain, ddp_preeval
from utils.data_utils import (
check_early_stop,
create_log_model,
... |
3f0625cb7c8b0954247c9882769b8231b08039a9485b769c45ad71ba37d03a54 | Python | 7,753 | 246 | """
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
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
import numpy as np
if TYPE_CHECK... |
da9007ca800bb2fbc91056143791cb0efe6177e45a9076d1e227550178ea22c2 | Python | 7,755 | 230 | import json
import os
import subprocess
from spinnaker2.coordinates import PE, WordAddr
from spinnaker2.helpers import global_word_address
class MemoryRegion(object):
"""memory region on a SpiNNaker2 PE.
A memory region is defined by its start address and the number of 32-bit
words.
Attributes:
... |
24a6208f78877344eb4a03201e5a75b5ebc671fedd4bb2dc5440e40c62f77392 | Python | 7,757 | 294 | import os.path as op
import os
from fsub_extractor.utils.system_utils import *
def project_roi(
roi_in,
roi_name,
fs_dir,
subject,
hemi,
outdir,
projfrac_params=[-1, 0, 0.05],
overwrite=True,
):
"""Makes volumetric file of ROI mapped on white matter surface
Parameters
====... |
02c802264bc44c60ebfec59c8059ff33328b7c09ec2e34fed055934bdc297503 | Python | 7,759 | 203 | from __future__ import division
from .. import gpu_utils
from ..distributions import *
import numpy as np
# Import manually defined functions
from .variational_nodes import UnivariateGaussian_Unobserved_Variational_Node
# TODO :
# could be integrated in usual Z node (using a check if U is in Markov blanket)
# curre... |
db2db268500360a926e227e32fe76f73e4fca3a91d07cbbc99703a0956c7c9bd | Python | 7,759 | 213 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Apply final FILTER cleanup and QUAL score recalibration
"""
import argparse
import sys
import pysam
import csv
from numpy import median
# Define global variables
filts_for_info = 'PESR_GT_OVERDISPERSION HIGH_SR_BACKGROUND BOTHSIDES_SUPPORT VARIABLE_ACROSS_BATCHES... |
5c9e967a4dc74fd0d782764f5ab1da1d2014fdb658e5bbb26ceed273d6a84eef | Python | 7,761 | 223 | # 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 os
import numpy as np
from unicore.data import (
Dictionary,
NestedDictionaryDataset,
LMDBDataset,
AppendTokenDataset,
Pr... |
a15e76772644ae77bf05ac6b178ffe606f55c00bcde0912530d17f75d15ba405 | Python | 7,761 | 222 | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
b72d03bb609acedaeb5ddefbbfedd8625e934887952d719b43100a07ead0a408 | Python | 7,764 | 256 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
e37ce08a1bea1fceee84944f465d3d69e8c71a91c1707be85da5bc16fe2a43a9 | Python | 7,766 | 222 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
import numpy as np
import pysam
import svtk.utils as svu
import pandas as pd
from svtk.pesr import PESRTestRunner, SRTest, PETest
from svtk.famfile import parse_famfile
def get_denovo_candidates(record, fam, max_parents=20):
"""
Obtai... |
6cc1284cdeffc8c0d99586256d61c615725677aebfe841797b4a8cd8a19e43a1 | Python | 7,768 | 219 | import itertools
import logging
import os
import sys
import torch
from Bio import SeqIO
from tqdm import tqdm
from src.external import get_sublocation, get_sublocation_features_length
# its win32, maybe there is win64 too?
is_windows = sys.platform.startswith("win")
if is_windows:
print("N.B.: Windows detected, ... |
c3a0652ddb53f7aa5edb079a1e6eb2ffe6524b2befd2572e8a966be134e14a22 | Python | 7,773 | 177 | import logging
import tempfile
from typing import Dict, List
import h5py
import apache_beam as beam
from apache_beam import Pipeline
from google.cloud import storage
from ml4h.defines import TENSOR_EXT, GCS_BUCKET, JOIN_CHAR, CONCAT_CHAR, HD5_GROUP_CHAR, dataset_name_from_meaning
def tensorize_sql_fields(pipeline: ... |
f39219fe995f5600780d8d6122d39037571210b5e0c2e08ffb2f973f8d336803 | Python | 7,773 | 227 | from itertools import combinations
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import Ellipse
def get_shared(sets):
r"""Compute intersection sets for all combinations.
Parameters
----------
sets : dict[str, set]
Mapping from group names to Pyt... |
07e5adf2c018f219396e97c7410668bdeb42ed7fde37e964eae1d43570c9a714 | Python | 7,776 | 214 | # 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, ... |
b9b832688903de3f5fda464dd25f709bc42b5c6bfa7cba524c4a6a0b4814a488 | Python | 7,776 | 193 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import sys
from collections import defaultdict
import pysam
import svtk.utils as svu
def merge_pesr_depth(vcf, fout, prefix, frac, sample_overlap, min_depth_only_size):
def _get_shard_path(base_path, index):
return "{}.shard_{}.vcf.gz".format... |
ea2dbd3a04ad92b6916a61bf0bcb7d5df726e1889eeef4cb30e9400858518a0d | Python | 7,776 | 182 | import os
import numpy as np
import mrcfile
from IsoNet.preprocessing.simulate import apply_wedge_dcube as apply_wedge
from IsoNet.util.noise_generator import make_noise_one
# from IsoNet.preprocessing.simulate import apply_wedge
def create_cube_seeds(img3D,nCubesPerImg,cubeSideLen,mask=None):
sp=img3D.shape
... |
44821399762ba83df69bc8bf5d6d2061f7d8ca9e6c7a33da4d44d6db9ede2b79 | Python | 7,777 | 211 | import os
import sys
import pandas as pd
import numpy as np
import pcntoolkit as ptk
from matplotlib import pyplot as plt
import seaborn as sns
#%% Set globals
scriptsdir = '/project_cephfs/3022017.06/projects/hansav/Run8_fs/scripts/'
datadir = '/project_cephfs/3022017.06/projects/hansav/Run8_fs/data/'
Zdir = '/pro... |
6d499dcf8bbb61b64fcd283490aa74f1d803ae24a2df5d9460590b949e8e7c8f | Python | 7,777 | 239 | import logging
import os
from os.path import join as opj
from pathlib import Path
from string import Template
import pandas as pd
from bokeh import __version__ as bokehversion
from bokeh import embed, layouts, models
from tedana import __version__
from tedana.io import load_json
from tedana.reporting import dynamic_f... |
cdf35f23a6a6a538e3d1c9dd786a8da33fbcfc01e5d17594e7bfebdbd8f9fadb | Python | 7,777 | 174 | import torch
import logging
from torch.utils.data import TensorDataset
from sklearn.model_selection import train_test_split
from scipy.special import softmax
from agent.data.entities.config import CW_CLASS_VALUES, SENTENCES_TABLE
from agent.data.entities.config import CW_TRAIN_SENTENCE_FILTER, CW_NEW_SENTENCE_FILTER,... |
8ceddaeb357904ca1e99653b49896c3d1a72378112274fdf735f6206022e3324 | Python | 7,778 | 170 | # 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 numpy as np
from functools import lru_cache
from unicore.data import BaseWrapperDataset
import collections
import torch
from itertools import chain
from unic... |
919c6aaf23b6710b1b1cc0470a4cfc416dabacf683bfcac525c61b30e80a5dc6 | Python | 7,778 | 159 | import torch
# https://captum.ai/api/
from captum.attr import IntegratedGradients, Saliency, DeepLift, DeepLiftShap, GradientShap, GuidedBackprop, GuidedGradCam, Deconvolution, ShapleyValueSampling, Lime, KernelShap, LRP, FeaturePermutation
from typing import List, Dict
from common import DataRecord, SEED
from scip... |
cc4c5b5d1691bcdd9f4b7a90ebec2a3ef26fbd1e57259311b85bc97941bd7ea5 | Python | 7,779 | 211 | '''
Example of MBEANN in Python for solving the OpenAI Gym problem.
OpenAI Gym: https://gym.openai.com
'''
import os
import pickle
import random
import time
import gymnasium as gym
import numpy as np
from examples.gym.settings import SettingsEA, SettingsMBEANN
from mbeann.base import Individual, ToolboxMBEANN
from ... |
eefb4b90344f1e0cffafbdf1534b1641afe1323dcab730408cf55e2fec9c1971 | Python | 7,789 | 171 | import numpy as np
import torch
from torch import nn
from lop.algos.gnt import GnT
from lop.algos.gntRedo import GnTredo
from lop.algos.rl.learner import Learner
import torch.nn.functional as F
class PPO(Learner):
"""
Implementation of PPO
"""
def __init__(self, pol, buf, lr, g, vf, lm,
... |
c07fe511a17d7d76b54410821edfd7e5c2fcf34dcec389b88c47a418882ea035 | Python | 7,790 | 267 | import json
import logging
import numpy as np
from pandas import DataFrame, read_parquet
from mol2ccs.constants import ALL_ATOMS, ALLOWED_ADDUCTS, Parameter
from mol2ccs.graph import (
MyDataset,
convert_to_graph,
generate_coordinates,
get_smiles_atom_set,
)
from mol2ccs.model import (
load_model_... |
76712781a8896b8f544c9ef14e27a7c6aec2844c29229892b538606a0cace449 | Python | 7,793 | 265 | import pickle
import numpy as np
import pandas as pd
EVENT_LABEL_FPATH = '../data/high_level_events/event_annotation_timing_average.csv'
# FPS = 25
subevn2cat = {
'apply_chapstick': 4,
'apply_lotion': 4,
'bicep_curls': 1,
'blowdry_hair': 4,
'brush_hair': 4,
'brush_teeth': 4,
'clean_a_surfa... |
2e9d856b657da8a63233e560b218bb1847f2c6687120f40146e0d3ea8b759125 | Python | 7,794 | 168 | # Copyright (c) MONAI Consortium
# 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, so... |
534dd9cf9bd3cc8acfb0a21af74585d53059d6f4b282ba0e000139b72d50027e | Python | 7,796 | 177 | ####################################################################################################
# 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... |
e987ec2126e7dd3d6261d7d586a7995ec6365cee6ace75d63359eba6a00d93f1 | Python | 7,796 | 194 | import asyncio
import time
from collections import deque
from dataclasses import dataclass
from typing import Dict, List, Optional
from ray._private.telemetry.open_telemetry_metric_recorder import (
OpenTelemetryMetricRecorder,
)
from ray.core.generated import (
events_base_event_pb2,
)
from ray.core.generated... |
a6f21151473d96945be65432d130671dfcaf563881ac1c0bf8927491a663a3bf | Python | 7,801 | 204 | import numpy as np
import numpy.ma as ma
import torch
## Dataset for training
class N2VDataset3D(torch.utils.data.Dataset):
"""
dataset of a list of image stacks with the following characteristics
- different lateral image sizes
- stack size differ
"""
def __init__(self, data_list, sta... |
fcdf1cbcf904a9c9c0b664de6a768efdff3ef531c819c966c501edeee8d971aa | Python | 7,801 | 183 | import torch
torch.backends.cudnn.enabled = False
import utility
import loss
import argparse
from div2k import Flourescenedenoise
from trainer import Trainer
from torch.utils.data import dataloader
import model
def options():
parser = argparse.ArgumentParser(description='EDSR and MDSR')
parser.add_argument('-... |
842cb114386554d94f691480f2a1cb0c10eb4849cf8c7f1115694dbc5fb03be0 | Python | 7,804 | 170 | __all__ = [
'Gridding'
]
import cupy as cp
import torch
from typing import Tuple
from .utility import torch_to_cupy, cupy_to_torch, BLOCKDIM, BLOCKSIZE
ker_gridding3d = cp.RawKernel(r'''
extern "C" __global__ void gridding3d(
const float* rho,
const float* xs,
int m,
float* vol,
int n1,
in... |
d09a680daa5feeb17da6075a2560bbee79398421ef55246b5bf3b7edaa9cc6dc | Python | 7,804 | 215 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Perform preliminary aesthetic cleanup to a VCF after svtk resolve
"""
import argparse
import sys
import pysam
from svtk.utils import parse_bnd_pos
INS_ALT_INFO = [
'##ALT=<ID=INS:ME,Description="Mobile element insertion of unspecified ME class">',
'##ALT=<I... |
38d8130b33825bc30119b382c709cb83c0d3b1d825e9fcb7d8e99470f9a73289 | Python | 7,806 | 225 | """
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.
Wigner D matrices via hybrid approach (fastest method per l).
This module provides Wigner D computation using the optimal method for each l:
-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.