sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
b61cf46038793b15819657226f8ed8c86a9d4dcd0da7bc37e131e2cac7cf1e17 | Python | 4,853 | 99 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------------------------------------------------
# Author: Lalith Kumar Shiyam Sundar
# Institution: Medical University of Vienna
# Research Group: Quantitative Imaging and Medical Physics (QIMP) Team... |
f3eb6efdc8cfcc8ff59952400bac5930d323a75511a9d1b7d6a2de700e147eb2 | Python | 4,853 | 138 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
b385bb1140a4827ad24e1bad3e84017bb0d0b670a2aa221e0a1bf40a229daccf | Python | 4,856 | 144 | import os, sys
import numpy as np
import matplotlib as mpl
mpl.use("pdf")
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.misc import imresize
package_directory = os.path.dirname(os.path.abspath(__file__))
acgu_path = os.path.join(package_directory,'acgu.npz')
chars = np.load(acgu_pat... |
7e627811c115e9665d1e7495baee2019134707c2b44c5d24dc61c76b6f628c3c | Python | 4,862 | 153 | #!/usr/bin/env python
# Author_and_contribution: Niklas Mueller-Boetticher; created template
# Author_and_contribution: Kirti Biharie; added dataset
import argparse
parser = argparse.ArgumentParser(description="Load data for cosmx liver dataset")
parser.add_argument(
"-o", "--out_dir", help="Output directory to... |
705acba5203479b6429b49730a669784105dd479b52c69d4178f73ae9a8914d1 | Python | 4,864 | 146 | import torch
from scvi.distributions import Log1pNormal, ZeroInflatedLogNormal
def test_log1p_normal_distribution():
"""Test Log1pNormal distribution (log(X+1) ~ Normal)."""
mu = torch.tensor([0.0, 1.0])
sigma = torch.tensor([1.0, 0.5])
dist = Log1pNormal(mu=mu, sigma=sigma, validate_args=True)
... |
748d6fb8a06b68f2bf86aeb559e8d2da772b0219413486707a8b158b24ca539f | Python | 4,864 | 139 | import logging
import pandas as pd
import scanpy as sc
from anndata import AnnData
from .. import plot
from .._constants import Keys
log = logging.getLogger(__name__)
def domains_description(
adata: AnnData,
obs_key: str,
domain_ids: list[str],
cell_type_key: str | None,
pathways: dict[str, lis... |
84c2f95e8838a4d835e306da64713ee3daa0a5dfbce72e729215f53e4e228b46 | Python | 4,864 | 126 | from pathlib import Path
import numpy as np
import validate_cnn_reconstruction_benchmark as bench
def test_connected_metrics_uses_mask_and_largest_component():
mask = np.zeros((3, 4, 4), dtype=bool)
mask[:, 1:3, 1:3] = True
pore = np.zeros_like(mask)
pore[0, 1, 1] = True
pore[0, 1, 2] = True
... |
f15196d89750c4d4dbf6bc4ea923f0199e8fb7f063621b151126efee98d3609e | Python | 4,864 | 148 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import os
import tempfile
import unittest
import torch
from . import test_binaries
class TestReproducibility(unittest.TestCase... |
45a9ad29f4a66bd8b0153dd1172998d1febeffe6409d7e09793c4dff383b58d9 | Python | 4,865 | 108 | import argparse
import random,os,sys
import numpy as np
import pandas as pd
import argparse
import pickle
import torch
from tqdm import tqdm
import os
import sys
sys.path.append("../pretrain/")
from load import *
####################################Settings#################################
parser = argparse.Argumen... |
55bc7c13c88eaf5a875a14395b5f831b1c16ed4b350d501632d402197cfd875c | Python | 4,867 | 115 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_mdt
----------------------------------
Tests for `mdt` module.
"""
import tempfile
import unittest
import numpy as np
import shutil
import mdt
import os
from pkg_resources import resource_filename
import mdt.lib.input_data
class ExampleDataTest(unittest.TestCa... |
52fe0c6075e48e60a02e5c3ef8ca55b9f6aa5b196dda0c9c28d9f8d60266638d | Python | 4,869 | 141 | from copy import deepcopy
import mne
import numpy as np
import pytest
import pylossless as ll
def _pipeline(random_seed=97):
config = ll.Config().load_default()
config["random_seed"] = random_seed
return ll.LosslessPipeline(config=config)
def test_default_configs_define_random_seed():
"""Adult and... |
ec9aec76111c14ce3096f48d9a9c8781f820e89bde59c3cb848a1e670e85b114 | Python | 4,871 | 155 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import vtk
from dipy.viz import utils
from dipy.utils.optpkg import optional_package
numpy_support, have_ns, _ = optional_package('vtk.util.numpy_support')
def label(text='Origin', pos=(0,... |
688aaef2dbf1ed7aa277a9c19cf53e5905c135e3db3894226d8c719173ee4900 | Python | 4,872 | 173 | from .pheap import pheap as _pheap
# This wrapper exists only to add docstrings to the heap class.
# Cython cannot do this automatically at the time of writing.
# see: http://docs.cython.org/src/userguide/special_methods.html
class heap(object):
""".. note::
Using this class is not required to use
... |
ac6ad344580faae978eaad6c06b98c3c5bec869f8bd6dde6d8c3a7a577962c19 | Python | 4,872 | 136 | #!/usr/bin/env python
import argparse
from multiprocessing import Pool
from pathlib import Path
import sacrebleu
import sentencepiece as spm
def read_text_file(filename):
with open(filename, "r") as f:
output = [line.strip() for line in f]
return output
def get_bleu(in_sent, target_sent):
ble... |
d0b4179b7270c39a65fa3eb4d8eba5bd9d46f134a7b6a0d2afb7eb580c0d213c | Python | 4,879 | 142 | import os
import numpy as np
import torch
from torch.utils.data import DataLoader
from lightning.pytorch.loggers import TensorBoardLogger
from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping
from lightning import LightningModule, Trainer, LightningDataModule
from sbi.neural_nets import posterior_nn
... |
1da40195bcd0e81e26c19beccca3dfae58d4419bc36e44cc6d5eeccb8df42a19 | Python | 4,880 | 118 | """
color_model_batch.py — Batch wrapper around color_model.py for ED Fig 10e
=========================================================================
Walks a folder of IMOD `.mod` files and runs the filament-orientation
binning pipeline on each one. Calls IMOD's `model2point` to convert each
input `.mod` to text, ru... |
b1da459b9126d7269f3a87b18ab742739dc24ca98f9020e734662a15bba67dd6 | Python | 4,881 | 104 | # This extension template provides instructions to add new datasets to pgmpy.
#
# Please follow the following steps:
# 1. Copy this file to `pgmpy/datasets` and rename the file as `your_dataset_name.py` (e.g., `my_dataset.py`).
# Note: Do NOT start the filename with an underscore `_`, otherwise it won't be discovere... |
c9e588cfce555ead8dc88e25cdfd14a99332f2f8047ff6b33e1b93c39cb1e9b2 | Python | 4,881 | 128 | #!/usr/bin/env python3
"""
Author: Ken Chen
Email: chenkenbio@gmail.com
"""
import argparse
import os
import sys
import gzip
import numpy as np
import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset, Subset
#from biock import load_fa... |
006ec48d7cac4ea69d82ece0fbe7dcb0f6baf93d229b0040293e8f198fddd09a | Python | 4,885 | 114 | import pandas as pd
import numpy as np
from collections import defaultdict
import os
import sys
import argparse
"""
Use output of uniq_annot.py and files with r2 coefficients generated by plink
(e.g. chr{i}.height.2m.r2.ld.gz i=1..22) to construct ld-informed annotations.
"""
def parseArgs(args):
parser = argpar... |
4927c51236b3932807aeeabf9a5f2b09bacfc570e4d4a8b3bbf1c46f9248c543 | Python | 4,886 | 117 | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
8105aeec4be1a99eb67e6c8969923a41d55ec43021ac3ed16bb8b160ad94a9e3 | Python | 4,886 | 116 | # %%
"""Determine the subgroup-to-output orientation of each accepted model for Fig. 4.
For the ablation analysis (Fig. 4) every network is split, for each output, into a
*primary* and a *non-primary* subgroup, defined as the predefined hidden subgroup
(front = units 0..N/2-1, back = units N/2..N-1) with the higher / ... |
f3ae19d0d17bbedfd73ad342ad3400674243f623e816c947f54cbe9d29b81051 | Python | 4,886 | 118 | #!/usr/bin/env python3
"""A little utility to add some noise to training data.
.. warning::
This tool will be removed in BPReveal 6.0.
It turns out that it's not very useful.
BNF
---
.. highlight:: none
.. literalinclude:: ../../doc/bnf/addNoise.bnf
Parameter notes
---------------
input-h5
The name of... |
80fa64d5cf50780ae59af776861c005b57774af441be6a4a4acbd8b5f8b4c1be | Python | 4,887 | 87 | #!/usr/bin/env python3
"""Consolidated, reproducible download of the bulk-transcriptomic series.
727 usable expression samples across the 16 series listed below. Only 14 are declared in the
paper's Data Availability: GSE137143 and GSE211739 are processed upstream but enter no reported
analysis (see the notes on each) (... |
8f2fae500a54e7e4441f8a7e9266d80e66412497be5e4e8a93b474a3f50934aa | Python | 4,889 | 139 | import os
import sys
import time
import numpy as np
import pickle as pkl
import tensorflow as tf
from utils import *
from models import DSTG
import warnings
warnings.filterwarnings("ignore")
# Set random seed
seed = 123
np.random.seed(seed)
tf.compat.v1.set_random_seed(seed)
tf.set_random_seed(seed)
# Settings
flags... |
215838935b47c76529720375ef5e89914173fc953b54c18280d94188fc683e97 | Python | 4,891 | 139 | import random
import numpy as np
import pandas as pd
import nibabel as nb
import matplotlib.pyplot as plt
from scipy.stats import mannwhitneyu, gaussian_kde
from meld_classifier.meld_cohort import MeldCohort, MeldSubject
# Load demographics
df = pd.read_csv('/home/meldstudent/Documents/RDS_NeoHipp/altered_info5_with_n... |
11ba4fbc039d736225d85c6b031ad94e5bc77c4391be488561448e7d3ac5c1ab | Python | 4,892 | 141 | import os
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from jinja2 import Environment
from ..commons import utils
from ..datasets import EXTRA, FILENAMES
from ..globals import CurrentConfig, NotebookType, RenderSepType
from ..types import Any, Optional
from .... |
7a548fd42a829704dadb2ef92073355d97271635ba6be7bb1bb9d608e41e6cff | Python | 4,892 | 127 | #!/usr/bin/env python
# ENCODE DCC choose control wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_lib_common import (
copy_f_to_f, get_num_lines, log, ls_l, mkdir_p)
def parse_arguments():
parser = argparse.ArgumentParser(
prog='ENCODE DCC Choose contro... |
dc4afe04bd276c7f4eb195f3566f9cd4e3e638adcb769ef378d7ef8913d5db53 | Python | 4,894 | 154 | #!/usr/bin/env python3
import networkx as nx
from pgmpy.models import ClusterGraph
class JunctionTree(ClusterGraph):
"""
Class for representing Junction Tree.
Junction tree is undirected graph where each node represents a clique
(list, tuple or set of nodes) and edges represent sepset between two c... |
36f04364a59e5a79b1d7a53a66f49e94a2c191b220cd18dadef755d0781ab0ee | Python | 4,898 | 134 | from typing import Optional, Any, List
from matplotlib.lines import Line2D
from matplotlib.collections import LineCollection
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import numpy as np
from .colors import Colorizer
from ..preprocessing import div0
def _draw_edges(ax: plt.Axes, pos: np.ndarr... |
ad111512fcd637581223d7e656817e2310eb313e3adc1140ba1b76309edf836d | Python | 4,899 | 122 | # coding=utf-8
# Copyright 2019 Inria, Facebook AI Research and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... |
aeaa4903cde16b4fd6d9648d38fcda5742b725bdb68dedd7ad5be7b3577f6239 | Python | 4,900 | 123 | # coding=utf-8
# Copyright 2019 Inria, Facebook AI Research and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... |
b8bde844ed5d1b26f02b47bb535e2a69c8f26c1493edf90a68066740f1682b46 | Python | 4,904 | 158 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
import numpy as np
from scipy.optimize import minimize
import time
import os
# Use ... |
70799c63cbdc9f3267512d52921c521e85a41abde31c1a9ba0c4e4878631aa0b | Python | 4,907 | 167 | """Audit PE dependencies and duplicate DLLs in a frozen GPU distribution."""
from __future__ import annotations
import argparse
import hashlib
import os
from pathlib import Path
import sys
import pefile
from windows_pe import audit_x64_tree
SYSTEM_DLLS = {
"advapi32.dll",
"bcrypt.dll",
"cfgmgr32.dll",
... |
edf20497c022b76f3c6021276e16c59b287d3b4ca2432b75debc6634998bbdfd | Python | 4,907 | 159 | #!/usr/bin/env python
# ENCODE DCC BAM 2 TAGALIGN wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_lib_common import (
assert_file_not_empty, log, ls_l, mkdir_p, rm_f, run_shell_cmd,
strip_ext_bam, strip_ext_ta)
from encode_lib_genomic import (
samtools_name_s... |
6cc3eea4c9a6e4c1ba5619b1cf12ea716c1add17f0b89b2b8b45c0a7461dfe8d | Python | 4,909 | 137 | """Controller for telemetry table setup, sorting, and population."""
from __future__ import annotations
from typing import ClassVar
from PySide6.QtWidgets import QFrame, QVBoxLayout
from src.gui.framework.qt_view_styles import panel_stylesheet
from src.gui.framework.tk_style_table import TkStyleTable
class Teleme... |
c4cb006682a40f2d88759a4bcabf0d4be623720b135c71447f1788d17ea23d0f | Python | 4,911 | 130 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
b3ccfa15af2d9f3e9c1a1d8abcc76b80ce40666fde5e79179c63450d88012712 | Python | 4,913 | 125 | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
04cde29e5f07a7f409a324514d7d56bd233d7578f56877eec68196423728ae15 | Python | 4,917 | 142 | #!/usr/bin/env python
"""Calculate each training protein's maximum TM-score against CASF-2016.
Download or compile US-align separately, then provide the executable using
``--usalign``. Existing rows in the output CSV are retained, allowing the
calculation to resume after interruption.
"""
from __future__ import annota... |
7b59ef703bab929d7ca78e42b3441fc57963fd2474af76af3d2d1b7e2b45d4d7 | Python | 4,918 | 142 | import os
import torch
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
from torch_geometric.loader import DataLoader
from sklearn.metrics import mean_absolute_error, mean_squared_error
from scipy.stats import pearsonr
from tqdm impor... |
8149b6ea830cc7a9c46b397ab7a4c45426c04ea50eff8521e7cfa013f2796d20 | Python | 4,918 | 171 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import collections
import io
import json
import librosa
import numpy as np
import soundfile as sf
import time
import torch
from scipy.io.wavfi... |
ec8e6ec0aa8d8ddc9ed778f7eaf8c1c93034c9dd93fdec0708bf30c20f9e3b83 | Python | 4,918 | 146 | """A frozen run with no embeddings store says what it is paying for.
`unfrozen_top_layers = 0` makes the trunk's output constant, so every epoch
after the first recomputes what it already computed. Nothing failed, so only
a warning distinguishes that run from one reading a store; these pin that it
is emitted where the... |
0bc5155e8ffc481153483b0254fad1caa0a1c4596f47ca6f8d2d4a31915f9dc9 | Python | 4,923 | 133 | import pathlib
import pytest
import vak.config.dataset
class TestDatasetConfig:
@pytest.mark.parametrize(
'path, splits_path, name',
[
# typical use by a user with default split
('~/user/prepped/dataset', None, None),
# use by a user with a split specified
... |
ef63bc06c41d185da44152e8d1dfdb9405bb53c570b4cadbce4ac2c7b3c8aea4 | Python | 4,923 | 145 | import numpy as np
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
[
"#1f77b4",
"#9edae5",
"#98df8a",
"#bcbd22",
"#d6... |
45b295c67be486df96321f93e7a65ee447ebb7681b7ce231e112bbeb69885606 | Python | 4,924 | 142 | from anndata import AnnData
from mudata import MuData
from scvi import REGISTRY_KEYS
from scvi.data import AnnDataManager
from scvi.data._constants import _MODEL_NAME_KEY, _SETUP_ARGS_KEY
from scvi.data.fields import (
CategoricalJointObsField,
CategoricalObsField,
LabelsWithUnlabeledObsField,
LayerFie... |
9492b7fb45e9c04b49b52ad913beae04d77b5ee6091a5c16becdd99b1bd3e595 | Python | 4,925 | 146 | import numpy as np
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
[
"#1f77b4",
"#9edae5",
"#98df8a",
"#bcbd22",
"#d6... |
c82787a08a5d2a862d1b2ded03ae0f58a7160d8f654a31b2a8a599d6c81c1ffe | Python | 4,925 | 139 | import os
from typing import Tuple
# disable numpy multithreading
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
import numpy as np
from scipy import stats
from scipy im... |
f92e732e3cda4c755da588971f2a3baddb82e264a30860bcff47f61b613f705e | Python | 4,927 | 164 | import uuid
from jinja2 import Environment
from ... import types
from ...commons import utils
from ...globals import CurrentConfig, ThemeType
from ...options.charts_options import TabChartGlobalOpts
from ...render import engine
from ..mixins import CompositeMixin
DEFAULT_TAB_CSS: str = """
.chart-container {
di... |
d352c677b82dd0b8781cc00b6c1167117542619b670e746d33c81e971adfc162 | Python | 4,928 | 147 | import numpy as np
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
[
"#1f77b4",
"#9edae5",
"#98df8a",
"#bcbd22",
"#d6... |
8331d9d06376012e357bbfcbe110018fcedb440c91bb16cb15b69c9417d42535 | Python | 4,929 | 118 | """Manage GOATOOLS GOEA namedtuples."""
__copyright__ = "Copyright (C) 2010-2018, H Tang et al., All rights reserved."
__author__ = "DV Klopfenstein"
import collections as cx
from goatools.rpt.nts_xfrm import MgrNts
def get_study_items(goea_results):
"""Get all study items found in a GOATOOLS GOEA (e.g., geneid... |
e8162500aac4e7d4e6de037af636e864d99d80ec1898fd16d43cc47a219ad4f5 | Python | 4,929 | 142 | import torch
from ..nn.modules import Conv2dTF, NormReLU
class ED_TCN(torch.nn.Module):
"""Encoder-Decoder Temporal Convolutional Network.
As described in [1]_.
Note that this network adds convolutional layers on the front end
to provide features fed into the ED-TCN described in [1]_.
This impl... |
808c702ed19e10d6393f5135cd75250abb47088acedcc9bad5fa36dd411e0db1 | Python | 4,931 | 140 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
from .multihead_attention import MultiheadAttention
class SparseMultiheadAttention(MultiheadAttention):
"""Sp... |
767e744e4f5d05ed301c4a8797600a001a9364a0db20cc5b1161b5d12c38f008 | Python | 4,933 | 116 | #!/usr/bin/env python3
"""Trains up a residual model to remove an uninteresting signal from an experiment.
BNF
---
.. highlight:: none
.. literalinclude:: ../../doc/bnf/trainCombinedModel.bnf
Parameter Notes
---------------
Most of the parameters for the combined model are the same as for a solo
model, and they ar... |
3a7fedec2551f8c8562c3626ae2c66a86993434fa529ad8312086c7bfcea0786 | Python | 4,934 | 135 | import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
from sklearn.manifold import TSNE
import os
import loompy
from .colors import colorize
from cytograph.embedding import art_of_tsne
def plot_all(ds: loompy.LoomConnection, out_file: str, labels: np.array = None, doublet_score_A: np.array = Non... |
c668720dd8768976f9ee491497383b0f51407152dde6f5044e0eda2d91fa7c59 | Python | 4,935 | 138 | """Assign samples in a dataset to splits.
Given a set of source files represented by a dataframe,
assign each sample (row) to a split.
Helper function called by :func:`vak.prep.frame_classification.prep_frame_classification_dataset`.
"""
from __future__ import annotations
import logging
import pathlib
import panda... |
b73f25cab6467b369e69a71c164f02095e5cfe0a2a6e8bb38fb0cc3fc9788391 | Python | 4,936 | 151 | # Copyright 2026 Hongyu Sun
# Licensed under the Apache License, Version 2.0
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
import pytorch_lightning as pl
from model import GNO,FNO1D
class QNO(pl.LightningModule):
def __init__(self, modes: int = 24, width: int = 48, lr: float... |
b4891f6929053b050e10031d657eeedba6c00f786af2e3570f5affd6d4f7e9d4 | Python | 4,939 | 145 | import numpy as np
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
[
"#1f77b4",
"#9edae5",
"#98df8a",
"#bcbd22",
"#d6... |
d64d5fc41dd8deeac73e96d0e9ab6a2a1e327cae98cff545311604e6b5684aa1 | Python | 4,939 | 118 | import torch
import torch.nn as nn
from ..gnn.embeddings import MAX_ATOMIC_NUM
def build_mlp(in_dim, hidden_dim, fc_num_layers, out_dim, drop_rate=0):
mods = [nn.Linear(in_dim, hidden_dim), nn.ReLU()]
if drop_rate > 0.:
mods += [nn.Dropout(drop_rate)]
for i in range(fc_num_layers-1):
mods ... |
02aa27f3dfb9b9b2a37e2ae2f6e3f55d6900c631d5fc07c769299b2371d356a1 | Python | 4,940 | 139 | import os
import yaml
from easydict import EasyDict
from utils.constants import sequence_level
from utils.file_reader import FileReader
from utils.faiss_index import FaissIndex
from tqdm import tqdm
from typing import List
ROOT_DIR = __file__.rsplit("/", 5)[0]
config_path = f"{ROOT_DIR}/demo/config.yaml"
def load_... |
2f3552fe6e29c3c8447769dfbad845b88c692e788f38fb82e4a1a22276c57e92 | Python | 4,940 | 167 | import sys
sys.path.append("../")
import time
import random
import numpy as np
import os
from neuron import gui, h
from neuron.units import ms, mV
from matplotlib import pyplot as plt
from openpyxl import Workbook, load_workbook
import singleCell.morphology as morphology
start_time = time.perf_counter()
def stim_... |
92aa9b6150d4102d01bbd4712a9340371590384fa4c70ae99c248c020e8d7f60 | Python | 4,940 | 133 | """
Utility modules for PyTorch Lightning systems.
Contains shared components like normalization modules used across
pretraining and downstream tasks.
"""
import logging
from typing import Optional, List, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
class NormalizationModule(nn.Module):
... |
3ec8cf0bd25b342e0f57013b668a6f03f13c22a53759a690bbf645a9090088b4 | Python | 4,941 | 131 | #!/usr/bin/env python
# Written by Olga Botvinnik with subsequent reworking by Jonathan Manning and Nico Trummer.
# MIT License
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without rest... |
96a50076f5d985a44ade727cf55ba26012905b440a6348ce9f0d789520c33c6e | Python | 4,941 | 145 | import os
from pathlib import Path
import gzip
from typing import List
import datasets
from Bio.SeqIO.FastaIO import SimpleFastaParser
_CITATION = """\
@InProceedings{crispr_fasta_ds,
title = {CRISPR 30mer FASTA dataset loader (per dataset/set/split)},
author = {lt},
year = {2025}
}
"""
_DESCRIPTION = ""... |
2a7a0a37b718cb0e00810e6a8270860cbe05982a06c01ba9dd87b0bf503f2f2d | Python | 4,942 | 153 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
from .idevice import EmptyDevice
from abc import ABC, abstractmethod
from simulator.bac... |
3fea52cfe1210c88a430d788c189bb55ba4f9b91a7b3eecdbd0e196c7c4bd0f4 | Python | 4,943 | 76 | # call py.test from <PROJECT_ROOT> folder.
import os, sys
sys.path.append(os.getcwd())
import pandas as pd
import numpy as np
from scipy.sparse import coo_matrix
from precimed.common import libbgmg
def print_and_assert_below(threshold, message, value):
print(message, value)
assert(value < threshold)
# py.tes... |
ca2ebdc931a5f4cf659b34a893c11e50a90fecc174d27affdaad16aed13f34e2 | Python | 4,943 | 127 | from itertools import permutations
from typing import Dict
import pandas as pd
from sklearn.metrics import auc, roc_curve
from BLEval.evaluator import Evaluator
from BLEval.data import EvaluationData
def _compute_auroc(
ranked_edges: pd.DataFrame,
gt_df: pd.DataFrame,
) -> float:
"""
Compute the are... |
a85d9b836e84b829602770245350fc8c2f370917f4e4c42867e557407d573e13 | Python | 4,945 | 161 | """Command-line entry point for the HIPPIE package (``hippie-cli``).
Self-contained: every subcommand operates on the installed ``hippie`` package
only and performs no network access. Subcommands:
hippie-cli version Print the installed package version.
hippie-cli info Print package info and ben... |
56bdc7e7a838f080c4fbcf4b116b196f9405d6e9736631e23f8fcb087e5c5ded | Python | 4,946 | 142 | import numpy as np
import torch
import torchvision
class ClassifierOutputTarget:
def __init__(self, category):
self.category = category
def __call__(self, model_output):
if len(model_output.shape) == 1:
return model_output[self.category]
return model_output[:, self.categor... |
36dcf08d12289243a3df16a9dd558c08e3a6d222a3328795f57d3f78defa92df | Python | 4,949 | 146 | '''
Add `extra_repr` into DropPath implemented by timm
for displaying more info.
'''
import torch
import torch.nn as nn
from e3nn import o3
import torch.nn.functional as F
def drop_path(x, drop_prob: float = 0., training: bool = False):
"""Drop paths (Stochastic Depth) per sample (when applied in main ... |
a4db301c73ff0872d4b08846db7364f841c6c964c1b68052a0a8cab0c1350683 | Python | 4,950 | 129 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
import math
import torch
class PositionalEncoding(nn.Module):
"""Positional encoding.
Args:
d_model: ... |
362daf5bb92358c36935a308d4f32240b9c1d3ee5d4b2e5a9ada503b4cb44e62 | Python | 4,954 | 139 | """Masking the class head's logits in place must not change the answer.
`forward` in `ete.py`, `entity_linking.py` and `ner.py` used to build a
second full-size `[document, token, classes]` tensor with
`torch.where(token_mask, unmasked_class_logits, self._neg_inf)`, keeping the
unmasked tensor alive with no reader lef... |
c13ac909ad832cfd02ce2dce09b77b48b901877130320dcbfecd5815978311fb | Python | 4,955 | 134 | import numpy as np
import pandas as pd
from scipy import stats
from sklearn.cross_decomposition import CCA
from pgmpy.utils import preprocess_data
from ._base import BaseCITest, _CITestResult, _ResidualMixin
class HotellingLawley(_ResidualMixin, BaseCITest):
r"""
Hotelling-Lawley trace CI test for mixed dat... |
473e7c76fd609eedbdb23b1e8d777e59328decc585e4d957175d8dbab8522fad | Python | 4,956 | 131 | """Utilities for combining namedtuples."""
__copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang. All rights reserved."
__author__ = "DV Klopfenstein"
import sys
import datetime
import collections as cx
def get_dict_w_id2nts(ids, id2nts, flds, dflt_null=""):
"""Return a new dict of namedtuples by co... |
c33f45d89adc3e0e1b6aec5e30ab6f9a031e208885357e79b127366020a0a3ae | Python | 4,956 | 148 | import pytest
from sofa.models.SOFA import SOFA
import torch
from muon import MuData
import numpy as np
def test_SOFA_initialization():
Xmdata = None
num_factors = 10
Ymdata = None
design = None
device = "cpu"
horseshoe = True
update_freq = 200
subsample = 0
metadata = None
verb... |
e8bbd92335a710984ba1130b632e012e15e56d6cd4a8b0df1db1f2c1bc172e7e | Python | 4,956 | 150 | from __future__ import annotations
import platform
import sys
from typing import TYPE_CHECKING
import pytest
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import parse_constraint
from poetry.utils.env.python import Python
from tests.helpers import pbs_installer_supported_... |
15a6f8db31397f7b48967103e07f20a3eb39bd61dbbf4928216894856f701371 | Python | 4,957 | 173 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from ..initializers import he_orthogonal_init
class EfficientInteractionDownProjection(torch.nn.Module):
"""
Down pro... |
15ad46759c5fae868b158eaa6115d4b98d50cfd515f1b5a4fdca3f410864bd4c | Python | 4,957 | 162 | import json
import os
import numpy as np
import os
from pathlib import Path
import random
import scipy.stats
import sys
import tensorflow as tf
import transistor_extract as TE
dir_path = os.path.dirname(os.path.abspath(sys.argv[0]))
repo_root = Path(__file__).r... |
44dd7638fd3340fd5a9b509fc01aeb9ed481ab1447179141540077b031c21b7e | Python | 4,958 | 125 | import torch
import torch.nn as nn
import copy
from .so3 import SO3_Embedding
from .radial_function import RadialFunction
class EdgeDegreeEmbedding(torch.nn.Module):
"""
Args:
sphere_channels (int): Number of spherical channels
lmax_list (list:int): List of degrees (l) fo... |
9f847ab489cbe6745a54b1c0dcd47b414e12652e51e83d34610c075c6425c690 | Python | 4,966 | 165 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import torch
from omegaconf import OmegaConf
from fairseq.criterions.model_criterion import ModelCrit... |
b8545a909042efab47135d6811266eb379fe62895a3862745434395573107d8d | Python | 4,966 | 164 | from typing import NamedTuple
import torch
from torch import nn
from scvi.module.base import BaseModuleClass, LossOutput
class _TANGRAM_REGISTRY_KEYS_NT(NamedTuple):
SC_KEY: str = "X"
SP_KEY: str = "Y"
DENSITY_KEY: str = "DENSITY"
TANGRAM_REGISTRY_KEYS = _TANGRAM_REGISTRY_KEYS_NT()
EPS = 1e-8
def _... |
d4e4ad13cd6621d9d168453bbb44b1d9cde6f70e1924c12e775aafcd602dc7dd | Python | 4,966 | 135 | import math
from typing import Dict, Tuple
import haiku as hk
import jax
import jax.numpy as jnp
from ...geom import norm
from ...types import MolecularConfiguration
from ..nn.initializers import DeterminantApproxEqualInit
from ..nn.masked.basic import MultiDimLinear
from .base import OrbformerBase
def evaluate_se_... |
617bcf164db27263724929245d6b46f24d4d8359d63d151c866de0651a8529cd | Python | 4,968 | 144 | """S800's coordinate convention, pinned against the corpus's own surfaces.
The corpus writes `end` inclusive and this package's spans are half-open, so
the loader adds one. Nothing about that is visible in a score: read half-open,
every span loses its last character, matches a slightly different dictionary
entry, and ... |
fec04acddfd6e545e64f7d5700af23c7ad800da4da98836e1b6307db24a2c588 | Python | 4,968 | 105 | import argparse
import random,os,sys
import numpy as np
import pandas as pd
import argparse
import torch
from tqdm import tqdm
import os
import scipy.sparse
import sys
sys.path.append("/nfs_beijing/minsheng/scbig/bioinfoDownStream/pretrain/")
from load import *
####################################Settings##########... |
615b43e025eb6c4d1e35ccb8d65018ccd239a6369529d8e061024d67efdd1b31 | Python | 4,969 | 126 | from itertools import permutations
from typing import Dict
import pandas as pd
from sklearn.metrics import auc, precision_recall_curve
from BLEval.evaluator import Evaluator
from BLEval.data import EvaluationData
def _compute_auprc(
ranked_edges: pd.DataFrame,
gt_df: pd.DataFrame,
) -> float:
"""
Co... |
a84b8634024ab3ac4dbbff3deeeb5b4c85b166d724ffee1669ed142f0201d668 | Python | 4,969 | 99 | from pathlib import Path
def apply_app_theme(widget):
from GMXMMPBSA.analyzer.style.app_theme import apply_app_theme as _apply_app_theme
return _apply_app_theme(widget)
def polish_table(*args, **kwargs):
from GMXMMPBSA.analyzer.style.app_theme import polish_table as _polish_table
return _polish_tabl... |
b78010225da61ef07be3985a74f2c975d256e8162804a9d50efc5dbe70084873 | Python | 4,970 | 159 | from __future__ import annotations
import numpy as np
import pandas as pd
def row_normalize(values: np.ndarray, eps: float = 1e-8) -> np.ndarray:
values = np.asarray(values, dtype=float)
row_sums = values.sum(axis=1, keepdims=True)
row_sums = np.where(np.abs(row_sums) < eps, 1.0, row_sums)
return val... |
04c69252b431b0804ac111fe9b6369e36777bed9f1cd6800cd62ae7b15c3d676 | Python | 4,971 | 166 | """
High-level read/write functions for several formats.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from vtk import (vtkPLYReader, vtkPLYWriter, vtkXMLPolyDataReader,
vtkXMLPolyDataWriter, vtkPolyDataReader, vtkPolyDataWriter)
from ..vtk_interface.io_support i... |
fca62ad85099d9803a393ac41a6beadf89bb8360d9f4d3e4f9b7ac09f5e5609c | Python | 4,971 | 124 | from __future__ import annotations
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QFrame,
QGridLayout,
QHBoxLayout,
QLabel,
QPushButton,
QSizePolicy,
QWidget,
)
from src.gui.framework.qt_view_styles import (
apply_button_role,
panel_stylesheet,
section_stylesheet... |
2b1366f4a55056fb455f91fb5a9e64bdd5169346f8819adfb6da34c1fcbe1c51 | Python | 4,976 | 140 | """Put the arms' detection scores side by side, one table per entity type.
The report is a table and not a verdict. The question is what the recall lever
costs in precision, and which way `other_organisms` moves now that its
surface forms carry abbreviated genera; both are tradeoffs to be read, not
thresholds to be pa... |
c3ef7f62f8d676b32e7acb58bcced8edab33fe233bf6a919410e011fd399d49c | Python | 4,978 | 152 | # 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:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
31be93603e1bbe9d3fe13e300deb4721c18fd502ae499e0244e28d6dd222a5bd | Python | 4,982 | 133 | import jax
import jax.numpy as jnp
def norm(
x: jax.Array, axis: int = -1, keepdims: bool = False, *, squared: bool = False, eps=1e-26
) -> jax.Array:
"""Compute the norm of a vector and guarantee numerical stability in the backward pass.
Args:
x (jax.Array): vector
axis (int): optional, ... |
d628a8338ce10b398f389a3b74bee6ec4bccd872c655857449d541d6172c3697 | Python | 4,983 | 107 | #!/usr/bin/env python3
"""Sorted-cell WGBS promoter assessment (GSE173787), Methods 4.4 and Results 2.4.
WHY THIS EXISTS. Methods describes this analysis and Results reports its outcome, but no script in
the release performed it, so the reported numbers could not be re-derived from the deposit.
WHAT IT DOES. GSE17378... |
91ea11985bb16af1a17edfd128a3c2554b6fec3a7b1541d023e8d355990e9ce7 | Python | 4,984 | 147 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..ops import emulate_int
class IntEmbedding(nn.Module):
"""
... |
3b290a20debb6cce5fa48eb851469b31652bcf807f4670e3afdfe50d85e7a90d | Python | 4,987 | 180 | from typing import Optional
import torch
from torch import Tensor
from examples.simultaneous_translation.utils.functions import (
exclusive_cumprod,
prob_check,
moving_sum,
)
def expected_alignment_from_p_choose(
p_choose: Tensor,
padding_mask: Optional[Tensor] = None,
eps: float = 1e-6
):
... |
5ec85cb3913793b7097cb138a8f93f8818af07c894a8036db0edb5f7ae2093cd | Python | 4,987 | 120 | import os
import typer
from typing_extensions import Annotated
import voluseg
from voluseg._tools.aws import export_to_s3
app = typer.Typer()
@app.command()
def run_pipeline(
detrending: Annotated[str, typer.Option(envvar="VOLUSEG_DETRENDING")] = "standard",
registration: Annotated[str, typer.Option(envvar="V... |
fa277dbcb896fd683beb5ebb52d9570713e8725b9f4d72fbaa7e7fd1f2130cbf | Python | 4,987 | 124 | from __future__ import annotations
import numpy as np
from sklearn.linear_model import LinearRegression
from pgmpy.factors.continuous import LinearGaussianCPD
from pgmpy.models import LinearGaussianBayesianNetwork
from .base import GaussianParameterEstimator
class LinearGaussianMLE(GaussianParameterEstimator):
... |
2edfb74bc60bfc32eeb482d4a17999d8ccc808d9261f53f1ffe084104d8f9756 | Python | 4,989 | 122 | """
Run this script to crop images + segmentations to brain area. Then save as nifti.
Reduces datasize and therefore IO by at least factor of 2.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from os.path import join
import nibabel as nib
im... |
2c89175bfa4e3becc5257fe17c2b6f296a599775956635d1fad5dc9d50f58210 | Python | 4,993 | 141 | from __future__ import annotations
from itertools import chain
import numpy as np
from joblib import Parallel, delayed
from pgmpy.factors.discrete import TabularCPD
from pgmpy.utils import get_state_counts
from .base import DiscreteParameterEstimator
class DiscreteMLE(DiscreteParameterEstimator):
"""
Comp... |
619592fa78c1453695424c5d5b40fec09b340c4ae7d5933e954bb3c82f70ffcb | Python | 4,993 | 132 | # @license
# Copyright 2020 Google 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 to in... |
9b5d5b108f2cb2ad6fe3d2a3a27146788913a9866abe7698525c54edbe3e25d5 | Python | 4,993 | 127 | #!/usr/bin/env python
"""Build the BRENDA-strain -> culture-number table the linking score reads.
A pure identifier join, like the enzyme bridge and unlike the organism one:
`cultures[].strain_number` is StrainInfo's cached record of where a strain is
deposited, and `designations` sometimes carries the same kind of de... |
01f490bc4590cc4dac355bd86425c003ed61710109297d2785c6d7153cf1f337 | Python | 4,994 | 154 | from types import SimpleNamespace
from typing import Any, List
import numpy as np
import loompy
from .human import TFs_human, cc_genes_human, g1_human, g2m_human, s_human
from .mouse import TFs_mouse, cc_genes_mouse, g1_mouse, g2m_mouse, s_mouse
class Species:
@staticmethod
def detect(ds: loompy.LoomConnection) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.