sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
3ca47034ef2b1e92eb001b6c999a5d87d99bceb0816517b7ed735d4a3251d9d8
Python
4,163
161
import numpy as np alg = 'MPVNN' ctype = 'OV' basedir = '..\\Data\\' outbasedir = "..\\Out\\" topmax = 3 thrval1 = 0.85 thrval2 = thrval1 edges = [] pgenes = set() with open(basedir+'pi3k-akt.txt', 'r') as f: for line in f: lineData = line.strip().split("\t") pgenes.add(lineData[0]) p...
58b617b492ff6d8bdcae8dc5cf3b7517815c17eef7cf8ee32ff195733fb1c701
Python
4,163
100
import pandas as pd from sklearn.base import clone from sklearn.linear_model import LinearRegression from sklearn.metrics import r2_score from pgmpy.causal_discovery._base import BaseOrderDiscovery class R2Sort(BaseOrderDiscovery): r"""Causal discovery by sorting global R^2 values and regressing on predecessors....
7ec25a4fb1cc4115e1f48d32b096147aeac0c8f49f554f4c64cfe581434ce73e
Python
4,163
129
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import os.path as osp import loggi...
04936a374981877bc3bfcd257d1e780192b777cc09d9cd1f5a5941dae47b8e94
Python
4,166
138
from scipy.spatial import KDTree import numpy as np from .figure_Tools import point_value_PMF_1darray def nn_PMFs(ax, group, df, x0, x1, n_bins, n_boots): """Nearest neighbour PMF plot""" # get data arrays a = df.loc[df.Subtype == group + "a", ["Root_x", "Root_y", "Root_z"]] b = df.loc[df.Subtype == ...
244503b7528e57e5a5b4ff77f7e6e9510eb045d79f5343d3f788921b838a65af
Python
4,166
98
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
80497c8198798b2e1b70b49724f309b3b5fa948d9c1c15435b37440fcd3b5c82
Python
4,168
172
############################################################################### # # Import functions # ############################################################################### import glob from pathlib import Path import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.font_m...
08970778ddf38a65be05af6bf60f495db4721820a2c045cba61637ce81521cde
Python
4,169
119
import queue import collections import threading __all__ = ['FutureResult', 'SlavePipe', 'SyncMaster'] class FutureResult(object): """A thread-safe future implementation. Used only as one-to-one pipe.""" def __init__(self): self._result = None self._lock = threading.Lock() self._cond...
4b9c4bc92659bd17f845e4b97014ecb6b3a4f0fe5e39593de597c04a4454a158
Python
4,170
106
from argparse import ArgumentParser, BooleanOptionalAction from pathlib import Path import re import nibabel as nib import numpy as np import pandas as pd from scipy.stats import ttest_1samp def parse_args(default_groups, default_invert, default_split, default_max): parser = ArgumentParser() parser.add_argum...
b38a3ee6ea8dab3a8060cd007689f1bb58f1901f1c64a234828b803ca63952ca
Python
4,170
115
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc def CBIG_mfm_test_desikan_main(gpu_index=0, subject=1): ''' This function is to impleme...
4d9da8a234afed444be227ae7df30891384d4f2719e3563d430f2cca9f1731e1
Python
4,172
107
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pathlib import Path # Define paths base_dir = Path('/egor2/egor/MovieProject2') tonotopy_dir = 'tonotopy' fd_file_pattern = 'motion_{subject_id}_enorm.1D' plots_dir = base_dir / "bids_data/derivatives/group_analysis" plots_dir.mkdir(parents=...
7c42a3f07a13ada51c9473c0c5605bd1e27d05b1770383bc62919acf3b7ceadd
Python
4,173
117
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc def CBIG_mfm_test_desikan_main(gpu_index=0, weight=1): ''' This function is to implemen...
d5e23ea27361a01e6b64008e5288eca33cc337b049d7f51b7c72efec806422d1
Python
4,173
117
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc def CBIG_mfm_test_desikan_main(gpu_index=0, weight=1): ''' This function is to implemen...
10ec6a380ef5410dd88fa0b96d76c660aa4dd354afae16920b708efe51c854fe
Python
4,174
121
# 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 . import LegacyFairseqLRScheduler, register_lr_scheduler import logging import ast logger = logging.getLogger(__name__) logger.setLevel(...
fb6e738f10eca62dbfdfdec709922716cf1ede4ae691e3c5b6633c140ac8bed0
Python
4,176
131
from __future__ import annotations from pathlib import Path import pytest from poetry.repositories.parsers.pypi_search_parser import Result from poetry.repositories.parsers.pypi_search_parser import SearchResultParser FIXTURES_DIRECTORY = Path(__file__).parent.parent / "fixtures" / "pypi.org" / "search" @pytest....
0bb43b7a41745d58fac947cd3bef7dbcce80b8b8a846d595b0a5be7690c82951
Python
4,179
110
import requests import unittest from unittest.mock import patch from pyecharts import options as opts from pyecharts.charts import Lines3D, Map3D from pyecharts.globals import ChartType class TestLines3DChart(unittest.TestCase): @patch("pyecharts.render.engine.write_utf8_html_file") def test_lines3d_base(sel...
8d9ef4e5c446e43a5933995963d74b60625a13009c8574cdc5c7e7e72fedc00b
Python
4,179
113
#!/usr/bin/env python3 """Check MPI prerequisites without confusing them with an app MPI gate. The probe launches the selected interpreter with ``mpirun`` and verifies that the requested world size is visible to ``mpi4py``. It also records the GROMACS build's MPI mode. A successful probe is runtime evidence for the ...
cf0a09ffa8ffa1ecb24a80ba1d52914391e7d8cc7678b2776c7dfb184988d538
Python
4,179
104
import cv2 import cmapy from PIL import Image import numpy as np from msi_visual.utils import normalize_image_grayscale, image_histogram_equalization class SegmentationAvgMZVisualization: def __init__(self, segmentation_model): self.segmentation_model = segmentation_model self.k = self.s...
0cc95ae45f1a930e2d980b48d15ab69b1ae9e536a77d13044efd3fa33e6bf44e
Python
4,181
117
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc def CBIG_mfm_test_desikan_main(gpu_index=0, weight=1): ''' This function is to implemen...
38949d0709358516f0e13494a072ec78ee794758ab0bb49d0a1ea27294c059bf
Python
4,182
141
import argparse import numpy as np import gzip import sys import os import yaml import torch import allel import pysam import pysam.bcftools import textwrap # put popgen-npe scripts in the load path sys.path.insert( 0, os.path.join(os.path.dirname(__file__), "..", "..", "workflow", "scripts") ) import ts_simulator...
65972551e90812dbc89d410ae9aebbd7fc97b0ada0eeda259e73f75b76ef4f4a
Python
4,182
119
"""Where the BRENDA data blobs live, independent of how this package installed. The blobs are fetched from the Hugging Face Hub and never built into the wheel, so their location cannot be package-relative. Under a non-editable install a package-relative path resolves inside ``site-packages``, while the downloader writ...
2a1255bc08373a43a800c25cd4c599fe6f647108d846be9f491bbdb2e0459a90
Python
4,183
136
""" dataset_fast.py =============== Generate 4-state Markov input spike trains for the driven reservoir experiments. For each combination of (seed, ε, v_on), produces a numpy array of Poisson spike trains (4 channels), one per Markov state. Output files are named: <outdir>/T{tbit}/e{eps*100:.0f}%_v{v}_s{seed}.npy...
6f5a2eb6b6327a90651c534efc772aa620469d50495e3434775eeac984b0b45b
Python
4,183
174
from typing import List import logging from collections import OrderedDict import numpy as np logger = logging.getLogger(__name__) IUPAC_CODES = OrderedDict([ ('Ala', 'A'), ('Asx', 'B'), ('Cys', 'C'), ('Asp', 'D'), ('Glu', 'E'), ('Phe', 'F'), ('Gly', 'G'), ('His', 'H'), ('Ile', 'I'...
e8a1276177a6b003bddd80d220cc9c24bd7b28418b09ef7980fe3cb1409d4aa6
Python
4,183
132
# 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 gc import logging import os import joblib import soundfile as sf import torch from examples.textless_nlp.gslm.speech2u...
b1a75db059d76dc28c02fe00eae5c185eaba33c401786e84a88ee1244c542ba1
Python
4,184
116
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc def CBIG_mfm_test_desikan_main(gpu_index=0, subject=1): ''' This function is to impleme...
1a1a0cb04426cd80574c1a78ffc1f8de61c8bcfc5adf7852edc7faa790f98ee0
Python
4,185
149
import os, re, glob import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from matplotlib.colors import Normalize from matplotlib.lines import Line2D plt.rcParams['figure.dpi'] = 400 # ========================================================= # USER SETTINGS # ======================...
b741e26169bbca05ea95e6125e74d94082a8af06b3e71f6d3d1c68d5dfd1ef28
Python
4,185
105
import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.use("TkAgg") import pandas as pd from cal_KL_div import calculate_kl_divergence min_n = 100 max_n = 0 def get_model_bit_scores(model_name, min_n, max_n): all_seq_score_list = [] all_list_left = [] all_list_right = [] ...
af13dd283339e276c15281b637eb40e06230be81b8d1e70d800236755d348687
Python
4,186
144
# -*- coding: utf-8 -*- # Copyright 2015 Google Inc. 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 require...
846677fa4272820b49eedaf7259ecb2e523646cfe10ddae0a4c2bb2fb7edde52
Python
4,191
77
"""Offline regression checks for NSD output names and spherical atlases.""" import json from pathlib import Path import tempfile import unittest import nibabel as nib import numpy as np from utils.nsd_utils import NSDDataHandler, create_spherical_roi_atlas, encrypt_val class NSDUtilsTests(unittest.TestCase): de...
b4f6942df021bb4efa50c3a0ad61901a68bcd56c86bc81a45fe05ca63cc882a1
Python
4,191
82
#!/usr/bin/env python3 """O OCE preve a DENSIDADE DE ESTADOS? Pergunta inedita no projeto. O registro tem uma pendencia declarada em varios lugares: **nenhuma densidade de estados foi jamais ajustada com OCE em conjunto algum**. Agora ha o dado -- as 1.784 curvas de DOS das perovskitas SIESTA, calculadas dos .EIG e va...
db6c6ee6c303f1aa2388e5f576cd83d9d22225191214b2305d238eb6a346398d
Python
4,191
120
"""Tests for vak.prep.audio_dataset module.""" from pathlib import Path import pandas as pd import pytest from ..fixtures.audio import ( AUDIO_DIR_CBIN, AUDIO_LIST_CBIN_ALL_LABELS_IN_LABELSET, AUDIO_LIST_CBIN_LABELS_NOT_IN_LABELSET ) from ..fixtures.annot import LABELSET_NOTMAT import vak.common.annotation impor...
976e1b8996783c453f6a86a0b733f775c6e5352c98fe39bc3cd06728aeba10f3
Python
4,193
112
# -*- coding: utf-8 -*- """ @Time:Created on 2019/4/30 14:19 @author: LiFan Chen @Filename: mol_featurizer.py @Software: PyCharm """ import numpy as np from rdkit import Chem from rdkit.Chem import Descriptors num_atom_feat = 34 def one_of_k_encoding(x, allowable_set): if x not in allowable_set: raise Exce...
055c5d1b9ae988a0d510aef88e1d156cd02a54f77b41e3a671a09a33db051f40
Python
4,194
123
""" 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. --- Script for calculating the scaling factors used to even out GemNet activation scales. This generates the `scale_file` specified in the confi...
7afeecf8712eed18feb1928d486fb333fa2aa231c1b20bb89d14330fd44b9c5a
Python
4,196
113
"""Tests for the sparse-to-dense index mapping of FwdJacobian.""" import jax import jax.numpy as jnp import numpy as np import pytest from folx.api import FwdJacobian from folx.utils import compact_repeated_dims_except, static_index_mask jax.config.update('jax_enable_x64', True) def _brute_force(mask: np.ndarray, ...
f1d5566d79cedd05e800ca4d7cd42f842858c535bf55b0a8db73703131e09c54
Python
4,198
138
import torch import torch.nn.functional as F def softmax_splat_2d(src: torch.Tensor, flow: torch.Tensor, temperature: torch.Tensor = 1.0) -> torch.Tensor: """ Softmax splatting (Niklaus & Liu) simplified 2D version. Args: src: [B,1,H,W] source intensities multiplied by mass m in [0,1] flo...
bcf9bdd6e1f712523091563f6e1b1aa2b4c50289dc9407a3d538ea1da3f6fc43
Python
4,200
150
from __future__ import annotations from copy import deepcopy import pytest from cleo.io.buffered_io import BufferedIO from poetry.config.config_source import UNSET from poetry.config.config_source import ConfigSourceMigration from poetry.config.dict_config_source import DictConfigSource @pytest.fixture def config...
d49abdccaacda0d521b51aaff49fb5a1eb303c92e9ed900c040779e9779f623c
Python
4,200
160
"""CSS styling constant for Lossless Pipeline in Dash.""" # Author: Scott Huberty <seh33@uw.edu> # Default Layout for individual scatter plots within timeseries ############################################################### drawn_shapes_format = { "drawdirection": "vertical", "layer": "below", "fillcolo...
09dec6a08d0a3f238f4961b2cede8f3797377ae377eaf97c90cd381ff9daea6e
Python
4,201
111
docstring = """ Plot posterior coverage and concentration as a function of increasing numbers of training samples, across misspecified priors. """ import matplotlib.pyplot as plt import pickle import argparse import numpy as np from matplotlib.ticker import ScalarFormatter plt.rcParams["figure.dpi"] = 300 plt.rcParams...
7a5103f5b1aecd2380324eeef3cf140d75c02755ec8a460255cf593127f958be
Python
4,202
88
#! /usr/bin/env python import os import logging import pandas import gzip from timeit import default_timer as timer from metax import __version__ from metax import Logging from metax import Exceptions from metax import PredictionModel from metax import Utilities from metax import MatrixManager from metax.genotype imp...
c53e5e6ff0ae203950721f4b25fba39d146bc18326ed5bb8ba78342c650b7b27
Python
4,203
136
from __future__ import annotations import tempfile from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING from poetry.core.packages.utils.utils import splitext from poetry.utils.helpers import extractall from poetry.utils.isolated_build import isolated_builder if TYPE_CH...
8580c2afb5489c0f8df84dfa3c79fe1fc48b15f1eef0630426dc36367c612b63
Python
4,205
103
import numpy as np def Surr_PseudoPeriodic(y,tau,dim,rho): """ inputs - y, time series - tau, time lag for phase space reconstruction - dim, embedding dimension for phase space reconstruction - rho, noise radius outputs - ys, surrogate time series - yi, sele...
91d6e8ee3033b18a1a0a6d943f6abdb8c3e0535977067f410109095e17982bce
Python
4,206
111
# 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 from typing import Any, Optional import torch import torch.onnx.operators from fairseq import utils from torch import nn, Tensor ...
804c8ea80e22b8ef14d45b557fa98eaf335324f09082a2b6cfb1460b475220dc
Python
4,207
100
## create model RDMs # # written by S-C. Baek # update: 16.12.2024 # import os import scipy.io from scipy.spatial import distance import numpy as np import pandas as pd from utils import get_main_dir # path settings MAINDIR = get_main_dir() DATADIR = MAINDIR + os.sep + 'data/' def create_model_rdms(subjects, elem...
d8e19fce136728a7060d69f261ffe4317f854b634905bdd546c450def10f9438
Python
4,207
106
from pymatgen.core import Element from pymatgen.entries.compatibility import Compatibility, CompatibilityError from pymatgen.entries.computed_entries import ( ComputedEntry, ComputedStructureEntry, EnergyAdjustment, ) class IdentityCorrectionScheme(Compatibility): """Perform no energy correction.""" ...
7fa9d57cc7ae7e86991812123e6a928bb73a8fdccfd436fad2256a9ea50ec181
Python
4,209
119
import logging import math from typing import Any, Literal, Optional import numpy as np from pydantic import BaseModel, Field, root_validator class MOJOConfig(BaseModel): name: Literal["MOJO"] alphabet_size: dict[str, int] = Field(default_factory=dict) token_embed_dim: int conv_init_embed_dim: int ...
743008b175340fa98ae77d2a0f7cf578faaad9e34e23b22fd4649ab01843f9ce
Python
4,211
114
import numpy as np from scvi import REGISTRY_KEYS from scvi.data import AnnDataManager from scvi.data._utils import get_anndata_attribute from ._ann_dataloader import AnnDataLoader from ._concat_dataloader import ConcatDataLoader class SemiSupervisedDataLoader(ConcatDataLoader): """DataLoader that supports semi...
42e6b7eb65d1f505b4500c0b1608b90ae12915cde87035774df0dfda062b6405
Python
4,212
143
# 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 contextlib import redirect_stdout from fairseq import options from fairseq_cli import generate from examples.noisychannel imp...
f04856f79d8bc55fd892d5889cdbba6ec7a167c15fc43a6ecb90c0caa47d1b18
Python
4,213
124
"""Reclassify organisms in the `other_organisms` fields of the doc database. When one of those organisms is a bacteria in the NCBI taxonomy, move it to the bacteria field of the document and add an entry for it in the `bacteria` table of the database. Similarly, if one of those organisms is a bacterial strain, move i...
feafa4aafaf481edca84fb20df9a66dcf8d85159116e4f626a74669792b57656
Python
4,213
122
import pandas as pd import numpy as np import torch from torch.utils.data import Dataset class HTPDataset(Dataset): def __init__(self, data_path, max_seq_length, encode_fn_name=None): self.max_seq_length = max_seq_length if data_path: self.data_df = pd.read_csv(data_path) ...
a61f232458dc546bc3c311c3fdefe40b7c6e9d709b2067eb8fe9bc06358d3cf5
Python
4,216
110
"""The tracked scripts that write `config.toml` must write one that loads. Experiment drivers generate the repo-root `config.toml` wholesale, so a key renamed in Python alone leaves them writing a file every `train`, `evaluate` and `tune` then dies on in `machine_config()` — and regenerating it is how the breakage rep...
4165f94818a27df3596d0d6af39352f4c58a77214695cf184673695f0c738774
Python
4,217
116
"""Guards on where the data blobs are looked for. The blobs ship through the Hugging Face Hub, so the directory holding them has to be the same one whether this package is installed editable or copied into `site-packages`. A package-relative answer is not: it moves with the install, the downloader keeps writing to the...
8ddbd9448bdfaff29a598f8592813617c4e3b7023c4a26f48a6b129e850c09d3
Python
4,220
111
"""The document id is what identifies a document to the embedding caches. `get_token_embeddings` keys a cache that lives as long as the process on a batch item's id, and checks nothing behind that id but the entry's row count, so two documents of one token count handed one id are served each other's activations with n...
3789a7f037db20468c1ee0cfb6a8994d961ff9967a74e337c709489381d542f7
Python
4,221
143
# 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. # The code in this file is adapted from the BeiT implementation which can be found here: # https://github.com/microsoft/unilm/tree/master/beit...
3fb631cdc73fcc2261ccff5a815879d9e5c18fc5a61fdf6be5bc58534963dc99
Python
4,228
121
from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join from tractseg.data import dataset_specific_utils from tractseg.libs.system_config import SystemConfig as C class Config: """ Settings and hyperparameters """ # inpu...
62904860dfb6e7cb971e17b330a1274a2f2ee3140860f05df7d94228dadbcf74
Python
4,228
119
from collections.abc import Hashable import pandas as pd import pytest from pgmpy.structure_score import ( BIC, K2, BaseStructureScore, BICCondGauss, BICGauss, ) from pgmpy.structure_score._base import get_scoring_method class CountingScore(BaseStructureScore): def __init__(self, data): ...
db4bf308783fe6c7a2e1251663f418a20fd7191797865044b8a95852a2c446d0
Python
4,230
128
import logging from typing import Dict, List, Union import numpy as np import scipy.cluster.hierarchy as hc from scipy.spatial.distance import pdist import loompy from cytograph.annotation import AutoAnnotator, AutoAutoAnnotator from cytograph.enrichment import Enrichment, Trinarizer from cytograph.manifold import Grap...
e04221d2532ca3591e60f67f9e81d6931afffa41f81520862e18a4394f2dc42e
Python
4,230
116
"""Plot the SIESTA-PBE vs Mannodi-VASP-HSE06 decomposition-energy parity on the 18 F-free endmembers, partitioned by A-cation (Cs vs K). """ from __future__ import annotations import json from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np from scipy.sta...
44f38e7b95ebe277d9ecd2436867f6214bb6b91de721e5337f7a2751b538badf
Python
4,231
119
""" This module contains metrics to evaluate the Garfield model training. """ from typing import Optional, Union import matplotlib.pyplot as plt import numpy as np import sklearn.metrics as skm import torch from matplotlib.ticker import MaxNLocator def eval_metrics( edge_recon_probs: Union[torch.Tensor, np.ndar...
2c42729690c03c7b8f7064d27f65d2d242c29c53f891edaed1575eaae458b667
Python
4,234
90
"""Plot a GoSubDag. GO Terms in a plot contain text. The first two lines appear by default: GO:0015618 L07 D13 p2 c2 d3 potassium-transporting ATPase activity GO:0015618 => GO ID First line: LNN => The "level" of the go term. The length of the shortest path(s) fr...
570d0bec2a77bbcda943b33654c9b16959f9cac0c0b09e865f35d4bcfc30aeab
Python
4,236
137
import sys from os.path import dirname, realpath current_dir = dirname(dirname(realpath(__file__))) sys.path.insert(0, dirname(current_dir)) import pandas as pd from matplotlib import pyplot as plt from os.path import join import numpy as np import itertools from sklearn.metrics import confusion_matrix from mpl_tool...
7e1f0317ce0bf395b84591f817729e57b91c940e29d503ca800289f7c734cfdc
Python
4,236
128
# 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 from fairseq.modules import Fp32GroupNorm class KmeansVectorQuantizer(nn.Module): def __init__( ...
6516da5083fd4fb61d5d2b26cb7018bff15b02efc279204824e88a26008a6d6c
Python
4,237
121
import os import time import json import numpy as np import re import sys sys.path.append(".") # Get structural seqs from pdb file def get_struc_seq(foldseek, path, chains: list = None, process_id: int = 0, plddt_mask: bool = False, ...
bab7ecf223ea20b21c5a5d3ed447b30466d586a126ffc623633a18e8eed90175
Python
4,237
93
import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from collections import OrderedDict class _SimpleSegmentationModel(nn.Module): def __init__(self, backbone, classifier): super(_SimpleSegmentationModel, self).__init__() self.backbone = backbone self.class...
24f22affe5868ac2d64a9524decdcaabb989b8bf78d2cf90f717ef6bd4ad59a7
Python
4,238
88
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/PretrainUI.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectN...
32b0a5a04cdb2501788641a66c93d18c608689e039d7ddc170650779fc6fe0db
Python
4,238
143
"""fixtures relating to array files containing spectrograms""" import pytest import vak.common.files.spect from .annot import ( ANNOT_LIST_NOTMAT, ANNOT_LIST_YARDEN, LABELSET_NOTMAT, LABELSET_YARDEN, ) from .test_data import GENERATED_TEST_DATA_ROOT, SOURCE_TEST_DATA_ROOT SPECT_DIR_MAT = SOURCE_TEST...
37f079eaf3c21d6e1a917e9e58ee1c8e1015d146c0447384af9b453380b13ba4
Python
4,238
83
# This extension template provides instructions to add new example models to pgmpy. # # Please follow the following steps: # 1. Copy this file to the appropriate subdirectory in `pgmpy/example_models` (e.g., # `pgmpy/example_models/bnlearn/my_model.py`). If adding a new model source, create a new subdirectory in # ...
a3cf5e7bfa653e19bf9aa1c5ad0f3470aa5afbdb4dcb20694eb8fb8a73e44de0
Python
4,238
127
from typing import Protocol import jax import jax.numpy as jnp import jax.numpy.linalg as jnp_linalg from .density_models.forces import coulomb_force_nuclei from .physics import local_energy from .types import ElectronConfiguration, ModelDimensions, RandomKey, Stats class Observable(Protocol): def __call__( ...
9d283b07a48f8a28e30c20809be01a9d57fdd9db827fca96a14c3aeba08bcdf0
Python
4,239
140
from scipy.spatial import KDTree import numpy as np from matplotlib.lines import Line2D from matplotlib.patches import Patch from .figure_Tools import point_value_PMF_1darray def nn_PMFs(ax, group, df, x0, x1, n_bins, n_boots): """Nearest neighbour PMF plot""" # get data arrays a = df.loc[df.Subtype == g...
21eba90471761da0dadc04f4484c0adec1b6cf827e04a6ea99117fcb91bf574d
Python
4,245
132
#!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.11" # dependencies = [ # "icechunk", # "zarr>=3", # ] # /// import asyncio import json import os import pathlib import shutil import icechunk import numpy as np import zarr import zarr.core.buffer SCRIPT_DIR = os.path.abspath(os.path.dir...
358c61a818992ee6c871fd3e30983f0e750b71f00112e08138046fde2e00faf0
Python
4,245
115
# 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 numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair class PQConv2...
76dc28be79051d6d3aaa6d361c20633e3b2c7933ddb2434a5c891a765b523ace
Python
4,246
91
"""Defines the Multinomial NLL loss and the adaptive counts loss. These are derived from the basepairmodels repository, which is licensed under an MIT license. You can find a copy at ``etc/basepairmodels_license.txt``. """ from collections.abc import Callable from bpreveal.internal import disableTensorflowLogging # p...
eaff743e3111af8cd179006eeb9b0fc9cf7aa19bd7c7617da239b9fd01e103c4
Python
4,249
108
"""Tests for the AdditiveNoiseModel (ANM) simulator dataset.""" import numpy as np import pytest from skbase.utils.dependencies import _check_soft_dependencies from pgmpy.base import DAG from pgmpy.datasets import list_datasets, load_dataset def test_load_anm_dataset(): ds = load_dataset("anm", seed=42) ass...
4eaee1bfc548564cdb7da53e7ffc776c5eb60472e65c4be13510aa5f0db1cdcc
Python
4,250
137
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from glob import glob from vlpp.utils import add_suffix, nfmap2dict, warn, run_shell, gzipd, run_matlab, TPL_PATH from vlpp.registration import applyWarpImageMultiTransform, estimatePet2Anat def main(): transitional = "${transitional}" mode = "${config...
6186379a88269be4c7ab3f75c47e780ea8c92ac3d962371e3463ecf7a5a8ce4b
Python
4,251
115
# Copyright 2020 The Lucent Authors. 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 applicable ...
3abee3d17a29184a177d7c3f1c5564f05c8dce8ce425f47d0a8b297b0b0c3746
Python
4,253
147
"""Central registries for dataset / model / task plugins (see ``dlbase/plugin_bootstrap``).""" from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Any, Callable, Type from omegaconf import DictConfig class TaskModule(ABC): """Abstract task...
432bef58eed978f3b36b02631b3e042223ce67614b431d3a173c9b98fa76ca1d
Python
4,253
114
""" This module contains dataloaders for the training of Garfield model. """ from typing import Optional from torch_geometric.data import Data from torch_geometric.loader import LinkNeighborLoader, NeighborLoader def initialize_dataloaders( node_masked_data: Data, edge_train_data: Optional[Data] = None, ...
7da8528466fea9c91f0293e3c51dbd60486b51efc9b5d979f6dd5c61a4246eb1
Python
4,254
117
import vtk, qt, slicer class AbstractEffect(): """ One instance of this will be created per-view when the effect is selected. It is responsible for implementing feedback and label map changes in response to user input. This class observes the editor parameter node to configure itself and queries the curr...
1f367ad7adf80d69136d709dee0dfd7086b74bcea157eb7948ab1b4d13bd986d
Python
4,255
100
import cv2 import cmapy from PIL import Image import numpy as np from msi_visual.utils import normalize_image_grayscale, image_histogram_equalization class SegmentationUMAPVisualization: def __init__(self, UMAP_model, segmentation_model): self.UMAP_model = UMAP_model self.segmentation_...
3fb399dc483fdd4258949c966cc5927177f9f80ec2cecd775d50b274463d3175
Python
4,259
126
"""script to download sample data for vak autoannotate tutorial Adapted from https://github.com/NickleDave/bfsongrepo/blob/main/src/scripts/download_dataset.py """ from __future__ import annotations import argparse import pathlib import shutil import sys import time import urllib.request import warnings DATA_TO_DOW...
733c0814737decb73f1127b75b8323e6d6d45980b04d7cccb2ae4199345bd93f
Python
4,260
107
# 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 from dataclasses import dataclass import torch.nn.functional as F from fairseq import utils from fairseq.logging import metrics f...
b5f6b938a31d51150ebf2698c6a117b743eb613918d3d68f9b7d9d769b09c96c
Python
4,261
130
import numpy as np import itertools from mdt.lib.post_processing import DTIMeasures, DKIMeasures from mdt.model_building.parameter_functions.priors import AlwaysOne, UniformWithinBoundsPrior from mdt.component_templates.parameters import FreeParameterTemplate, ParameterBuilder from mdt.component_templates.compartment...
00788409425336ea490542ba172917ffe4893dde3a458f55e5ac67a215c48dfd
Python
4,263
118
try: from importlib.metadata import version except ModuleNotFoundError: from pkg_resources import get_distribution version = lambda name: get_distribution(name).version from . import train, pre, scKANFormer_model from .train import fit_model from .pre import prediect import os name = "scKANFormer" __vers...
1cb89692356f4aab15a9641f0566eada20e70de1ca7776621f7b2616dd8a641f
Python
4,265
105
import torch from torch import nn from torch.nn import functional as F class GroundTrans(nn.Module): def __init__(self, in_channels, inter_channels=None, mode='dot', dimension=2, bn_layer=True): super(GroundTrans, self).__init__() assert dimension in [1, 2, 3] if mode not in ['gaussian', 'em...
08f3f9760d2f95c1ffd32e91a9dbd36123c4168ed2bded8d0ab35852236269a3
Python
4,266
143
from __future__ import annotations from typing import TYPE_CHECKING from typing import TypeVar import pytest from cleo.testers.application_tester import ApplicationTester from poetry.console.application import Application if TYPE_CHECKING: from pathlib import Path from poetry.utils.cache import FileCache...
f79d3da5c08290ebcfc64bccb1780778ccee4f901cdc9a6365b99ed9a1751fc4
Python
4,268
121
import logging # from lifelines.utils import concordance_index from sklearn import metrics from sklearn.metrics import accuracy_score def evalualte(y_test, y_pred, y_pred_score=None): accuracy = accuracy_score(y_test, y_pred) # score_train = accuracy_score(y_train, y_pred_train) if y_pred_score is None: ...
2f9941853d82817cd5d434bcf29e4b5bfc9bb1e2a5681bc2c96e6cb6a9404ec6
Python
4,269
120
import numpy as np import scipy.signal from scipy.linalg import sqrtm import cv2 as cv def Extend_Spatial_Decorrelation(v,xdim,ydim,dx,dy,dr): ##xdim是heigh,ydim是width stacktmp = [] n,m = v.shape ##对数组做调整 s = np.zeros((xdim*ydim,n)) for i in range(n): tmp = v[i, :] tmp_...
6352739fbe76834c9f25bfdc906ab7d5f04b370e96e6108bbb60e16239934898
Python
4,269
108
#!/usr/bin/env python3 """Encode all Hausser (mouse) and Lisberger (macaque) cells into 16-D latent space, then save per-cell z vectors for latent-space flow visualisation. Output NPZ keys: {ct}_z_mouse (N_mouse, z_dim) float32 {ct}_z_macaque (N_mac, z_dim) float32 {ct}_wave_mouse (...
0b711c6feb102ccd2295250f45bc9417ed9d33cfb9cf5c714f2a87698f75b1b4
Python
4,271
183
import os from jinja2 import Environment, FileSystemLoader from pyecharts.commons.utils import JsCode class _RenderType: CANVAS: str = "canvas" SVG: str = "svg" class _Locale: EN: str = "EN" ZH: str = "ZH" class _FileType: SVG: str = "svg" PNG: str = "png" JPEG: str = "jpeg" HTML...
9f5cde90f3053484c70ae32bdfca14a0efcacfe5fc076b70e2bb72bab094ee72
Python
4,271
132
#!/usr/bin/env python3 # Written by Pranathi Vemuri, later modified by Jonathan Manning and released under the MIT license. import logging import os import platform from collections.abc import Iterator from itertools import groupby def setup_logging() -> logging.Logger: """Configure logging for the script. ...
c74b5c90f342822615a329bcbd7feb418fe76922ac5e17182ad2504369b5d211
Python
4,272
119
import warnings from importlib.util import find_spec from beartype.typing import Any, Callable, Dict, Optional, Tuple from omegaconf import DictConfig from src.utils import pylogger, rich_utils log = pylogger.RankedLogger(__name__, rank_zero_only=True) def extras(cfg: DictConfig) -> None: """Applies optional u...
c7a199711718c90349554d01fb2714918ff2682f2acb5cad8ded1eb5ae213669
Python
4,272
136
from layers import * from utils import * flags = tf.app.flags FLAGS = flags.FLAGS class Model(object): def __init__(self, **kwargs): allowed_kwargs = {'name', 'logging'} for kwarg in kwargs.keys(): assert kwarg in allowed_kwargs, 'Invalid keyword argument: ' + kwarg name = kwa...
fdd65454f5ccc538a5ab3ffef72a2e619a1318f5c001deff5a58ba48128a9097
Python
4,272
122
""" This code is to create a upper triangular cosine similarity matrix for all pmids. author: Vishnu Vardhan Dadi credits: [Leyla Jael Castro, Dietrich Rebholz-Schuhmann] copyright: GENERAL PUBLIC LICENSE Version 3, 29 June 2007 """ import argparse import numpy as np import pandas as pd from tqdm import tqdm from n...
c8323d149c55f8ab4acb92f0b6c6cbdeec4f8b02d8fc1cd37a3c9afc8f9d2ddd
Python
4,273
97
import unittest from pathlib import Path from tempfile import TemporaryDirectory from GMXMMPBSA.test_manifest import ( ManifestError, build_help_text, load_manifest, verify_outputs, ) class TestManifest(unittest.TestCase): @classmethod def setUpClass(cls): cls.manifest = load_manifest...
442616e7ce0a58b8213c871d2c0e0364cd25e151596af106e5cc72e8e6ec8a22
Python
4,274
91
"""Robustness of the Paper-#2 benchmark to the data split: refit every model with its canonical tuned configuration across N independent group hold-out splits (different seeds) and report the hold-out R² distribution per model per food. Answers the reviewer question "does the headline depend on one lucky split?" at thi...
052c91287754aa1b61ef02957e6f36e1e887e4f13786697de6ddf85654cd541d
Python
4,278
139
import argparse import json import pathlib import webbrowser import neuroglancer import neuroglancer.cli class Tool: def __init__( self, viewer: neuroglancer.Viewer, paths: list[pathlib.Path], num_to_prefetch: int, ) -> None: self.viewer = viewer self.paths = p...
7bbaee0b1d709d84a0a57ebce76b4e09ac3dd63fd4b5287075796c8128a956fd
Python
4,278
190
import math import torch import torch.nn.functional as F import numpy as np class MSELoss(torch.nn.Module): ''' mean squared error loss function ''' def __init__(self, is_tensor=False): super().__init__() self.is_tensor = is_tensor ...
fb0b6801c9188980d60dd63676917bb7549ef6e57f397af7b7d50e2dfa27040f
Python
4,279
121
import os import anndata import numpy as np import pandas as pd from scvi.data._built_in_data._dataset_10x import _load_dataset_10x from scvi.data._download import _download def _load_purified_pbmc_dataset( save_path: str = "data/", subset_datasets: list[str] = None, ) -> anndata.AnnData: url = "https:/...
544f2de4d011693105202bbd26002a344f8f4077e53dfdd1e4353a3df7138ba4
Python
4,281
88
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/SimpleGNGUI.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObject...
854ba3080c52b62401defb82dabb6162654d3bbf904d09329d95893b919c5607
Python
4,283
93
from mdt import CompartmentTemplate import numpy as np __author__ = 'Robbert Harms' __date__ = '2018-08-27' __maintainer__ = 'Robbert Harms' __email__ = 'robbert@xkls.nl' __licence__ = 'LGPL v3' class Racket(CompartmentTemplate): """Computes the Racket model from [1]. As in the original paper, we optimize "...
44816b4cd2807349ea6cc46422db4be22e1a9cf0c35c768e1ce073d4194adbc5
Python
4,285
107
import numpy as np from sklearn.metrics import (r2_score, mean_absolute_error, mean_squared_error, f1_score, accuracy_score, precision_score, recall_score) def normalize_to_100(pred: np.ndarray) -> np.ndarray: pred = np.clip(pred, 0, None) s = pred.sum(axis=1, keepdims=True) s...
e83ea429a536dac7cec8a885cd3249dbdde94e92daadabc512b6a3a2f48b8b59
Python
4,286
119
"""Options for calculating uncorrected p-values.""" __copyright__ = ( "Copyright (C) 2016-2018, DV Klopfenstein, H Tang et al., All rights reserved." ) __author__ = "DV Klopfenstein" import collections as cx import sys class PvalCalcBase(object): """Base class for initial p-value calculations.""" def _...