sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
900b655e166ec0f347801ab4c1d8151fa0baf4a67d3710131e07365ee403a8ef | Python | 40,300 | 948 | # -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
# 基础库
import random
import numpy as np
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import math
from torch.nn import functional as F
# 你的项目组件
from DENNs import PINN... |
0e9d6ee63bda9e8acbd230ada9fefc8a051b3d4db1b4ed6db3d3ccf74fc0f00b | Python | 40,374 | 876 | import os
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
from copy import deepcopy
from sklearn.utils import class_weight
from sklearn.metrics import precision_score, recall_score, f1_score, roc_auc_score, accuracy_score
from torch_geometric.data import Batch
import torch
import torch.nn a... |
462bbc2eb104bbea55128723b61463cd1fc26bb966929dd07ed11a3f8cb7a93d | Python | 40,402 | 1,828 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
05_analyze_similarity_subset_composition.py
用于回应审稿人关于 Figure 6 中 20% 相似度点局部波动的意见。
本脚本不训练模型。它基于已经生成的六个训练列表,分析:
1. 六个训练子集是否均为2600条且无重复;
2. 不同比例列表之间是否嵌套,以及两两重叠程度;
3. 各子集的严格靶点类别、UniProt/蛋白家族、结构质量代理指标、
TM-score、标签类型和pK分布;
4. 20%子集是否被某些靶点类别、蛋白家族或坐标质量代理指标主导;
5. 在保持“相似/不相... |
bfcea8370856d6f2e1d582febbb68c051de91843b71a1927685585698ee17d3f | Python | 40,406 | 928 | import os
import unittest
import logging
import warnings
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
from slicer.util import VTKObservationMixin
import json
import LeadORLib
import LeadORLib.util
from LeadORLib.util import Trajectory, Feature
from LeadORLib.Widgets.tables import FeaturesTab... |
4bc8f98c02508d832ec090107f83983e5e7a1239368365586fed0ee82ffd9381 | Python | 40,426 | 1,079 | from __future__ import annotations
import io
import json
import math
import os
from collections.abc import Hashable, Iterable
from typing import Any
import networkx as nx
import numpy as np
import pandas as pd
from scipy.stats import multivariate_normal
from pgmpy import logger
from pgmpy.base import DAG
from pgmpy.... |
b727174af804e45d91ae60f06da50de5c805e7235d0ada87644abe1337c225f8 | Python | 40,491 | 912 | from data_provider.data_factory import data_provider
from experiments.exp_basic import Exp_Basic
from utils.tools import (EarlyStopping, adjust_learning_rate, visual, write_into_xls, compute_gradient_norm,
find_most_recently_modified_subfolder, compare_prefix_before_third_underscore, compute_we... |
1ba120de1e330aa7a5e3c71d2daeaf6e811a62314b0c1f29f6f4bea789a09281 | Python | 40,516 | 1,077 | import warnings
import numpy as np
import pandas as pd
import os
from collections import defaultdict
import networkx as nx
from scipy.spatial import distance
import scipy
from scipy.sparse import csr_matrix
from sklearn.cross_decomposition import CCA
from sklearn.neighbors import NearestNeighbors
import ... |
4c414b61bfe9640c57d755ca97cfc74c60edbb5b1b6b64a53f8b4a0328e06411 | Python | 40,523 | 859 | import os
import shutil
import json
from glob import glob
import skimage
import numpy as np
import torch
import torch.optim as optim
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import pado
from pado.light import *
from pado.optical_element import *
from pado.propagator import... |
9e6cb8a6cdfef3253ceca183ac7c96e432f94e44fe41eac29ee3cfd08fb3dc11 | Python | 40,578 | 909 | from typing import List, Union, Tuple
import numpy as np
import torch
from batchgenerators.dataloading.nondet_multi_threaded_augmenter import NonDetMultiThreadedAugmenter
from batchgenerators.dataloading.single_threaded_augmenter import SingleThreadedAugmenter
from batchgenerators.transforms.abstract_transforms import... |
43569ae1868bb45f083c20d87cd443b1d0e865ea61f2c8677050a75996f61842 | Python | 40,677 | 1,010 | # 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... |
a34596f74411405d6c6cc251721364f4ad30c0731aa597f6eda10693e26a698e | Python | 40,717 | 1,020 | # 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 sys
from typing import Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from fairseq impo... |
5c3f97b5843478d09288904d986939b626be5e81f6aab459a13212b87cb61c6b | Python | 40,811 | 1,085 | import gc
import math
import warnings
from typing import Dict, Mapping, Optional, Tuple, Any, Union
import torch
import numpy as np
from torch import nn, Tensor
import torch.distributed as dist
import torch.nn.functional as F
from torch.nn import TransformerEncoder, TransformerEncoderLayer
from torch.distributions imp... |
730bf8d86fcf022395f824e2c7c40d5db1c16c65d8227e860b18ee14d9a4e5c2 | Python | 40,836 | 934 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Modified by Roshan Rao
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... |
14604cda520a11c172dc501580cccea479e25c6b1b497decfc4141c50a734990 | Python | 40,875 | 978 | import io
import unittest
import xml.etree.ElementTree as etree
import numpy as np
import numpy.testing as np_test
from pgmpy.factors.discrete import TabularCPD
from pgmpy.models import DiscreteBayesianNetwork
from pgmpy.readwrite import XMLBeliefNetwork
class TestXBNReader(unittest.TestCase):
def setUp(self):
... |
b00b03c982973c3fe75067cec0b8edf647a5345dc76f1692124c847518426804 | Python | 40,926 | 942 | # 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... |
d69c6073344134d9086ea7a2440e1ca3c673c0f7b1682e1a2074a5081cfaec8d | Python | 40,975 | 945 | # 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... |
c270bf2b775fe707e589a6a3366e67936e290cd4d81213a58ab99fb249be156c | Python | 41,006 | 1,039 | import itertools
import unittest
import numpy as np
import numpy.testing as np_test
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.factors import factor_product
from pgmpy.factors.discrete import DiscreteFactor, TabularCPD
from pgmpy.inference import BeliefPropagati... |
c110f5e44a571cd6b2691f9a416509a937013eff5e26b3c495c508a52ece5f3e | Python | 41,009 | 718 | #!/usr/bin/env python
'''
(c) 2016-2020 Oleksandr Frei, Alexey A. Shadrin, Dominic Holland
MiXeR software: Univariate and Bivariate Causal Mixture for GWAS
'''
import argparse
import json
import os
import itertools
import glob
import traceback
import pandas as pd
import numpy as np
import collections
from numpy impor... |
7b282db23b435cf998f42e853d72089e7141246c8e05697f8d8e5267c05c6762 | Python | 41,013 | 1,106 | """
metrics.py
==========
Analysis functions for spiking neural network reservoir experiments.
All functions are pure (no I/O, no globals). The two time-convention
parameters used throughout are:
t_driven_start [ms] — absolute time at which the stimulus begins,
equal to ``sigstart``... |
5b2da80ebfdef5f935ed67ce00b628ad3d63e1cb4840476f4b204692b111dfd0 | Python | 41,019 | 1,125 | import theano.tensor as T
from .base import Layer
from lasagne.utils import as_tuple
__all__ = [
"MaxPool1DLayer",
"MaxPool2DLayer",
"MaxPool3DLayer",
"Pool1DLayer",
"Pool2DLayer",
"Pool3DLayer",
"Upscale1DLayer",
"Upscale2DLayer",
"Upscale3DLayer",
"FeaturePoolLayer",
"Fea... |
948b5c7d68a3e4e1700cdeb1ee6c4f4cacefd1e447dad221e8954a5c09a0c2a6 | Python | 41,093 | 1,111 | from collections.abc import Iterable
from itertools import chain, pairwise, product
import networkx as nx
import numpy as np
from networkx.algorithms.dag import descendants
from tqdm.auto import tqdm
from pgmpy import config
from pgmpy.base import DAG
from pgmpy.estimators.LinearModel import LinearEstimator
from pgmp... |
8910bdb97dddfaea6cfb2b7fc20e73a2ff3c8273e8d61edf8816f1a6b8807c36 | Python | 41,123 | 989 | """Reading the precomputed token targets in the geometry the model scores.
The store holds per-window codes; the model scores the *aggregated* document.
The codes are carried across that merge by running them through
`aggregate_embeddings` itself rather than restating its overlap arithmetic. The
label space is verifie... |
a55c446b0154e64f2476830f51865de82fc0580dbe8039630c898d792b736598 | Python | 41,165 | 1,093 | # 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... |
9bd5fdf3fb61c9084c56b309021739b58f7e0f18ead1ebb2a279dc8e593b0214 | Python | 41,166 | 1,094 | # 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... |
670047ec4707e0d96856a08c6faa0de8dc37b604968baa4f1244f8ad119e2621 | Python | 41,200 | 842 | # 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 typing import Dict, List, Optional
import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import Tensor... |
eb3cd269062b30555bf6b0b0a2b73a0808f958168b03f162e4fbdcdf6baa53b0 | Python | 41,256 | 1,060 | from collections.abc import Iterable
from typing import Literal
import numpy as np
import torch
from torch import nn
from torch.distributions import Normal, Poisson
from torch.distributions import kl_divergence as kld
from torch.nn import functional as F
from scvi import REGISTRY_KEYS
from scvi.distributions import (... |
58b4e8d057cb749f623d005276f8e23bd7c7b1a7447cd6fdea93dfc7cd248c7c | Python | 41,291 | 897 | # coding=utf-8
# Copyright 2018 Google AI, Google Brain 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
#
# U... |
b575ab6f0c3bc000a8f9c5c62938ae35bdad11a9ca3f679ba2e1c8e56d7329f4 | Python | 41,328 | 898 | # coding=utf-8
# Copyright 2018 Google AI, Google Brain 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
#
# U... |
693594918042acf1259864502bdaba8d59a4825c7a484c3e39c579c56bac1d70 | Python | 41,332 | 761 | import logging
import os
import glob
import numpy as np
import vtk, qt
import slicer
from slicer.ScriptedLoadableModule import *
from slicer.util import VTKObservationMixin
from StereotacticPlanLib.Widgets.CustomWidgets import CustomCoordinatesWidget, TransformableCoordinatesWidget
#
# StereotacticPlan
#
class Ster... |
593050816ae2be184dbd981b6b431c9fe272b1f5adc80e1e51372c98d539ff4a | Python | 41,360 | 884 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.interpolate import interp1d
import skfda
from skfda.preprocessing.dim_reduction import FPCA
from skfda.representation.basis import BSplineBasis
from statsmodels.stats.multitest import multipletests # type:... |
5d73ccdad1d9832ce177263cd24561a2298ac7fe12f6e6519f01744b77bdfa4a | Python | 41,546 | 1,102 | #!/usr/bin/env python3
"""Spiking microcircuit model: InputLayer, Layer, OutputLayer, and Network."""
import time
from itertools import repeat
from typing import Any
import numpy as np
import numpy.typing as npt
from .utils import MovingAverage, Tracker
AllSpikes = list[list[float]]
WeightsList = list[dict[str, np... |
9cdfc4b28bc85c1ae3054a9802a61b9e076e557257388508fb4ffb88da5573b5 | Python | 41,681 | 1,030 |
'''
source: https://github.com/drorlab/gvp-pytorch/blob/main/gvp/data.py
'''
import os
import warnings
import numpy as np
import pandas as pd
from tqdm import tqdm
import random
import torch, math
import torch.utils.data as data
import torch.nn.functional as F
import torch_geometric
import torch_cluster
from co... |
76f08f4cb70f3680355ff161dcdacf8401e020ae15126671b36308e0cabfa2b4 | Python | 41,883 | 974 | #!/usr/bin/env python
"""Compact parameter sensitivity analysis for CNN porosity reconstruction.
The script is intentionally standalone. It reuses the physical definitions from
the benchmark workflow, but exposes empirical parameters explicitly so reviewer
responses can discuss sensitivity rather than fixed hidden con... |
3556f0e5171dbe35c3d5bce07d9f5ff6b2d0f8d364368d1d416695b7140aa889 | Python | 42,061 | 953 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Segmentation and evaluation for SynMarker MIP composites.
Inputs:
- Root folders with MIP TIFFs named like:
WellA1_Seq0000_1_iN_d38_Ctrl_Basson-488_SYP-568_tubulin-647.nd2 (series 01)_MIP.tif
Outputs per root:
- ./_out/metrics/per_object.csv
- ./_out/metrics/per_im... |
0893d6dcbc472085d33f2a9cb17e3faea6c289d09b14da9886595a2e568280c1 | Python | 42,084 | 1,130 | # /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import csv
import math
import time
import numpy as np
import torch
import scipy.io as sio
'''******************** Functions for computing simulated BOLD signals **************... |
5be66b9cd13f687e899f164a89f07767effb4de4018ccadf40c26d980cd8b96d | Python | 42,102 | 922 | import numpy as np
import matplotlib.pyplot as plt
import igraph as ig
from copy import deepcopy
from matplotlib.cm import ScalarMappable, get_cmap
from matplotlib import cm
from matplotlib.colors import LinearSegmentedColormap, Normalize
from igraph.drawing.colors import ClusterColoringPalette
import random
import os
... |
ab1fa941cd92697e23d88feb61c7dd29aec20705e21c488abdfba308fef7d8e1 | Python | 42,103 | 838 | import collections
import logging
import logging.config as logging_config
import os
from contextlib import contextmanager
import numpy as np
import mot
from mot.configuration import CLRuntimeInfo, CLRuntimeAction
from .__version__ import VERSION, VERSION_STATUS, __version__
from mdt.configuration import get_logging_c... |
f679a6c8570264233b24692c39c3a603ba9e589c16af1962ee3e468e63e98c77 | Python | 42,149 | 780 | ###主要功能:在已经获得的组内叠加平均数据的基础上进行时间窗叠加平均和组间叠加平均
###首先在第29行设置需要保存结果的日期文件夹
###时间窗叠加平均:1)先选择视觉刺激或电流刺激
### 2)在visualresults或者/electricalresults中选择已经被组内叠加平平均的数据组
### 3)按顺序依次处理完所有数据组
###组间叠加平均:1)选择视觉刺激还是电流刺激(处理对象是已经进行过时间窗叠加的数据组)
### 2)选择起始数据和终止数据(就是确认哪些组是要进行叠加平均的)
###20210915 将组间叠加的数据添... |
532794013d3bc585c9b48c04fe885d00c0839edcbda4407e99202e3d20ac5020 | Python | 42,219 | 1,790 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
04_reclassify_target_annotations_strict.py
对03步已经下载完成的RCSB/UniProt/GPCRdb注释进行离线严格重分类。
为什么需要这一步
----------------
03步初版分类器把UniProt完整注释文本和GO关联词也用于类别判定,
容易把“与GPCR/离子通道/核受体发生作用的蛋白”误判成这些靶点本身。
本脚本不再联网,也不重新查询UniProt。它只使用更直接的证据:
1. PDB实际接触链的RCSB描述和RCSB EC号;
2. UniProt蛋白名称、家族... |
b4cf8dff99d4461454602be64367f455ffb60355e53a1f3504845c1502428727 | Python | 42,228 | 1,178 | # 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... |
884f7a2e8a948a92efe9eefeb708c8bcaa13de834bb83da7d6dcbd7315f86c06 | Python | 42,300 | 1,049 | # NeuriteKymoAnalyzer: extract tip position and intensities from kymographs.
# Tip detection uses a preprocessed reference channel; intensities use originals.
# Outputs: results_roi###.csv in each kymograph folder.
# Beginner note:
# 1) Point to a folder that contains '*_kymo' folders from the generation script.
# 2) S... |
e6b5b6a0481d73967de31a5aa39b4ba59e788c14243e407577b7f538a14f2519 | Python | 42,407 | 46 | import numpy as np
from pado.material import *
from utils.utils import *
# For convinience, Implement Metasurface with DOE
camera_resolution = [864, 864] # This one is not used at all. see img_res instead.
camera_pitch = 1.85e-6
background_pitch = camera_pitch * 1
baseline = 1500 * camera_pitch
sensor_dist = focal_le... |
40448e16d15a48ee647424096d453606275b8b85e052478ccc3afabea13b9519 | Python | 42,409 | 999 | # -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
# 基础库
import random
import numpy as np
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import math
from torch.nn import functional as F
# 你的项目组件
from DENNs import PINN... |
573b7d1630110ee6cd0c8d1f83987c02dc19271c0d7566c65e9ad77512f3f031 | Python | 42,411 | 998 | # -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
# 基础库
import random
import numpy as np
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import math
from torch.nn import functional as F
# 你的项目组件
from DENNs import PINN... |
88de3a405f0c3de32604935fe71025d42c9a2210cd405ee582674ad50242718b | Python | 42,490 | 1,096 | # Copyright 2022 InstaDeep Ltd
#
# Licensed under the Creative Commons BY-NC-SA 4.0 License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://creativecommons.org/licenses/by-nc-sa/4.0/
#
# Unless required by applicable law or a... |
12b59ff5ab31cd95b0e817bc8701339f2f13da647a51595d43f2dd956248d5b3 | Python | 42,498 | 1,162 | # 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... |
e09aa2c72d12a4d4260542838eee23bb54c1de1bc1b8132291693d8e5d4a83fe | Python | 42,519 | 1,119 | # 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, Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fair... |
b6820819a2d35291ec1bb6315bbf71d97a8c8567cf4f4e512a8607f81fdc849e | Python | 42,602 | 953 | """
Clean-Image-Prediction Diffusion Training Script
Key difference from standard noise-prediction diffusion:
- prediction_type="sample": Network directly predicts clean image, not noise
- Training loss: MSE(predicted_clean, target_clean) instead of MSE(predicted_noise, noise)
- The model learns on the anatomical mani... |
ce2a6548fbe3ce8d5cbb31320e6bcdaca834fbe73b007385e71c1352e2083935 | Python | 42,602 | 1,086 | from email import utils
from functools import reduce
import mne
import os
import pandas as pd
import os
import os.path as op
import numpy as np
import pandas as pd
import copy
import mne
import mne_icalabel
from fooof import FOOOFGroup
from fooof.bands import Bands
from fooof.analysis import get_band_peak... |
23013a3cc55391fb4c858b6267699b842763e77f27a6f8e44ccd95ff44be7c38 | Python | 42,631 | 1,001 | # -*- coding: ISO-8859-1 -*-
import os
from pathlib import Path
import pandas as pd
import time
import json
import numpy as np
import pylab as graph
from random import random
import tkinter as tk
from tkinter import ttk
"""
Photometry analysis.
Read all files from a sub-folder of wherever program is run ... |
05711a3d287de6f1e9cb197f3976fe1773553c290b9ee4195ef206713b4b3341 | Python | 42,780 | 871 | import os, shutil
import numpy as np
import pandas as pd
from itertools import product
from pathlib import Path
from typing import Any, Dict, List, Optional, Type, Union
import torch
import torch.utils.data as data
from torch.utils.data import DataLoader
from sklearn.model_selection import GroupShuffleSplit
import k... |
88933241560d029437f87e7de530f9ccd8853dbb40e45a6b39874d2a8a0d0cf2 | Python | 42,793 | 1,022 | """
High-level distillation trainer with clean API
This is the main entry point for distillation training.
"""
from typing import Union, Optional, Dict, Any, List, Tuple
import os
import re
import sys
import time
from copy import deepcopy
from datetime import datetime
from pathlib import Path
import torch
import torc... |
b9c4403a538c314ce0a072e87431b3737429a3803befd33b17f99c1b8dbf5c83 | Python | 42,943 | 1,245 | import logging
import numpy as np
import SimpleITK as sitk
import bigstream.utility as ut
from bigstream.configure_irm import interpolator_switch
import os
import sys
from scipy.ndimage import map_coordinates, zoom, gaussian_filter
from scipy.spatial.transform import Rotation
logger = logging.getLogger(__name__)
##... |
e48dfcf39b473cfefffcc4f151d42b184f3e117502c5a2c7f8977a5a3419bce8 | Python | 42,953 | 1,233 | # Tools related to fetching and processing data from NSD dataset
# Check out nilearn
import os
import shutil
import random
import re
from tqdm import tqdm
from pathlib import Path
import nibabel as nib
import boto3
import numpy as np
from botocore import UNSIGNED
from botocore.client import Config
import ants
# impo... |
1847b76775732a2b19325a841934cad32b81e9d84c1c2f9f350bfdeddcda798b | Python | 43,219 | 1,049 | # NeuriteKymoAnalyzer: extract tip position and intensities from kymographs.
# Tip detection uses a preprocessed reference channel; intensities use originals.
# Outputs: results_roi###.csv in each kymograph folder.
# Beginner note:
# 1) Point to a folder that contains '*_kymo' folders from the generation script.
# 2) S... |
8e3791701dfd95fe1d4b17c7fe17aab92096220d6a08f466808cb64e178bd108 | Python | 43,399 | 1,478 | from __future__ import annotations
import json
import logging
import os
import sys
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
import pytest
import tomlkit
from poetry.core.constraints.version import Version
from poetry.config.config import Config
from poetry.console.exceptions... |
03c214f091bfc38df23181b4440f9ef9a70ff178a001a2c007b4285e54074638 | Python | 43,428 | 919 | #
# 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 os, pickle
from interface.keras_parser import load_keras_model
... |
a6cb51ca7f19fa71a64bc558bc5f606f5458e8c813e232dbba5f09a1643643ff | Python | 43,479 | 1,239 | # Tools related to fetching and processing data from NSD dataset
# Check out nilearn
import os
import shutil
import random
import re
from tqdm import tqdm
from pathlib import Path
import nibabel as nib
import boto3
import numpy as np
from botocore import UNSIGNED
from botocore.client import Config
import ants
# impo... |
a19c257153abeb3fb9cc55d1db501a4d49be0b10d06f566ceba5e302ac3a226b | Python | 43,488 | 1,041 | # File for base geometry class built using the Geomdl class
import numpy as np
from geomdl import NURBS
class Geometry1D:
'''
Base class for 1D domains
Input: geomData - dictionary containing the geomety information
Keys: degree_u: polynomial degree in the u direction
ctrlpts_size_u: number ... |
18394b9fa8a4a00a55929f9573a027406cb2d9ea44da6e6524b2bedb6e8dbee8 | Python | 43,529 | 1,065 | import warnings
from types import SimpleNamespace
from typing import Literal, List, Optional, Tuple, Union
import torch
import numpy as np
from anndata import AnnData
from .._settings import settings
from .basemodelmixin import BaseModelMixin
from ..data.dataprocessors import prepare_data
from ..preprocessing.preproc... |
9559ba868e50a6e2f17b35c1444fa49f38d2d57fe93e635947873889d56eebed | Python | 43,661 | 947 | # Original work Copyright 2018 The Google AI Language Team Authors.
# Modified work Copyright 2019 Rowan Zellers
#
# 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/... |
0614313361da0699b418cd8c291fb741f9c44adfc768d824fef179cffe8baec7 | Python | 43,663 | 918 | # coding=utf-8
# Copyright 2018 Mesh TensorFlow authors, T5 Authors and 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... |
54f1255aea57fa109dac4ff486a461ae40b8da3449c8b348a5bef06866515a31 | Python | 43,663 | 918 | # coding=utf-8
# Copyright 2018 Mesh TensorFlow authors, T5 Authors and 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... |
8cf3fd7c2c8bcb8c9e613768972996922e061b6e1419a9647b7eb93c61f02138 | Python | 43,694 | 1,122 | from dataclasses import dataclass
from functools import partial
import json
import os
import random
import urllib.request
import exmol
import numpy as np
import pandas as pd
from rdkit import Chem
from rdkit.Chem import rdmolops, rdmolfiles
from scipy.stats import spearmanr
import selfies as sf
from sklearn.model_sele... |
838071e0b4e4ff68fd3d77d48ac370e1819ee656c6f64fbe9a3e2a7f551f7219 | Python | 43,937 | 1,281 | """
Pytest conftest module, for test_boundary_detection_module.
At the time of adding the test_boundary_detection_module,
this does not contain any fixtures or test configuration per se;
it is just a place to put the really long list of unit test cases
that parametrize the unit tests,
so that those modules are a lit... |
1d90b7af64ffc375ccc1c57f2cb4812a7345f8ee02e7efc50ae10f8bcdd49ea8 | Python | 44,102 | 994 | """Utilities for making plots with your data.
BNF
---
.. highlight:: none
.. literalinclude:: ../../doc/bnf/plotting.bnf
Parameter notes
---------------
``pisa-section``
''''''''''''''''
You can specify either a file of PISA data or a custom array.
If you give a file, you need to be very careful about coordinates... |
9974040d85c24b56ff2a04a4223fc0010d02d605981a1dc731f9523ecb70b5bc | Python | 44,203 | 1,167 | import itertools
import networkx as nx
import numpy as np
import pandas as pd
from pgmpy.utils.parser import parse_lavaan
class SEMGraph:
"""
Base class for graphical representation of Structural Equation Models(SEMs).
All variables are by default assumed to have an associated error latent variable, th... |
3fd9d5c860502c524d531acd07e00b67b861bf077b8f52dbcb43be6d003be784 | Python | 44,238 | 1,402 | import argparse
import contextlib
import errno
import html
import json
import os
import platform
import queue
import subprocess
import threading
import time
import traceback
import webbrowser
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from types import SimpleNamespace
f... |
6336a81c42ac88efcff5228822c40facf83bb0d7833978486829e220d052db8b | Python | 44,341 | 1,173 | from __future__ import annotations
import logging
import warnings
from functools import partial
from typing import TYPE_CHECKING
import anndata
import joblib
import numpy as np
import pandas as pd
import torch
from anndata import AnnData
from rich import print
from scvi import REGISTRY_KEYS, settings
from scvi.data ... |
7f963b1030d1eaf8c5cae61bb4ef2086581f105898fbb3789d4b5aa2018171f4 | Python | 44,385 | 1,045 |
# Copyright (c) 2023, Tri Dao.
import math
from functools import partial
import torch
import torch.nn as nn
from einops import rearrange, repeat
from flash_attn.utils.distributed import get_dim_for_local_rank
try:
from flash_attn import (
flash_attn_kvpacked_func,
flash_attn_qkvpacked_func,
... |
3b329a1388910729c82462bb1ee4640fe132bb65aa862c024e894c2d6a82e982 | Python | 44,401 | 918 | # ======================================================
# Expansion vs Contraction Analysis (36-slice chromatophore)
# Peak-centered events, amplitude-based groups, robust outlier removal
# ======================================================
# ---------------- IMPORTS ----------------
import numpy as np
import pan... |
d287688dfc20ee9c8d4354f2978460db9077d5c39edd00e3afaed51cd23075ee | Python | 44,412 | 1,027 | # coding=utf-8
# Copyright 2020 The Facebook AI Research Team Authors 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/LIC... |
f374b9a6bf276619da6845891b0eef0575c49000906f5cba2b9e902e1ae086a5 | Python | 44,413 | 1,028 | # coding=utf-8
# Copyright 2020 The Facebook AI Research Team Authors 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/LIC... |
304b6a06bfbf8b5aa6481399b7f9a820b577d03caff9cfa6c30d3f035a2df34a | Python | 44,544 | 1,094 | # ==============================================================================
# Script: 3_segmentation_visual.py
# Manuscript relevance: Fig. 2, Fig. S2, Fig. S3
# ==============================================================================
# PURPOSE:
# Generate per-patient figures visualizing the PELT segmentat... |
16cad64c2ef5f5c94908b87eca44f645d0ddc2c2007d71b65a5ff7486e54d92c | Python | 44,911 | 1,014 | """
Hydra-driven dynamic segmentation with CID attribution (WMB / CA1 patches + UNet).
Extends the base ``dynamic_segmentation`` pipeline with:
- CID (or IG) attribution per batch when ``epoch >= attr_epoch``
- Attribution-aware ``update_label`` (expand_k, attr_top_ratio)
- Attribution-aware global stitche... |
d25c21ef2dd07fb5270b5095e3b9ad6b06ea9c3a55dfb0510e6c6945cd26e716 | Python | 44,911 | 1,220 | import gc
import math
from typing import Dict, Mapping, Optional, Tuple, Any, Union
import warnings
import torch
import numpy as np
from torch import nn, Tensor
import torch.distributed as dist
import torch.nn.functional as F
from torch.nn import TransformerEncoder, TransformerEncoderLayer
from torch.distributions imp... |
bf4bb26e0459c336fd11b8e2b010e38a45edae8d50db3faa68117ba2a1323974 | Python | 44,945 | 1,184 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.figure
import matplotlib.axes
import matplotlib.gridspec as gridspec
import pandas as pd
from pathlib import Path
import os
from typing import List, Tuple, Optional, Dict
try:
from upsetplot import UpSet, from_indicators
UPSETPLOT_AVAILABLE = ... |
a7189919ebbae174268b55dd38e1b4bbde9ff3b49502c9cc49c7b4374750c533 | Python | 44,987 | 1,156 | # 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 json
import logging
import math
import os
from collections import OrderedDict, defaultdict
from argparse import Argume... |
9930a3754b5e9dc6757251d2730728274fa6027e33a91314f9620db47f691a8e | Python | 45,047 | 1,093 | # 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 collections import namedtuple
import torch
import torch.nn as nn
from fairseq import checkpoint_utils
from fairseq import... |
9b96766c4e22287b015dba0f4366869c1a0c9aedb8f8dd94f5dcbec94edc2a1a | Python | 45,049 | 1,153 | from __future__ import annotations
import logging
import warnings
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
from joblib import Parallel, delayed
from scipy.stats import ttest_ind
from scvi import settings
from scvi.data import AnnDataManager
... |
bc24e1c06cb7df111205224c3125f4c7ad4a3f8a467d170066cad63ccee54cda | Python | 45,373 | 1,231 | # 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 dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
import numpy as np
import torch
import... |
f5db9eb8b3f5d1745a4c8045fe77a72402ea7b24ad46f86e16a323342c78e91f | Python | 45,788 | 1,052 | import numpy as np
import torch
import os
import json
import pickle
import matplotlib.pyplot as plt
import math
from math import pi
import time
from torch.utils.data import DataLoader
from sklearn.model_selection import train_test_split
from sklearn.metrics import balanced_accuracy_score, f1_score
# --- NEW: KNN + sca... |
d4f2d092f7de57aa35ace71dbc1f35f4a8918fb8cf924300619fed4ab251f312 | Python | 46,050 | 1,110 | # 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 Dict, List, Optional
from omegaconf.listconfig import ListConfig
from omegaconf.dictconfig import DictConfig
... |
aa10725200c6583040bf012564183295267cfa234bf9f0fdc600eb9fad3151f8 | Python | 46,076 | 1,037 | from __future__ import annotations
import argparse
import json
from pathlib import Path
import anndata as ad
import numpy as np
import pandas as pd
from scipy import sparse
from scipy.optimize import nnls
from scipy.stats import pearsonr, spearmanr
from sklearn.decomposition import TruncatedSVD
from sklearn.metrics i... |
7bd3da05d7ca36c9eace46f14dbb573d25855450488c96fe0e9ce4771a7851db | Python | 46,121 | 1,319 | """Commonly used data structures and functions."""
import collections
import concurrent
import enum
import errno
import fileinput
import functools
import gzip
import importlib.resources
import inspect
import itertools
import logging
import os
import re
import shutil
import tempfile
import intervaltree
import numpy as ... |
4709ff4646db15480c923815204364b1b7da093e43ac6a939f4a0028e7a33940 | Python | 46,148 | 1,167 | """
"""
"""
Copyright (c) 2019, 2022 [copyright holders here]
This file is part of NoSeMaze.
NoSeMaze is free software: you can redistribute it and/or
modify it under the terms of GNU General Public License as
published by the Free Software Foundation, either version 3
of the License, or (at your option) at any l... |
352283b732439dc3b8d04168c2cf78ad22b84257e66d7cb36cd97d5365593482 | Python | 46,371 | 1,014 | #!/usr/bin/env python3
"""
Regenerate Figures 3, 4, 5, 6 for RAG-GNN manuscript revision.
Uses corrected v3 learnable pipeline results.
- Fig-3: Retrieval PR curves (trains one seed for score matrix)
- Fig-4: Embedding visualization (saved embeddings)
- Fig-5: DDR1 subnetwork (saved embeddings)
- Fig-6: Benchmark compa... |
ba5ce6f55bf18d5e7061abf92922d58644eae0979b69ceef562f836dac908ff2 | Python | 46,390 | 1,075 | from __future__ import annotations
import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score
def _valid_layer_mask(values: pd.Series) -> pd.Series:
return ~values.astype(str).str.strip().str.lower().isin({"", "nan", "none"})
def high_risk_fraction_by_group(obs: pd.DataFrame, group_col: s... |
e2315a96a8ae0cea62fb6e17616a279745890e45d24d1a0c8170093c3c7fd6d5 | Python | 46,412 | 826 | """
This module contains classes for creating input files for various MM/PBSA
calculations.
Methods:
create_inputs -- determines which input files need to be written then
handles it
Classes:
SanderInput -- Base class for sander input files
SanderGBInput -- writes input files for sande... |
48627d1e7fdc3d499f7d5bc020e88602122a05712d67533dc84c32e1230385d5 | Python | 46,431 | 1,155 | import theano
import theano.tensor as T
import numpy as np
from lasagne import init
from lasagne import nonlinearities
from lasagne.utils import as_tuple, floatX
from lasagne.random import get_rng
from .base import Layer, MergeLayer
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
__all__ = [
... |
d4295ea09d49b3f8e52d2df5a0247425643c2f478393e673fcb81c59896bc065 | Python | 46,454 | 991 | """Standalone thermodynamic convention diagnostic for gas-water partitioning.
This script mirrors the thermodynamic helper conventions currently used by
phreeqc_simulator.py without importing the Streamlit application. It writes
tables, publication-ready figures, and short manuscript/reviewer text snippets
that clarif... |
d380b51e3da786284ad5858d7dcc904ade16ecff3c1e457edc0e4ea3126c2b02 | Python | 46,462 | 1,311 | import os
import unittest
import networkx as nx
import numpy as np
import numpy.testing as npt
from pgmpy.models import SEM, SEMGraph
class TestSEM(unittest.TestCase):
def test_from_graph(self):
self.demo = SEM.from_graph(
ebunch=[
("xi1", "x1"),
("xi1", "x2")... |
14a53e0422e938778dea034900987136857968b47021f82252e99a95a6a360e9 | Python | 46,911 | 1,169 | import unittest
import numpy as np
import numpy.testing as np_test
import pandas as pd
from pgmpy.base import DAG
from pgmpy.factors.discrete import TabularCPD
from pgmpy.inference.CausalInference import CausalInference
from pgmpy.models import DiscreteBayesianNetwork, SEMGraph
np.random.seed(42)
class TestCausalG... |
42cc2a3d915cdffb2c3deb060fee87ee22712e6621cc3fcee10c6b1c36279be5 | Python | 46,991 | 1,205 | from __future__ import annotations
import os
from pprint import pprint
import numpy as np
import pytest
import scvi
from scvi.data import synthetic_iid
from scvi.dataloaders import MappedCollectionDataModule, TileDBDataModule
from scvi.external import MRVI
from scvi.utils import dependencies
@pytest.fixture(scope=... |
ec1a2df861a872e6319c714c92cd82d1e7954054062699176ce2f0416d8d03c9 | Python | 47,028 | 1,141 | # 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... |
f5193e0d6e63bccee665a52cec9124391fe94e1c4ef798721ec2b490be1806a8 | Python | 47,169 | 1,351 | import csv
import json
import sys
import uuid
import math
import subprocess
from pathlib import Path
from typing import Dict, Any, Union, List, Tuple, Optional
import shutil
import numpy as np
import pandas as pd
from Bio import SeqIO, AlignIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from collection... |
d47f0f2e378580296f2a38fe31366603a4eaaa3855e2d616d4f4a3d4ac53b4c0 | Python | 47,289 | 1,083 | import theano.tensor as T
from lasagne import init
from lasagne import nonlinearities
from lasagne.utils import as_tuple
from lasagne.theano_extensions import conv
from .base import Layer
__all__ = [
"Conv1DLayer",
"Conv2DLayer",
"Conv3DLayer",
"TransposedConv2DLayer",
"Deconv2DLayer",
"Dila... |
328e80d9bb08687a94bc41ebc350640eea67d202905f0d4312adef6078233f78 | Python | 47,357 | 1,134 | from __future__ import annotations
import functools
import itertools
import logging
import re
import time
from collections import defaultdict
from contextlib import contextmanager
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar
from typing import cast
from cleo.ui.progress_indicat... |
993533f776dc9dfd722447b11ef7fa3c340320e6e93eecd4c7edf6d2131acd66 | Python | 47,649 | 1,245 | #
# Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
# retains certain rights in this software.
#
# See LICENSE for full license details
#
"""A Numpy-like interface for interacting with analog MVM operations.
... |
abd55becdb59521e9c8a7c7af3eeaca6360523eaacd693e68c5fb0a9edc81875 | Python | 47,721 | 1,578 | import torch
import numpy as np
import torch.nn.functional as F
class ReluLayer(torch.nn.Module):
'''
Based on https://arxiv.org/pdf/2006.08195.pdf
'''
def __init__(self,
input_dim,
output_dim,
bias=True):
super... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.