sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
183b54c87c31085cfaa67de732a4beed7293e6649131e0a84cc98ac47727c0e7 | Python | 12,697 | 294 | import os
import pandas as pd
import numpy as np
import zipfile
from scipy import interpolate, signal
from joblib import Parallel, delayed
from pynwb import NWBHDF5IO
class Neurocurator:
def __init__(self):
self.waveforms = None
self.spike_times_train = None
self.sampling_rate = None
... |
d4520499375c6466675192bbc7ba9f16c33c015673b433493c7c03c1367e3b88 | Python | 12,697 | 303 | import math
from tqdm import tqdm
import numpy as np
import torch
from math import sqrt, log
from . import data_utils, FairseqDataset
from itertools import chain
import json
import random
from collections import defaultdict
class ParagraphInfo(object):
def __init__(self, dictionary):
self.dictionary = dict... |
e07cee86940b5b096e7371a7a65b3a46eed61c66f67d2a41a8fafd10d72dd5d8 | Python | 12,700 | 348 | from collections.abc import Iterable
from typing import Literal
import numpy as np
import torch
from torch import nn
from torch.distributions import Normal, kl_divergence
from scvi import REGISTRY_KEYS
from scvi.module.base import BaseModuleClass, LossOutput, auto_move_data
from scvi.nn import Encoder, FCLayers
cla... |
48fa0b81b31edcf7d97bd40e64f6f3f2951d0c4d0e9d9f5a1d2da41c6b53e9e4 | Python | 12,702 | 300 | """Phase 13 — extend universality test to (a) Ge Tersoff and (b) 3D cubic.
(a) Ge with Tersoff PRB 1989 (Ge.tersoff): 3rd material, between C
(light, 4-valence, sp²/sp³) and Si (heavier, 4-valence, sp³ only).
Covalent radius / vdW radius slightly larger than Si.
Bond length a₀ = 2.45 Å (diamond Ge)... |
e90031a520913841841a12d655a3c08fd676dd3aa9693adc2c49b6ac43ea6dc9 | Python | 12,703 | 272 | import json
from pathlib import Path
import sys
import tempfile
import unittest
from unittest.mock import patch
import zipfile
import nibabel as nib
import numpy as np
MODULE_DIR = Path(__file__).resolve().parents[1]
REPO_DIR = MODULE_DIR.parent
COLAB_DIR = REPO_DIR / "ColabNotebooks"
for path in (MODULE_DIR, COLAB_... |
acc89f99f4f7a8e9331d8d6e9bd02d57f475b30dc74b9e0533eae59e829bd89b | Python | 12,711 | 340 | """Reading the raw document corpus.
`document_text` is the single place a corpus row becomes a string, so the two
precompute stages cannot describe the same document differently. Deliberately a
leaf: importing `d3text.data` would drag the whole BRENDA stack in to read csv
and json rows that need none of it. See the da... |
4fc0ffa1697ffea27ef7bc6633870d926ddcf7536aaf69ad8f7a666e7ffcbb32 | Python | 12,712 | 225 | #!/usr/bin/env python3
# MIT License
#
# Copyright 2024 Broad Institute
#
# 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 restriction, including without limitation the rights
# to u... |
0c2dcbf3e782456feb5e1b7b49977e9d8e30b703100b02e3bf16a8112913ca27 | Python | 12,717 | 319 | """The BRENDA corpus, declared as a `Schema` and indexed from it.
`BRENDA_SCHEMA` is the single place that says which entity types the corpus
carries and which prefix their IDs wear; the column list, the ID prefixes, the
class column order and the per-document class labels are all derived from it.
"""
import os
impor... |
f94203634431d36a7384710defe55b742aba187118e74707b0a8b1fac24d6175 | Python | 12,719 | 356 | # 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 itertools
import logging
import os
import sys
from typing import Any, List, Optional, Union
import numpy as np
import torch
import to... |
ee5956587310af857198c8faa41385c02e619f76ee261c07db055977dd2badaf | Python | 12,722 | 312 | # *****************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions... |
7c2f5d39c8b9daa038860e6a2ba1e8c858c589e81fe666a2ab0739990e5b8e4b | Python | 12,726 | 250 | """Page 3: Stability & Sensitivity."""
import streamlit as st
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
import numpy as np
from utils import PIPE_ORDER, PIPE_COLORS, COOL_LIGHT_SEQUENTIAL, style_figure
def render(store, dataset):
st.header("Selection Sensitivity")
st.m... |
159fa2188b830d86927acff3d534e0668d249eadf12af4bed32ba3f62f6508b8 | Python | 12,727 | 321 | import os
import math
import time
import torch
import argparse
import numpy as np
from src.ernie_rna.tasks.ernie_rna import *
from src.ernie_rna.models.ernie_rna import *
from src.ernie_rna.criterions.ernie_rna import *
from src.utils import load_pretrained_ernierna, prepare_input_for_ernierna, ChooseModel, read_fasta_... |
1a950c0316a7d202457984a14f3951eb83410415f114ee8010994e385864bd91 | Python | 12,740 | 342 | #
# 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
#
"""
This script builds a ResNet50-v1.5 Keras model with weights loaded from a separate fil... |
d209fcbcbc95beb1b3a2cf5640ed523a61e021a7e9d662d5a4d41e416144ab47 | Python | 12,741 | 385 | """
Optimized spatial graph construction for Garfield.
Key optimizations:
1. Vectorized distance computations
2. Efficient sparse matrix construction (avoid networkx overhead)
3. Parallel batch processing
4. Memory-efficient algorithms
5. Optional GPU acceleration via cupy (if available)
Performance improvements: ~5-... |
efabc8180405423ecf2f7f5d0a76dd8bde86473d7c705c67b26df0095aa150ee | Python | 12,745 | 336 | import torch
import torch.nn as nn
from ..registry import registry
from .modeling_utils import ProteinConfig
from .modeling_utils import ProteinModel
URL_PREFIX = "https://s3.amazonaws.com/songlabdata/proteindata/pytorch-models/"
TRROSETTA_PRETRAINED_MODEL_ARCHIVE_MAP = {
'xaa': URL_PREFIX + "trRosetta-xaa-pytorc... |
b108baa3dc29aa23afbc5a061bacd470af94bec24d45b1c943372811c2e814a6 | Python | 12,746 | 359 | # 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 logging
from pathlib import Path
from typing import Dict, List, NamedTuple, Optional
import torch
from fairseq.data import ConcatData... |
0be9b0f8b0e5f1cd9c055ffec6bf573695811509f1a2f340c49a1760f65da138 | Python | 12,759 | 366 | import logging
from typing import Tuple, Any
import numpy as np
from numba import jit
from pynndescent import NNDescent
from scipy import sparse
from sklearn.neighbors import NearestNeighbors
from cytograph.metrics import jensen_shannon_distance
@jit(nopython=True)
def balance_knn_loop(dsi: np.ndarray, dist: np.nda... |
6783b8fcf2f6fd6c770668c29b233d8357ad08576191eb0d6e7e91d5d0eff85f | Python | 12,767 | 346 | import copy
import json
import os
from pathlib import Path
import random
import sys
import matplotlib as mpl
#mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from .utils_misc import unscale_vector
root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__... |
e5471d3fb21745212d90b135e4a3067bc8ed6384107feea2fa2edb912d12b8d6 | Python | 12,770 | 379 | __author__ = 'heroico'
import os
import logging
import weakref
import tkFileDialog
import tkMessageBox
import Tkinter
from subprocess import call
from threading import Thread
import metax.MainScreenView as MainScreenView
import metax.MetaXcanUITask as MetaXcanUITask
import metax.Exceptions as Exceptions
import MetaXca... |
e7150d0f927f4c3f5029568c6b2de20003738870573b8f931f1c59e398f08c2c | Python | 12,788 | 312 | import hashlib
import shutil
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from types import SimpleNamespace
from unittest.mock import patch
from GMXMMPBSA.exceptions import MMPBSA_Error
from GMXMMPBSA.make_trajs import Trajectory
try:
import parmed
except ImportError: # pragma... |
977a1ce3570a383af79108d90af26925866cd10d2e813a8468bc9bf19500db85 | Python | 12,789 | 306 | """
CID (Cell-type Integrated Gradients) attribution.
Gene-stacking with Monte Carlo noise sampling at grid resolution.
Pure FP16 + channels_last for VRAM efficiency on Ampere+ GPUs.
"""
import collections
import math
import time
import torch
MAX_CONCURRENT_SAMPLES = 600
def compute_CID(
net,... |
5d8340d5f7ca7d90de83c1e6a1181821e8a9de3448da99152efdb1a4d964b06a | Python | 12,790 | 285 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
from os.path import join
import importlib
import numpy as np
import torch
import torch.nn as nn
from torch.optim import Adamax
from torch.optim import Adam
import torch.optim.lr_scheduler... |
25b1c1059f5745acfa6fdf3eeb51f62ac548f16f5a662b1b38158e2f969b344f | Python | 12,795 | 372 | """The divisor of the masked token loss.
Nothing consumes `masked_token_cross_entropy` yet — the tagger head that will
read the distant-supervision targets is a later piece of work — so these are
the only thing standing between the divisor and the trap it exists to avoid.
"""
import pytest
import torch
from d3text.mo... |
bf3a3d3ac096f4f2ef3dbbe2450f7db6e35ed5db874d94f76ff662a754847905 | Python | 12,797 | 325 | import copy
import logging
import sys
import types
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from types import SimpleNamespace
from unittest.mock import patch
import numpy as np
from GMXMMPBSA.amber_outputs import NMODEout
from GMXMMPBSA.exceptions import InputError
from GMXMMPB... |
d5afa841e489e590e8cee5f01aedbf06537019287a38d581aa90b93682cbfa91 | Python | 12,797 | 318 | """
sep_capacity.py
===============
Separation capacity analysis for the driven reservoir sweep.
Computes per (g, η, ε, seed):
PR_driven — participation ratio (Σλ_i)² / Σλ_i² of the driven population
covariance eigenspectrum. Measures effective dimensionality
of the reservoir's respo... |
7de074eb8fc7c86570949a175838b655928e8ee26403d5a10f13b5af8529eb9f | Python | 12,798 | 291 | """Build a perovskite structure library for OCE feature evaluation.
Inorganic ABX3 perovskites with A in {Cs,K}, B in {Pb,Sn,Ge}, X in {I,Br,Cl,F}.
Three families:
(a) endmembers — 5-atom cubic Pm-3m primitive cells, 24 ABX3 combinations
(b) mixed-X — 2x2x2 supercells (40 atoms) with 1-12 halide substitutions
... |
5e6ad2c3a89a3470ee8cf92af24affae3f367a01bcd3a69ca85d9d99af7cbb26 | Python | 12,799 | 348 | import numpy as np
import pdb
import os
import h5py
import random
from sklearn.model_selection import StratifiedKFold
import math
import time
from matplotlib import pyplot as plt
# import seaborn as sns
import pandas as pd
plt.switch_backend('agg')
import glob
import pdb
import argparse
import sys
d... |
c5dae11b630c0373d2eed8653021286902ab3b341377d6fb7e39d8071a93cd4b | Python | 12,821 | 296 | from __future__ import annotations
import json
import subprocess
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any
import numpy as np
import pandas as pd
from st_risk.data.harmonize import choose_reference_celltype_column, intersect_gene_names
from st_risk.data.io import open_h5... |
e49d0fe0fabdb2e13c17caed7bcb7e06deae04d457e7393f830cf36274f8345c | Python | 12,824 | 307 | # 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.
from collections import OrderedDict
import numpy as np
import torch
from fairseq.data import FairseqDataset, MonolingualDataset, data_utils
... |
b7289257d1eb42faf880920d271c4a5e0c3aa60f21d55f53ae9c5c87a3a36fa1 | Python | 12,825 | 412 | from matplotlib import pyplot as plt
import argparse
def EPSP_multipoints(all=True, model="ctl", alter="head", N=100, show=True):
from neuron import h
from neuron.units import mV, ms
import cell_singlespine_randomloc as cell
h.load_file("stdrun.hoc")
vinit = -70 * mV
h.celsius = 37
h.dt ... |
914d28abdd4d209fea4c28a96e2a85512ea293bb849982213a1ddcaa1d49d6f8 | Python | 12,832 | 293 | from __future__ import annotations
from typing import TYPE_CHECKING
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QDialog,
QGridLayout,
QHBoxLayout,
QLabel,
QPushButton,
QVBoxLayout,
)
from src.gui.framework.qt_view_styles import (
apply_button_role,
panel_stylesheet,
... |
381223173114efbf88244e4ea435f1f558f832e4365b7b525df671465a77af6a | Python | 12,843 | 253 | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and 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
#
# Un... |
3d767b9111608d4353b9707608efc035fa978c19aedf5c7b96afd301cd015165 | Python | 12,843 | 307 | #!/usr/bin/env python2
# written by Jin Lee, 2016
import os
import glob
import sys
import re
import argparse
import json
import csv
from collections import OrderedDict, defaultdict
def parse_arguments():
parser = argparse.ArgumentParser(prog='qc.json parser for ENCODE ATAC/Chip-Seq pipelines',
... |
93eb62b684906d5837b8f5eb1495ff49c522b1ab0bd71e411c66334a9e111df8 | Python | 12,844 | 254 | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and 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
#
# Un... |
d5a24879e24f8f6c24a7b3867b3312006706acc3c6a96f0c20241056b6e1d946 | Python | 12,847 | 357 | """Gene mIoU (mean Gene IoU): Jaccard index on RNA spot-ID sets for matched pred/GT cells (Simulation).
Uses stitched **pseudo-label** instance maps (``pred_insts`` / ``new_inst`` in the training loop), not
raw ``argmax(logits)``, compared to ``ground_truth_instance``. Spots are loaded from
``{data_dir}/spots_{con... |
de930c5a201304f212da5f44e55c7a88a090f27cafbc84be669e8b166a58e7ca | Python | 12,848 | 322 | import matplotlib.pyplot as plt
import glob, os
from pathlib import Path
import pathlib
import numpy as np
from matplotlib.lines import Line2D
import matplotlib.patches as mpatches
# from scipy.interpolate import make_interp_spline, BSpline
import matplotlib.lines as mlines
import matplotlib as M
from matplot... |
67bb3052aace6fc679d7721003eb2b6945a5e45b1952809c8b3b93a32c05a99a | Python | 12,857 | 366 | import pytest
import re
import nipype.pipeline.engine as pe
import nipype.interfaces.io as nio
from fetpype.utils.utils_bids import create_bids_datasink
# Helper for sorting lists containing None
def sort_key(item):
# Treat None as an empty string for sorting purposes
return tuple(
"" if x is None el... |
fc97f083f059f5b587d568aa0c32f7cca227e247160a7e22e3a168aef1469ebe | Python | 12,858 | 354 | import typing
import logging
import torch
import torch.nn as nn
from .modeling_utils import ProteinConfig
from .modeling_utils import ProteinModel
from .modeling_utils import get_activation_fn
from .modeling_utils import MLMHead
from .modeling_utils import LayerNorm
from .modeling_utils import ValuePredictionHead
from... |
ffe83794864b28cd9e216e76d74dc743468e242d46ee536d419910d9e7b9b714 | Python | 12,862 | 436 | '''Functions used for ROI manipulation.
Authors:
- Sander W Keemink <swkeemink@scimail.eu>
'''
from __future__ import division
from builtins import range
import numpy as np
from skimage.measure import find_contours
from .readimagejrois import read_imagej_roi_zip
from .ROI import poly2mask
def get_mask_com(ma... |
48214fc72009a64e94ed30fcacfcd3b4dbe5fbde699ed43a71d10dee06431b25 | Python | 12,864 | 292 | import argparse
import numpy as np
import bigstream.io_utility as io_utility
from dask.distributed import (Client, LocalCluster)
from bigstream.configure_bigstream import (configure_logging)
from bigstream.configure_dask import (ConfigureWorkerPlugin,
load_dask_config)
from bigst... |
b033ef394e2217e1e47d06349e7908557a63c9343df8f8d07e5c04156acf83e0 | Python | 12,869 | 322 | 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.neighbors import NearestNeighbors
from tqdm import tqdm, trange
from gsMap.config import LatentToG... |
e5e478367e4b3e55f2106d02d4ae7790de03f2d868d18e17b90e22c2c92f3964 | Python | 12,877 | 311 | # 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 numpy as np
import torch
from fairseq.data import FairseqDataset
class BlockPairDataset(FairseqDataset):
"""Break a ... |
2637cdbde398e44024138bb74961caa37f2652f149cd29bb7297ead9a874222c | Python | 12,878 | 325 | import numpy as np
import os, six, sys, subprocess, time
import pandas as pd
# ------------- one hot encoding of RNA sequences -----------------#
def one_hot(seq):
RNN_seq = seq
BASES = 'AUCG'
bases = np.array([base for base in BASES])
feat = np.concatenate(
[[(bases == base.upper()).astype(int)... |
d365f23351bd5eedad719162a3f386694743334095cdfcab6ca27d50edca3078 | Python | 12,880 | 451 | import pandas as pd
import os
import numpy as np
import json
import glob
import sys
import time
from git import Repo
def find_range(x,a,b,option='within'):
"""
Find indices of data within or outside range [a,b]
Inputs:
-------
x - numpy.ndarray
Data to search
a - float or int
... |
c47b97be4e7ce6c67729b83f68c0a2dcbd7b3d0e37e03f68a4437611f3727771 | Python | 12,887 | 342 | import os
import zarr
import numpy as np
import tskit
import yaml
import ray
import scipy.stats
import argparse
parser = argparse.ArgumentParser("Plot posteriors after rescaling parameters by fitting theta analytically")
parser.add_argument("--configfile", type=str, help="Path to config file", default="npe-config/DroM... |
39ad6066553479cf7da4dba28bc463b7a1243f01aeabf9bc7951ff7e02002ef6 | Python | 12,892 | 300 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import gzip
import os
import pickle
import shutil
import weakref
from collections import defaultdict
from functools import cached_property
from pathlib import Path
from tempfile import mkdtemp
from typing import Any, DefaultDict, Iterator, Mappin... |
ac90ad89490941d5645deb6927ef5a328c3c4ae39b4be9b00fa080ea4fda0cfd | Python | 12,895 | 341 | import torch
from torch import nn
from torch.nn import functional as F
"""New Resdule"""
class BasicBlock(nn.Module):
def __init__(self, in_planes, planes, stride=1,dropout=0.4,norm_layer=nn.BatchNorm1d,*args,**kwargs):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv1d(in_planes, planes, ... |
fc42ffde09671d0aa1e3d0343337b4b3e4fceb885e80fc083ba1d8074c420505 | Python | 12,900 | 339 | import textwrap
import matplotlib.pyplot as plt
import networkx as nx
import matplotlib.colors as mcolors
import matplotlib.cm as cm
import pandas as pd
# Import our utility helpers
from binn.plot.util import (
load_default_mapping,
build_mapping_dict,
rename_node_by_layer
)
def visualize_binn(
datafr... |
d835534fb7e4d9f19d3a52d83bca184431f8c31ea559012f55e386fc197b1dfc | Python | 12,908 | 322 | import logging
import argparse
import random
import sys
import os
import numpy as np
import torch
import soundfile as sf
import shutil
import librosa
import json
from pathlib import Path
from tqdm import tqdm
import amfm_decompy.basic_tools as basic
import amfm_decompy.pYAAPT as pYAAPT
dir_path = os.path.dirname(__fil... |
fbea81b2e665eb84979723ba796c13455f7c987e34b014a582c4aa1f607daecf | Python | 12,920 | 319 | # %%
"""Generate structured-dropout robustness data for Fig. 4.
The trained model weight files are assumed to already exist as model_<id>.
This script reproduces the saved pickle files consumed by
plot_dropout_robustness_from_saved.py.
"""
from pathlib import Path
import json
import pickle
import time
import numpy as... |
300b367e827b95ee429dec22a3f3a48b1c4c9a3626043475abb54e6309939f8e | Python | 12,924 | 355 | import logging
import warnings
from typing import Literal
import numpy as np
import pandas as pd
import scipy
import torch
from anndata import AnnData
from mudata import MuData
from scvi import settings
from scvi.data import AnnDataManager, AnnDataManagerValidationCheck, fields
from scvi.external.tangram._module impo... |
f2e9aa0db7e309007ee2c83f3770504527851d8922ed2ef69cfb3f999bc8bb30 | Python | 12,926 | 298 | import matplotlib.pyplot as plt
import glob, os
from pathlib import Path
import pathlib
import numpy as np
from matplotlib.lines import Line2D
import matplotlib.patches as mpatches
# from scipy.interpolate import make_interp_spline, BSpline
import matplotlib.lines as mlines
import pandas as pd
import scipy as sp
import... |
6eaf0783ce6e8c5c2930b208e220b2d85a2cb2d3ae7a1e7c8e37b10d4afed668 | Python | 12,927 | 326 | # 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... |
714ea7498075b32b723402893d5fd8fe96b1a4d688354de5f798092bafccd5c7 | Python | 12,929 | 454 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Creates figures to display microscopy images and processing results"""
from typing import Literal, Optional
import numpy as np
import nd2
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.fi... |
84a4fe55cccca99f4be46584ce3c0488a567ca2e7de1604a063c03ee7c395674 | Python | 12,933 | 236 | import logging
import argparse
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
import dataload.meta_datasets as data
import utils.gpu as gpu
from utils import cosine_lr_scheduler
from utils.log import Logger
from modelR.da_lodet_hbb import LODet,GRL
f... |
5cee68db418046ce28f82a4d43e13be4e31bf7e709c037fce4f4b46a62d8f632 | Python | 12,934 | 375 | from __future__ import annotations
import os
from typing import TYPE_CHECKING
import numpy as np
import pytest
from scvi.data import synthetic_iid
from scvi.external import MRVI
if TYPE_CHECKING:
from typing import Any
from anndata import AnnData
@pytest.fixture(scope="session")
def adata():
adata = ... |
6e514726514abb805f2e97732ae56c950b8ba9fbb26b7530c9a0c9697fb3b2e9 | Python | 12,938 | 298 | from kwave.kgrid import kWaveGrid
from kwave.kmedium import kWaveMedium
from kwave.utils.kwave_array import kWaveArray
from kwave.ksensor import kSensor
from kwave.kspaceFirstOrder3D import kspaceFirstOrder3DG
#from kwave.kspaceFirstOrder2D import kspaceFirstOrder2DG
from kwave.options.simulation_execution_option... |
75456e0159d11e94bc5d55d30af0c72e7682b9d5e45c48ecb76313b612f4bd98 | Python | 12,942 | 337 | import math
import statistics
from pathlib import Path
from typing import Dict, List, Tuple
import matplotlib as mpl
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.transforms import blended_transform_factory
from BLPlot... |
3086c5f09da106ea4e826129e0f02dd1fa00eb3011201b88bc243ab2a1129dc0 | Python | 12,947 | 276 | """
superstitch.py
This script implements "superstitch", a tool for long-term chromatophore tracking
across multiple datasets. Each input dataset is assumed to contain a 'queenframe'
(an averaged registered image) and a 'cleanqueen' (an image delineating individual
chromatophore territories) stored in its 'stitc... |
04ce6ee91cade32e9e62de14304999e47e94cdee3af43d6af2ec7691b9e311f3 | Python | 12,950 | 329 | # 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... |
ab6066f85cd93f05b4f76d17e6df737acb4b300d33c209eb273c07f45a50c9a3 | Python | 12,962 | 356 | from ctgan import CTGAN
import os
import pandas as pd
import numpy as np
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer, SimpleImputer
from sklearn.metrics import confusion_matrix, roc_auc_score, r2_score, mean_squared_error
from sklearn.model_selection import Stra... |
360ded0ba58ca5bd5255d6791bb3cc241cc447b0ad73cddfd42719d6b727cbf2 | Python | 12,969 | 310 | """
This module runs RNAErnie pretrain.
Author: wangning(wangning.roci@gmail.com)
Date : 2022/9/8 1:21 PM
"""
# built-in modules
import argparse
import os
import os.path as osp
from functools import partial
# 3rd-party modules
from ahocorapy.keywordtree import KeywordTree
# paddle modules
import paddle
from paddlenlp... |
0fcd6f781c012a2df15991c8d813d0fff6bba80dedb58241fc6729c14c9ac0f1 | Python | 12,970 | 332 | import math
from abc import ABCMeta, abstractmethod
from functools import partial
from typing import Dict, Optional, Tuple
import haiku as hk
import jax
import jax.numpy as jnp
from ...geom import masked_pairwise_diffs
from ...types import ElectronConfiguration, ModelDimensions, MolecularConfiguration, Psi
from ...ut... |
aa9114c9bb5a9c240b90476bdd3d868a7977e3038237dcbe2fdec37fb1f29dd0 | Python | 12,974 | 306 | import skimage.io as skio
import numpy as np
import torch
import zarr
from tqdm import tqdm
from torch.utils.data import Dataset, DataLoader
from src.utils.util import get_coordinate
def random_transform(input, target, rng, is_rotate=True):
"""
Randomly rotate/flip the image
Arguments:
input: in... |
078a6f072b4d8992c7e242f19ee6559eb5324735e483f2abccddfb419d751c1a | Python | 12,980 | 290 | #!/usr/bin/env python3
"""Builds the .rst files that autodoc will use to generate the documentation."""
import os
import sys
import re
def makeTitle(text: str, borderChar: str, upperBorder: bool = False) -> str:
"""Make a RST title line."""
border = borderChar * len(text)
if upperBorder:
fmtStr = ... |
246c796f4bee000ee997ee1ae5d4e09016b43d1963f794a931ca026c4ef727eb | Python | 12,990 | 294 | """
process_GSE118257_jakel_brain.py
------------------------
MS brain snRNA-seq — Jäkel et al. 2019 (Nature, PMID 30747918, GSE118257).
The GEO deposit ships the paper's FINAL cluster labels + cell-type names:
Sample, Condition (Ctrl vs MS), Lesion (Ctrl/A/CA/CI/NAWM/RM),
Clusters_res08 (paper Seurat clusters, 0-... |
7b4e5d3f0b16c448dc118ed0a269c7d218952decd81e9365a9a30c0920551ec5 | Python | 12,992 | 345 | import matplotlib.pyplot as plt
from math import pi
import numpy as np
import pandas as pd
from ..utils.parcellation import parcel_to_surface
import os
import matplotlib.patches as pat
import random
import seaborn as sns
from scipy.stats import median_absolute_deviation
def economo_koskinas_spider(parcel_data=None, pa... |
545391fae874f15f0b92a51a58ff4424a7b5e0c31976e076cb16b194af1f5f08 | Python | 12,993 | 350 | import json
import os
from pathlib import Path
from typing import Optional, Union
import numpy as np
import scanpy as sc
import torch
from anndata import AnnData
from torch.utils.data import DataLoader, SequentialSampler
from tqdm import tqdm
from .. import logger
from ..data_collator import DataCollator
from ..model... |
5f6c6f1019dc3c65a038a6933a4f5394c6fd868a1a55db6144cd3d7724abca7b | Python | 13,013 | 360 | from collections.abc import Sequence
import numpy as np
import pyro
import torch
import torch.nn.functional as F
from anndata import AnnData
from scvi._constants import REGISTRY_KEYS
from scvi.data import AnnDataManager
from scvi.data.fields import LayerField
from scvi.model.base import BaseModelClass, PyroSviTrainMi... |
a14fda0b6732c4c61a1ce69b6af931941befd79eaa0897dadb85e16c2dcbe660 | Python | 13,013 | 393 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 7 15:30:09 2021
@author: bianca
"""
##########################################################################
#
# ActPred3T_WP1
#
# !! Updated version !!
# Cue is now fixation dot changing colour instead of enlarging
#
# Script to train p... |
c808960eab5d72453d76860f96a1be15108cba39ce67a37376590926cab1802f | Python | 13,018 | 330 | import unittest
from unittest.mock import patch
from pyecharts import options as opts
from pyecharts.charts import Map3D
from pyecharts.faker import Faker
from pyecharts.globals import ChartType
from pyecharts.commons.utils import JsCode
class TestMap3DChart(unittest.TestCase):
@patch("pyecharts.render.engine.wr... |
dbaa1d676fc91533ba01566044e3ae9a447460e83840a742cfe418ffb7b1476e | Python | 13,032 | 364 | import argparse
import json
from datetime import datetime
from pathlib import Path
SUPPORTED_DATA_EXTENSIONS = {".npy", ".tif", ".tiff", ".pkl", ".mat", ".wdf"}
CODE_DIR = Path(__file__).resolve().parent
def _parse_args(argv=None):
parser = argparse.ArgumentParser(
description="Run the deep learning-enh... |
510de6d43cdf09d650a5e781d075376ddaef5cb720ce9503b46075581c5770c6 | Python | 13,036 | 310 | """Read a Gene Product Association Data (GPAD) and store the data in a Python object.
Annotations available from the Gene Ontology Consortium:
GPAD format:
http://geneontology.org/page/gene-product-association-data-gpad-format
"""
# https://github.com/geneontology/go-ontology/issues/17470
import sys... |
5671c148923c4fe5f3789ca6d31c8ddd36f416311180130b768f00e283781a7e | Python | 13,054 | 345 | from __future__ import annotations
import logging
import warnings
from copy import deepcopy
from typing import TYPE_CHECKING
from scvi import REGISTRY_KEYS, settings
from scvi.data import AnnDataManager
from scvi.data._constants import (
_SETUP_ARGS_KEY,
ADATA_MINIFY_TYPE,
)
from scvi.data._utils import _get_... |
117e369f4fa7ec0214b3404d0e8067978fb56de06815ae5c4d0dccbda434ae04 | Python | 13,056 | 360 | import logging
import pandas
import numpy
from patsy import dmatrices
import statsmodels.api as sm
from .MultiPrediXcanAssociation import Context as _MTPContext, MTPMode
from .PrediXcanAssociation import Context as _PContext, PMode
from metax import Exceptions, Utilities
from .. expression import Expression, PlainTe... |
d8a60bfb3140840e917a4810ea99cb65b1318128fe079762e5521608891df218 | Python | 13,058 | 349 | import os # system functions
import sys
import numpy as np
import nipype.interfaces.io as nio # Data i/o
import nipype.interfaces.fsl as fsl # fsl
import nipype.pipeline.engine as pe # pypeline engine
import nipype.interfaces.utility as util # utility
import nipype.algorithms.modelgen as model # model generation... |
1a0a8dae87a330263d1a9566aa78dd9741555c03ed84074be98cd1b64294ff7e | Python | 13,061 | 296 | #!/usr/bin/env python3
"""A script to take the predictions hdf5 file and turn it into a bigwig."""
import argparse
import multiprocessing
from bpreveal.internal.constants import PRED_T
import tqdm
import h5py
import pyBigWig
import numpy as np
import numpy.typing as npt
from bpreveal import logUtils
from bpreveal impor... |
5db38f1689eef4601d0c9d66565d1ee3ccb3b4c9e351d073f1b23bc55e935679 | Python | 13,061 | 288 | """Given user GO ids and parent terms, group user GO ids under one parent term.
Given a group of GO ids with one or more higher-level grouping terms, group
each user GO id under the most descriptive parent GO term.
Each GO id may have more than one parent. One of the parent(s) is chosen
to best represent... |
8a149d8d683635af2fd1bbfc3526c8bd208f48b25fdfbb8f70477651a765a76e | Python | 13,065 | 306 | #!/usr/bin/env python
"""Regenerate the packaged snapshot of the remote vocabularies used in RNAlysis' type annotations.
Four vocabularies -- UniProtKB's gene-ID types, and PantherDB's / Ensembl's / PhylomeDB's legal
taxons -- appear inside ``Literal[...]`` type annotations on public ``Filter``/``FeatureSet``
methods,... |
de283d3e5e6f3f34a193b631e7a5b95cc07f22c5477b6787f68bce01db11286d | Python | 13,066 | 403 | # 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 os
from collections import Counter
from multiprocessing import Pool
import torch
from fairseq import utils
from fairseq.data import da... |
b8598423388edebe46d7eb2e7cbd07e750885bc76886f92c44a2871267c98722 | Python | 13,069 | 279 | import collections
import warnings
from typing import Tuple, Optional, Union, Dict, Any, List
import torch
import torch.nn as nn
from torch.cuda.amp import autocast
from torch.utils.data import IterableDataset, DataLoader
from transformers import Trainer, EvalPrediction, is_torch_tpu_available
from transformers.traine... |
9c172d1041617327423a0567f86395892a4ae6da191213669ab4f076573ad309 | Python | 13,070 | 363 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 7 16:13:47 2021
@author: bianca
"""
##############################################################################
#
# ActPred3T_WP1
#
# !! Updated version !!
# Cue is now fixation dot changing colour instead of enlarging
#
# Script to tra... |
aad2698d2e96ea5e224261552f75906f20d514b180964ce76bd693af12c1e147 | Python | 13,083 | 295 | """Settings manager facade for app-specific settings."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, ClassVar
from src.core.settings_defaults import get_default_settings
from src.persistence.settings_store import load_settings, save_settings
class AppSettingsManager:
"""Coordinate... |
2f64c72a2191986586edbb62487fcff23c39076dde4e6d41ed414b164944e4ad | Python | 13,098 | 383 | from __future__ import annotations
import logging
import warnings
from typing import TYPE_CHECKING
from uuid import uuid4
import h5py
import numpy as np
import pandas as pd
import scipy.sparse as sp_sparse
from anndata import AnnData
from anndata.abc import CSCDataset, CSRDataset
from anndata.io import read_elem
from... |
38be1707da3e17355e1e756e54d361d8a5acc86d8e45af48b051f2058cb610d4 | Python | 13,103 | 360 | from dataclasses import replace
from typing import Callable, Optional, Tuple
import haiku as hk
import jax
import jax.numpy as jnp
import jmp
from nucleotide_transformer.chatNT.gpt_decoder import GptConfig, GptDecoder
from nucleotide_transformer.chatNT.multi_modal_perceiver_projection import (
MultiModalPerceiver... |
a50fbf3ff9e082f2f07f4f123f4d287ef6864be28ab695392aa54f701fc007c2 | Python | 13,114 | 307 | from __future__ import print_function
import argparse
import sys
import pandas as pd
def get_parser() -> argparse.ArgumentParser:
'''
:return: an argparse ArgumentParser object for parsing command
line parameters
'''
parser = argparse.ArgumentParser(
description='Generate experimenta... |
9e8af1cb4d65aca49bff30b563af36f15e185014e4f2691c677e7ac291f37232 | Python | 13,121 | 350 | # 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 logging
from argparse import Namespace
from pathlib import Path
from typing import List
from fairseq.data import Dictionary, encoders
... |
fd789d633df3099f5970712f7471f19d8564aa802bd1a79edde6fa555b7f50b3 | Python | 13,124 | 388 | from dataclasses import dataclass, field
from functools import cached_property
import numpy as np
import pandas as pd
from skbase.base import BaseObject
from skbase.lookup import all_objects
from sklearn.base import clone
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
class _ResidualMixin... |
ca4f47add8d5f12cb6ef491239f63b59aff81568b8ae1b908cf08b5c0a351b20 | Python | 13,135 | 326 | import pandas as pd
import pdb
# sys.path.append("../../corecode/")
from build import *
import matplotlib.pyplot as plt
# import seaborn as sns
import numpy as np
from scipy.stats import gaussian_kde
import matplotlib.colors as colors
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from pathlib i... |
9337ea57c97c993f2447adf60107f6758f44b2bcf93bea43e150cf518fdb43a1 | Python | 13,139 | 364 | """Generate the psychopy experiment files for the fMRI experiment based on the chosen stimuli."""
import glob
import os
import random
from typing import List
import click
import pandas as pd
from PIL import Image, ImageOps
from psychopy import core, event, logging, visual # type: ignore
from tqdm import tqdm
from c... |
ef1a41348f9a0b34cf7f018c8455eb0e9693b5bddcacf865cf432c655dce8945 | Python | 13,145 | 387 | import torch
import torch.nn as nn
from ..gnn.embeddings import MAX_ATOMIC_NUM
from ..gnn.mlp import FourierFeatures
from ..common.data_utils import lattice_params_from_matrix
from .utils import get_timestep_embedding, default_init
class BaseDecoder(nn.Module):
def __init__(
self,
hidden... |
7e404899371903672277ba9ee3a91b4100ec8310cf8c409b9373d3b1884923a0 | Python | 13,150 | 226 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'fit_model_tab.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_FitModelTabContent(object):
def setupUi(self, FitModelTabCont... |
b9cc3b6e4622518622791e21f706c0e0014fc969ce08ee47568a46e5936620c6 | Python | 13,150 | 376 | # 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 contextlib
from argparse import Namespace
from dataclasses import dataclass, field
from typing import Any
import torch
import torch.nn... |
17630d7c5da039c8af555f9e5cc327a99b18a4d0e45fe774f85e76664d712329 | Python | 13,153 | 257 | import qt, slicer
import numpy as np
import re
import json
from datetime import datetime
from DICOMLib import DICOMUtils
import pydicom as dicom
import StereotacticPlan
from .importerBase import ImporterDialogBase
class ImporterDialog(ImporterDialogBase):
def __init__(self):
ImporterDialogBase.__init__(s... |
0d3e61d8a1071116f121caa207c7977c8016965ffbb7104a1f52314eb39434ab | Python | 13,156 | 316 | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice... |
8f5931e486c0e59c3cb980314de5d836951e46cd2e0e2e4fafa0ae7018a67ab2 | Python | 13,157 | 317 | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice... |
bd9ad2281352e34b799b43b1fe96195be4423cbc27e5e662e1c6caea0eae0778 | Python | 13,167 | 381 | """CVAE-only experiment shared helpers.
Inference-time utilities for the G1–G7 scripts (`CVAE_only_experiment_*`)
that run against HIPPIE and HIPPIE-WF+3DACG checkpoints.
HIPPIE operates on wave + ISI + ACG (all 1D). HIPPIE-WF+3DACG operates on
wave + 3D ACG (the 10×101 tensor). Because the two checkpoints carry
diff... |
43ef815f8509c8ce795f01e2f6db27d46940a6a1e8086496626299b7db592424 | Python | 13,168 | 322 | def parse_lavaan(lines):
# Step 0: Check if pyparsing is installed
try:
from pyparsing import OneOrMore, Optional, Suppress, Word, alphanums
except ImportError as e:
raise ImportError(
f"{e}. pyparsing is required for using lavaan syntax. Please install using: pip install pyparsi... |
9fef5f9e89ba6389bd1c56ef50016667b497496e3ae6a2f59086d6041eb07f2f | Python | 13,177 | 325 | """Functionality to prepare splits of frame classification datasets
to generate a learning curve."""
from __future__ import annotations
import logging
import pathlib
from typing import Sequence
import attrs
import dask.bag as db
import numpy as np
import pandas as pd
from dask.diagnostics import ProgressBar
from ..... |
ea691bc8ca399ead67c66549277963224b0c7979b1eed2589482b10d9bb3bb92 | Python | 13,190 | 350 | # Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors
import argparse
import yaml
import logging
from Simulator_calibration import (ForcefieldBuilder, SimulationBuilder, ReporterAdder,
SimulationRunner, AmpConfigurator, SystemBuilder,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.