sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
6486623b4aec66a964e46ba86b35040ec34b036bc19469a80b6e73332d21e888
Python
4,070
120
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...
af8231f337507021c3a2c2408c18c20bbcc30beb94b5ec9dd316391082729276
Python
4,070
136
import os import sys import argparse from pathlib import Path import numpy as np import matplotlib.pyplot as plt # Parse command-line arguments parser = argparse.ArgumentParser(description='Compute Directional Index (DI) from fMRI forecasting model') parser.add_argument('--method', type=str, default='flow', choices=['...
f4807c538d86bc94b0f1bcbcf8f7634038380d441673b671c8ab554fc89239ff
Python
4,070
114
#!/usr/bin/env python # # Copyright 2007, 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...
5e76b2d37ec785e10145a77a18bd085324479442bded599871d193d55179d1cd
Python
4,071
113
import warnings import numpy as np from anndata import AnnData from pandas.api.types import CategoricalDtype from scvi import settings from scvi.data._utils import _make_column_categorical, _set_data_in_registry from ._dataframe_field import CategoricalObsField from ._mudata import MuDataWrapper class LabelsWithUn...
876749dc0109384d0202a702f2e49a4a59446f8ebee0a60f41aa1603a4bf5cf3
Python
4,072
122
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...
726cf78950cb52678cb0b035d2bd07b43e0fcb5f520d952ac34fe19d4fc62729
Python
4,075
111
#!/usr/bin/env python3 """Compare isolated current and 1.6.5 combination-matrix runs.""" from __future__ import annotations import argparse import json from datetime import datetime, timezone from pathlib import Path try: from .common import compare_csv except ImportError: from common import compare_csv de...
e097b263b539fa53934be48fc15f1f90df026a2410ea9fa5e9c34730614b6bfa
Python
4,075
167
"""Common API for torch and numpy backends.""" from copy import deepcopy import numpy as np from skbase.utils.dependencies import _check_soft_dependencies, _safe_import from pgmpy import config torch = _safe_import("torch") def _is_torch_tensor(obj): if not _check_soft_dependencies("torch", severity="none"): ...
26bee165eafdd1618861d8096cff8d058c8df8f4365a549686f35e9a094ee296
Python
4,076
143
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...
e2417aef8a71ef40717933e351c62975d5cfd780ad6feb6129ad9c1acf58f429
Python
4,076
135
from scipy.s 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 == group + "b", ["Root_x", "Root_y", "Root_z"]] c = df.loc[df.Subtype == group + "c", ["R...
0fba3be193fbdc9361adab67fbaf5ec3d1059d4cddfea5de7d2b2b1614e51d39
Python
4,077
99
import pandas as pd import numpy as np from neuron import h import simulator.model.saveClass as sc import simulator.model.simulation as simulation from simulator.model.ca1_model import CA1 from simulator.model.ca1_functions import init_activeCA1, addClustLocs, genRandomLocs, add_syns from simulator.model.sim_functions...
f134b1f202966f4b0b8685406f143c44537d4b698e8d7966ef512b92a17c93b1
Python
4,077
110
""" moosez label -> standardized coding for DICOM Segmentation (DICOM SEG). The mapping is sourced from the curated table ``moose_snomed_mapping.csv`` that ships next to this module, and is exposed as the module-level dictionary ``moose_to_snomed`` (keyed by moosez label name). Compared with the previous hand-maintai...
61f5b6e94185312fe576b9ea7121a9ebb15513e17b0cb6a88e567bedd637185f
Python
4,078
109
from __future__ import annotations from typing import TYPE_CHECKING import torch if TYPE_CHECKING: from collections.abc import Callable, Iterator from typing import Any from torch import Tensor from ._module import NicheLossOutput def compute_composition_error( module: Callable[[dict[str, Ten...
b1cd8ec0455f5d165e5a5914dfc8353709558799940f1c2afc12e8c99cbdcf6d
Python
4,079
132
import logging import pandas import numpy from numpy import dot as d from scipy import stats from .. import Constants from .. import Exceptions from ..PredictionModel import WDBEQF, WDBQF class ARF(object): """Association result format""" GENE = 0 ZSCORE = 1 EFFECT_SIZE = 2 SIGMA_G_2 = 3 N_SN...
05b930d0f160695ace5985d3ae5a6c656e2643ed731541a18fda02c3b23a843f
Python
4,080
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=0.5): ''' This function is to implem...
eb1acd6c39577ff251a4e84478bc349c49c9bb503b7c3b8acc9ee46ece9b309d
Python
4,080
102
import os from pathlib import Path import pandas as pd from numcodecs import Blosc #set this for multiple processing Blosc.use_threads = False #distributed processing of masks import dask from dask.distributed import Client from WSIAnnotation import WSIAnnotation from ROIAnnotation import ROIAnnotation def dask_ag...
46c64b73387689021d09a67969f3b6c06ddbdfea7f061db097bca97bbe97cf86
Python
4,081
99
#!/usr/bin/env python """Compare pattern-similarity maps to Neurosynth meta-analytic maps (R6, Fig 5). Correlates each condition's parcel z-map (from run_neural_pattern_sim.py) with the auditory / sensorimotor / language / default Neurosynth association maps, and reports, for every condition x term: r = Pear...
90d1fd3718ffed5a9c14df175e2398c72c0fc363a0510aba81842c91ef37b546
Python
4,084
180
from enum import Enum from torch import nn class TrainMode(Enum): # manipulate mode = training the classifier manipulate = 'manipulate' # default trainin mode! diffusion = 'diffusion' # default latent training mode! # fitting the a DDPM to a given latent latent_diffusion = 'latentdiffusion...
f377bb61b00c87f5938e0fbbd907f72fa1e8433cd47261d877cda4f374275720
Python
4,084
112
import networkx as nx from pgmpy.base import DAG from pgmpy.identification import Adjustment, BaseGraphicalIdentification from pgmpy.utils.sets import _powerset class Frontdoor(BaseGraphicalIdentification): """ Given a causal graph, finds the set of variables satisfying frontdoor criterion. Given a caus...
7df3dec3018d90f4f988f7d9dd794eb9055bdf68a7ebc897f8a7237331ddda9d
Python
4,085
79
import numpy as np from mot.sample.base import AbstractRWMSampler from mot.lib.kernel_data import Array __author__ = 'Robbert Harms' __date__ = '2018-08-14' __maintainer__ = 'Robbert Harms' __email__ = 'robbert@xkls.nl' __licence__ = 'LGPL v3' class FSLSamplingRoutine(AbstractRWMSampler): def __init__(self, ll_...
227df2d0021178410ace47b2d3afa16bde6fa0908391b1569c5937a6204de5bf
Python
4,086
95
from abc import ABC, abstractmethod from typing import Type import numpy as np from numpy import number class ImageNormalization(ABC): leaves_pixels_outside_mask_at_zero_if_use_mask_for_norm_is_true = None def __init__(self, use_mask_for_norm: bool = None, intensityproperties: dict = None, ...
c3ef9003d7844977770148d797f4523c13cb34d68c4284400aa295dd38ffce90
Python
4,086
82
#!/usr/bin/env python3 """A simple tool to generate a bed file that tiles a genome.""" import argparse import pybedtools import pysam from bpreveal import logUtils from bpreveal import bedUtils def getParser() -> argparse.ArgumentParser: """Generate the parser.""" ap = argparse.ArgumentParser( descrip...
20ad71d927eba3af6bf6496bcf9434ea9f03052459bb0a618929b7e189187b0f
Python
4,087
138
# -*- coding: utf-8 -*- """ Created on Sat Aug 3 11:43:24 2019 @author: 俊男 """ # In[] Define the Class for Checking Linear Regression Assumption import matplotlib.pyplot as plt import scipy.stats as stats from pandas.plotting import autocorrelation_plot import pandas as pd import seaborn as sns import numpy as np c...
8004322da26bbb0bfd7023ca35008a435787f7799248a04a1b6436b6e7db0893
Python
4,089
124
import os import numpy as np import pytest from scvi.data import synthetic_iid from scvi.model import AmortizedLDA @pytest.mark.parametrize("n_topics", [5]) def test_lda_model_single_step(n_topics: int): adata = synthetic_iid() AmortizedLDA.setup_anndata(adata) mod1 = AmortizedLDA(adata, n_topics=n_topi...
f6eea02da3d52b44fc99f6978e19a840217f29696052348e3e6da06c439b2d77
Python
4,089
104
import re import os import logging import numpy from .Genotype import GF from .. import Utilities from ..misc import Genomics class DTF: """Format of dosage""" CHR = 0 ID = 1 POSITION = 2 ALLELE_0 = 3 ALLELE_1 = 4 FREQ= 5 FIRST_DATA_COLUMN = 6 def dosage_file_geno_lines(file, variant...
0eb5fe9a447395b1a41935fe525e901c33be73f665dff34197de795f07e64602
Python
4,090
135
from scipy.spatial import 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 == group + "b", ["Root_x", "Root_y", "Root_z"]] c = df.loc[df.Subtype == gr...
bce7a4c5b2bde652fb60e3b112904a6adc87365b58a245d5aa9733cf6e597ec6
Python
4,090
129
import os import sys # Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sp...
8aac789e72a43928bd4a9a819e9aef80310f707908fde400ca5e09fcc2995942
Python
4,091
118
# 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 Counter from typing import List import torch def align_bpe_to_words(roberta, bpe_tokens: torch.LongTensor, other_to...
faa35eda60572c4cd3cc817ed91565d964ec2149085bff0f417ff5b5ef69226c
Python
4,091
118
# # 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 import time import os # Use this file to produce a list of ADC (min...
016184a0d165197cf90059de650304522720a11b36bab13468e83536b9c87b39
Python
4,092
110
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torch.nn as nn from tractseg.libs.pytorch_utils import conv3d from tractseg.libs.pytorch_utils import deconv3d class UNet3D_Pytorch_DeepSup_sm(torch.nn.Module): def __init__(self, n_...
3d2a81dbd4171d4619bad4a46eaf13387fd38a5f755fa26d706e42a3a2e85235
Python
4,092
121
"""Configuration for deployment-oriented logit knowledge distillation.""" from __future__ import annotations from dataclasses import asdict, dataclass, field from typing import Any, Dict, List, Optional import yaml @dataclass class DistillationConfig: """Configuration consumed by :class:`DistillationTrainer`. ...
93aea995c71599c461f9e607e79980d87df0eecb9014346ed161701640fb80f0
Python
4,095
136
import logging import pandas from patsy import dmatrices import statsmodels.api as sm from .. import Exceptions class Context(object): def __init__(self): raise Exceptions.ReportableException("Tried to instantiate abstract Multi Tissue PrediXcan context") def get_genes(self): raise Exceptions.NotImplemented...
389d7dabf1794f52ea06e071a0322dd36f49b358cf32abe4072f2954a636778a
Python
4,096
115
#!/usr/bin/env python """Example of displaying interactive image-to-image "inference" results. shift+mousedown0 triggers the inference result to be computed for the patch centered around the mouse position, and then displayed in neuroglancer. In this example, the inference result is actually just a distance transfor...
42b65f62db3ab2fe0b45fee29e868ff07f6430fe05a100cb3c333b4b8d65d537
Python
4,096
135
from scipy.spatial import KDTree 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 == group + "b", ["Root_x", "Root_y", "Root_z"]] c = df.loc[df.Subtype...
63149036a08249ea51f370bb524324cbe44df558c054a2036892180646333f44
Python
4,098
113
# @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...
0b7e80a4fd3845a44243e51768cfdfb11a0d7bb713e442f4dcfe6465f4a39d75
Python
4,099
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): ''' This function is to implement the test...
9090fbeef0d2c23356bf588986ae2562d17f1fd01ba55a805bc01405365499f1
Python
4,100
96
# -*- coding: utf-8 -*- """ .. _tutorial01_ref: Tutorial 1: Quick Start ======================= This tutorial gives a quick overview of ``surfplot`` before diving into more detail in subsequent tutorials. The aim here is to get a flavour of how ``surfplot`` works and what can be plotted. Getting surfaces ---------...
6d0b9abd8b8ebd484649f3564b93b019cd0949dae5ff4cdb38935f79a99abd72
Python
4,103
135
# 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 librosa import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torchaudio EMBEDDER_PARAMS...
90e7b26efa0f988115b8ee9782ed46c6e5aa621d00c08b6e2cb2e0cf0fd0fab4
Python
4,103
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): ''' This function is to implement the test...
15af72f1452be6de9cd0b21733290f9a07c4b5793037618b73d6e169f0a327b3
Python
4,105
101
# 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 fairseq import utils from fairseq.criterions import register_criterion from fairseq.criterions.label_smoothed_cross_entropy ...
2cf21d9a24afedfc7a8626a2b275e28b3a6c6534a590c0f3a69efd7a8f5e766a
Python
4,105
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): ''' This function is to implement the test...
9e9327e335ea5eb7da63644f63b56836e26ab99c9366c5c9db2f6a02d7e04ab7
Python
4,105
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): ''' This function is to implement the test...
7e205a2dc58e67891ed82570c94c068b033849d0400d8fe5be4323e813d44d2c
Python
4,106
129
# 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 required by applicable law or a...
fbd44be878693fb3aa27476a9ce9b6eeab6ec0dfcbc974b0a2843f4136dfed8c
Python
4,106
120
# Originally from Microsoft Corporation. # Licensed under the MIT License. """ Wrapper for ngram_repeat_block cuda extension """ import math import warnings from typing import List import torch from torch import nn try: from fairseq import ngram_repeat_block_cuda EXTENSION_BUILT = True except ImportError: ...
0fe6d247e9498de9b28296b207b343d9ba76cabb8e3c3616e415610a368bc2c0
Python
4,109
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): ''' This function is to implement the test...
4781a369ea5a1d3981ffd73c98e3322e70829308335d6d05c5bf7574fed5ba46
Python
4,109
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): ''' This function is to implement the test...
be3d04810e7af4b30d43410f26d255b1f649a626658bf06e2cc8f7e953dff86b
Python
4,110
82
"""A wrapper around the ushuffle C implementation.""" import threading import numpy as np from bpreveal.internal import libushuffle from bpreveal.internal.constants import ONEHOT_AR_T # The ushuffle implementation in C makes heavy use of global variables. # To avoid multiple threads trampling over each other and causi...
62eac885202f6c489331b630f7f93c370aebf88f7697b0a4ff61cf53a090c778
Python
4,113
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): ''' This function is to implement the test...
792d28dc740f2289197cfe5b7ff7a51b25ab6aef33cc0014ab5c2d3da7b03869
Python
4,113
118
"""Deprecated GPN-MSA model definitions for inference compatibility.""" from typing import Any import torch.nn as nn from jaxtyping import Float, Int, Num from torch import Tensor from transformers import PreTrainedModel, RoFormerConfig from transformers.modeling_outputs import BaseModelOutput, MaskedLMOutput from tr...
cbc78e7f6b377bfc5a4fa85d2113f908a4bf174d204c50f655026da03a5b5898
Python
4,113
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): ''' This function is to implement the test...
d85c3c49dcf38d24a23c6748cdf13625e78b4c69277075c09c94e991a6512cfb
Python
4,114
111
# 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...
0efae07f115c8edb17ef7d3702c38b83f574f1b70b47ca3c4f50963b35762b2a
Python
4,115
108
import os import pandas as pd from config_path import GENE_PATH from os.path import join, dirname, exists current_dir = dirname(__file__) processed_dir = 'processed' data_dir = 'external_validation' processed_dir = join(current_dir, processed_dir) data_dir = join(current_dir, data_dir) if not exists(data_dir): o...
3b7e5ddcfdac055d9c5abd4bdc0d79706fdbb67280157f7306bbe76d1f031963
Python
4,115
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): ''' This function is to implement the test...
48300cfe5df3dd6ceb69cf35bb7afe3c8de7c82b80ccd0749ec48dfb0ef61268
Python
4,115
136
from scipy.spatial import KDTree import numpy as np 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 == group + "b", ["Root_x", "Root_y", "Root_z"]] c ...
583abb58a682509a6c113a75741d8a5c0afd5e45c96bd82cb5f11ea5a9214d87
Python
4,115
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): ''' This function is to implement the test...
993d46efed23a41107c4741414c1fd436f9e36c456647d2f8bff21168275ae0e
Python
4,115
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): ''' This function is to implement the test...
f061db46d558a20c877728585af60201f062408ae0bfeb2e98b2d046830b8709
Python
4,115
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): ''' This function is to implement the test...
fbb34db5908f232ce6f3d5567f33f88e0bb3451326b8d95194a710979802631c
Python
4,115
112
# 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...
5275b7cd7e91613aad6bf7fce58ac946350f8a72e45e2ed2e3c00d46a7351950
Python
4,116
114
import numpy as np import torch import pytest from pathlib import Path from neurovfm.pipelines.preprocessor import StudyPreprocessor import neurovfm.pipelines.preprocessor as preproc_mod import neurovfm.data.io as io_mod import neurovfm.data.preprocess as pp_mod @pytest.fixture(autouse=True) def _patch_io_and_prepr...
c1db097c21e63617de1024ca86ce2b1ad91cdf29cb37b84575512fb8c07e989c
Python
4,116
122
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.helpers import argument from cleo.helpers import option from poetry.core.version.exceptions import InvalidVersionError from poetry.console.commands.command import Command if TYPE_CHECKING: from cleo.io.inp...
fa016b84fe300b5fd05e94e235b883579c37c163b757706e723a7a40c93ae189
Python
4,116
89
import os import csv import subprocess from concurrent.futures import ThreadPoolExecutor import time # Function to run DrugReAlign.py for each PDB entry def run_drugrealign(pdb_name): try: # Run the DrugReAlign.py script with the PDB name as an argument subprocess.run(['python', 'DrugReAlign.py', '-...
2485c36f871da1ddccd7d2078dc9d6314af9700bded5a74857ec1d26d2c3d8ae
Python
4,117
138
from scipy.spatial import KDTree import numpy as np 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 == group + "b", ["Root_x", "Root_y", "Root_z"]] ...
ae39021d21884ceed64ef6056352e02f0aeedc96b95813f13c0d93f61c32caa3
Python
4,119
97
from ... import options as opts from ... import types from ...charts.chart import Chart from ...globals import ChartType class TreeMap(Chart): """ <<< TreeMap >>> TreeMap are a common visual representation of "hierarchical data" and "tree data". It mainly uses area to highlight the important nodes in...
78c1e1d3a36a1ef2a0e28f171c4aeb385aba178adfc2c77d099740fdbcc1cec7
Python
4,122
114
"""Align embeddings using Procrustes method """ import numpy as np def match_coords(C1, C2): idx = [] idxlist = range(C2.shape[0]) for pt1 in C1: idxremain = np.setdiff1d(idxlist, idx) idxmatch = np.argsort(np.sum((C2[idxremain, :] - pt1) * (C2[idxremain, :] - pt1), axis=1))[0] id...
febb7637733623a640206489d7c89bc38a74faa08881dbcc79cae8294a5f5bd8
Python
4,122
137
import json import logging import os import urllib import xml.etree.ElementTree as ET from collections.abc import Iterable import pandas as pd import xmltodict from Bio import Entrez from tqdm import tqdm import config Entrez.email = config.entrez_email references = pd.read_csv(config.references_file) logging.basi...
243744cfa624a48460d70f7b5e6964b4e8bf78b2600692f0d76e7e734fa9d227
Python
4,124
115
import pandas as pd import matplotlib.pyplot as plt import numpy as np """ This script summarizes how many independent components are found across a population of chromatophores. It loads the combined ICA output file, extracts a single component count for each chromatophore, and builds a clean distribution of how many...
c92403ec7d62d953aec73f83abb2560c0e0bc6064101c06014e3ef38b345cc8d
Python
4,129
94
import numpy as np from common.utils import _arctanh_tanh_converter, _log_exp_converter class UnivariateParams_obsolete(object): def __init__(self, pi, sig2_beta, sig2_zeroA): self._pi = pi self._sig2_beta = sig2_beta self._sig2_zeroA = sig2_zeroA self._validate() def copy(sel...
d6606eed1034473de5f9dc4e48e742a802ef1a83f63515b7d20172ff26a29b96
Python
4,129
95
"""Controller for static behaviour settings and visibility toggles.""" from __future__ import annotations import logging from src.data.behaviour_settings_io import save_behaviour_static_inputs from src.persistence.app_paths import config_file_path logger = logging.getLogger(__name__) class BehaviourStaticInputsSe...
5d11f0aa84003256c157a63e362e46923663bf8b5269143ac38c57fdb5bf2033
Python
4,130
106
# 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 import unittest from tempfile import TemporaryDirectory from fairseq import options from fairseq.binarizer import FileBinarizer, Vo...
65f7dc2cafaa856a273390988fe37ec8da50e4cfecac889c7781faf699628f79
Python
4,132
88
""" ============================================================================ fig03or_perfusion_channel_split_merge__fig_3o-r_local_perfusion_eeb3073b.py — Fig 3r perfusion ============================================================================ What this script does: Jython for ImageJ: 3-channel deinterleave/m...
f26d0f6c1b7d87b5a1a36578fb5ae60cbfe5ec89cb636cc9168f62d6d40e61d5
Python
4,137
116
import torch import torch.nn.functional as F import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt import numpy as np from scipy.io import savemat from .math import fft, ifft, conv_fft, wrap_phase, calculate_psnr from .math import nm, um, mm, cm, m from .light import Light from .propagator i...
8fd779d13ec0dbd8c1d94770603985dd16bf1bf0e999addfd143fe186b03228d
Python
4,138
100
"""Shared statistics helpers. All permutation / z / FDR math is transcribed verbatim from the original scripts (`pattern_similarity/utils.py`, `paper_revision_analyses/emotion_ratings_specificity.py`, `format_parcel_results/parcels_to_brain_fdr_revision.py`). The only change is that stochastic helpers take an explicit...
1642d4b6db3522b7105839636ac0cb4bb9bc5553877a0964cd9743221ff6c34e
Python
4,140
121
"""Shared cell morphology metrics: area, convexity, elongation. Works on integer instance segmentation maps (0 = background, 1..N = cell IDs). Uses ``cv2`` for contour extraction and ``numpy`` for covariance eigenvalue analysis. """ from __future__ import annotations from typing import Dict, List, Tuple i...
a950dc8b6aa2bb933e4a94693fc59a3cfbb1f71ec0e04c7ab2de69d5f32740df
Python
4,140
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. import unittest import tests.utils as test_utils import torch from fairseq.data import ( BacktranslationDataset, LanguagePairDataset,...
0b5353c1ad1cac94e202add12eb5175b3c604efd59bc7f22b763441c6c5c8228
Python
4,141
79
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'runtime_settings_dialog.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_RuntimeSettingsDialog(object): def setupUi(self, Ru...
3bf8952a95fba014bbc5e0f7233660bed0cbe865f990b7f113701246260016fd
Python
4,141
108
#!/usr/bin/env python3 """Compara as referencias atomicas recem-calculadas com as versionadas. Existe para fechar a divida de procedencia: os rotulos de cristal de 2026-07-26 vieram do CENAPAD, mas as referencias atomicas corrigidas (caixa de 16 A, SCF.Mix hamiltonian) foram medidas na estacao local. Onde ha comparaca...
c45f0df64e26e3cbff8e918e39c255b432eaacd0769ce8b90341f72a56cb3572
Python
4,142
109
"""Normalize and validate the Windows GPU DLL layout after PyInstaller. PyQt6-Qt6 6.9.1 ships legacy MSVC runtime copies in Qt6/bin. They conflict with the newer official runtime collected by PyInstaller at _internal root and cause PyTorch c10.dll to fail initialization with WinError 1114. """ from __future__ import...
564126d469a87b535cd3ecf0ebe26b620515d8f62f389c41fbef91a780a4cdd4
Python
4,143
131
""" This python file contain utility functions to use embeddings. author: Vishnu Vardhan Dadi credits: [Leyla Jael Castro, Dietrich Rebholz-Schuhmann] copyright: GENERAL PUBLIC LICENSE Version 3, 29 June 2007 maintainer: Vishnu Vardhan Dadi, Lukas Geist """ import os import warnings import pickle as pkl from typing ...
603c26fc3d8613c4ec4e106a636e2062cec28102370277716799cd12b5d6bf33
Python
4,143
120
# 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. """ Linformer: Self-Attention with Linear Complexity """ import logging import torch from fairseq import utils from fairseq.models import reg...
788c7a5a9311126a781969f3933a5068f81e082794f7c19e55859518834d4ec9
Python
4,143
106
# coding=utf-8 # Copyright 2010, The T5 Authors and HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
95333fdf6e1d5d0ca4f34297d2339bba324762d3e9802ec93d3428b3db8e92ba
Python
4,144
107
# coding=utf-8 # Copyright 2010, The T5 Authors and HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
97da3d254e383a463bace74fdd49b82fde29a04674de3d80522ee9287f6a1a49
Python
4,145
125
import os import pandas as pd import numpy as np from neuron import h def measure_AMPA_current(model): """ Measures AMPA receptor-mediated synaptic currents. Parameters: model (object): The NEURON model containing a list of AMPA synapses (`AMPAlist`). Returns: tuple: - AM...
d8487e191523194d19b74f76b831605333de0332a3b80184991dd2eac2493664
Python
4,145
98
from abc import ABC, abstractmethod from typing import Type import numpy as np from numpy import number class ImageNormalization(ABC): leaves_pixels_outside_mask_at_zero_if_use_mask_for_norm_is_true = None def __init__(self, use_mask_for_norm: bool = None, intensityproperties: dict = None, ...
e485a90e6af521938c9f7aa307dd78bafaadff78249b654c21299ba297a67fc0
Python
4,148
106
# 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...
e87801900d172d8076ca38d902a7086333b8b988e2cac79d8ac4737254fd9157
Python
4,148
138
from scipy.spatial import KDTree import numpy as np from .figure_ import ANOVAModel 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 == group + "b", ["Roo...
3c3ebe08fef812c2bdf3e0b6074e333da199f8a94a8e39ff2b16c8c3da4c765d
Python
4,149
131
# 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. """ Signal processing-based evaluation using waveforms """ import csv import numpy as np import os.path as op import torch import tqdm from...
0d93301f4985f7c2bbcad86d9ae0c03a10d39bccff3c4fdc5a944810e3580415
Python
4,150
120
# 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 unittest import tests.utils as test_utils import torch from fairseq.sequence_scorer import SequenceScorer class Test...
002c8f557e7dd46223e34eaf6400b3e3379b7a8022405ed6d22fa10a66f36fab
Python
4,151
120
# -*- coding: utf-8 -*- import pdb import os import glob from multiprocessing import Pool import sys import glob import time import subprocess, re import numpy as np import pandas as pd def run_command(cmd): """Run command, return output as string.""" output = subprocess.Popen(cmd, stdout=subproc...
6f5d717258a6ab8c0e7c524524e723f4cbdc9bf85e93f0bacd91259a53052edf
Python
4,151
125
#!/usr/bin/env python # ENCODE DCC MACS2 call peak wrapper # Author: Jin Lee (leepc12@gmail.com) import sys import os import argparse from encode_lib_common import ( assert_file_not_empty, human_readable_number, log, ls_l, mkdir_p, rm_f, run_shell_cmd, strip_ext_ta) def parse_arguments(): parser = argpa...
bbcb3ffdb49b14a86e854ac898b1d20456687d0222f56133aa7bae6703d2fd20
Python
4,151
139
# /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 scipy.io as sio from sklearn.mixture import GaussianMixture def CBIG_pMFM_fitmodel_empirical(): ''' This function is to implement th...
287877bbb0d391fe7eaa81d55731a222b423f0d852c4be6b46e2214b39dd3143
Python
4,152
138
from scipy.spatial import KDTree import numpy as np from .paper_ANOVA import ANOVAModel 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 == group + "b", [...
6d0099d905268c59e6b4747b5bb6d7064166c026df9cd27939c50fc484a9e8ca
Python
4,153
138
from scipy.spatial import KDTree import numpy as np from .figure_Tools import ANOVAModel 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 == group + "b", ...
d30dd14532ce0e5ab06d80fc9527268d5d72ecfcff28189b96130f83bb584e6c
Python
4,153
139
# -*- coding: utf-8 -*- """ Created on Thu Feb 6 20:52:01 2025 @author: hanna """ # from datetime import datetime import os import pickle import numpy as np from tqdm import tqdm def run_main_get_trial_inds(root_path, pickle_path, modes, dSubject): #File path to save results. # root_path = r'C:\Users...
f603f8c30ed31cad95087b94a31b1eec2abc8f606294507b6f8ebf66685dab34
Python
4,154
138
from scipy.spatial import KDTree import numpy as np from .figure_Tools import point_value 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 == group + "b",...
f66c57cd5c62c5d172be784ee78519fa1286655fbd7bdc61fb99981c077516f1
Python
4,154
153
#!/usr/bin/env python3 """Sweep launcher for convenient reproduction of data for SymmNet paper figure Runs dataset × algo × seed combinations. Sequential run (default): python sweep.py Parallel run with 4 workers: python sweep.py --n-workers 4 Subset example: python sweep.py --datasets cifar10 --algos b...
86ddaaa991fdeaa0a08d8641fb147e25b8adcd1dfc730ed0aeacf1e6130d3393
Python
4,155
100
import csv import tempfile import unittest from pathlib import Path from GMXMMPBSA.exceptions import InputError, MMPBSA_Error from GMXMMPBSA.membrane import (AUTOMATIC, calculate_parameters, diagnostic_paths, needs_automatic_parameters, parse_atom_names, ...
fdf9114137c73bacf6a98fa87848c053705b989c4c297c84cdc38f931a5c97aa
Python
4,155
141
from typing import Optional import logging from dataclasses import dataclass, field, fields import torch from torch import nn import torch.nn.functional as F logger = logging.getLogger(__name__) class BaseClassifier(nn.Module): def __init__( self, in_features: int, mid_features: int | list[int] = 128 ...
6b9d973502e9dcb5d671cf43ee60a254a40614474b2b7f745c1f8ac7fe66e916
Python
4,161
96
# 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 import random data = 'precimed/mixer-test/data' _base_complement = {"A":"T", "C":"G", "G":"C", "T":"A"} def _complement...
dc33207b6878dda0d5bb543875fcbfdbaeb7ea1af62bdd3bae5dd9c06bfb0a7a
Python
4,161
112
import logging import os import anndata import h5py import numpy as np import scipy.sparse as sp_sparse from scvi.data._download import _download logger = logging.getLogger(__name__) def _load_brainlarge_dataset( save_path: str = "data/", sample_size_gene_var: int = 10000, max_cells_to_keep: int = None...
83417929feb87ef483488a4023bac343f097f60bf76b3a625eae7402cac39c91
Python
4,162
85
from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json from nnunetv2.paths import nnUNet_raw, nnUNet_preprocessed import tifffile from batchgenerators.utilities.file_and_folder_operations import * import shutil if __name__ == '__main__': """ This is going to be my test dataset for...
dfbdcc0a837cbea121f1fd526fd7c80b13229a3e701d384b72d707b2aa25de72
Python
4,162
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...