sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1f90c09b025b1555dcb0ede982453d1683865b945593821bb9b1483e8df64404
Python
3,642
127
""" frozen (immutable) data structures to support MultiIndexing These are used for: - .names (FrozenList) """ from __future__ import annotations from typing import ( TYPE_CHECKING, Any, NoReturn, Self, ) if TYPE_CHECKING: from collections.abc import Iterable from typing import SupportsInde...
8a2157522cd10558ed3c4888eb21bb5da82e4c3c595f0192ef5017b22d5c5fd8
Python
3,644
108
# # This file computes the atomic spherical coordinates in a given set of # neighborhoods and outputs a file with these coordinates. # # It takes as arguments: # - The name of the ouput file # - Name of central residue dataset # - Number of threads # - The neighborhood radius # - "easy" flag to include central res...
2cb23d69b8685c2f44e8ffae34a364ba938ac08897896b89823c001f069fb29e
Python
3,646
95
import numpy as np import scipy.signal # type: ignore from sklearn.decomposition import FastICA # type: ignore from sklearn.preprocessing import StandardScaler # type: ignore def detrend(signal: np.ndarray, degree: int) -> np.ndarray: """Detrend a single signal""" x = np.arange(len(signal)) coeffs = n...
e5574f3ada2e66ad4ca58f0ba221f4be72f190bd8a56069b27ac23a1d52988d3
Python
3,650
71
import pandas as pd from rdkit import Chem import numpy as np from utils import GraphCreator import torch from sklearn.preprocessing import MinMaxScaler import pickle import os # create folder structure os.mkdir("data") os.mkdir("feature_importances") os.mkdir("logs") os.mkdir("data") os.mkdir("plots") os.mkdir("train...
c564b2953cab4115bdddc16a618e82aa833fbac3a83489c30bdf4bedff767227
Python
3,651
123
""" _ .__(.)< (KWAK) \___) ~~~~~~~~~~~~~~~~~~~~ """ import socket import time import threading import numpy as np class Pose_Streamer: BUFER_SIZE = 2048 # bytes (max size of a pose string is 1037 bytes) def __init__(self, sfreq, host, port): """ sfreq: sending fr...
b89b2c4432d1c2ddc9ec0d88e536151650fa1a9ffff20fcc9e1fa49eb031a6c8
Python
3,652
113
import sys import random import numpy import collections import math numY = int(sys.argv[1]) NUMITERS = int(sys.argv[2]) alpha = float(sys.argv[3]) beta = float(sys.argv[4]) refstart,refend = (sys.argv[5],('_'+sys.argv[6])) if len(sys.argv) > 6 else (sys.argv[5]+'_','_') sys.stderr.write( 'numY = ' + st...
c346466efeec76e249c1f103a2dd43637f1719669b96f6366173384452b002fa
Python
3,653
117
from pathlib import Path from typing import Set, List import pandas as pd import numpy as np import tensorflow as tf import tensorflow.keras as K from tensorflow.keras.models import Model from MutComputeX.data_loader import load_dataset from MutComputeX.post_process import ( prediction_df, average_prediction...
11308ec352a583073afb9addd023ca3ca8ef43447052b1e6933d826f8b970432
Python
3,654
125
import numpy as np import pyqtgraph as pg from kilosort.gui.logger import setup_logger from PyQt5 import QtCore, QtGui, QtWidgets logger = setup_logger(__name__) class ProbeViewBox(QtWidgets.QGroupBox): channelSelected = QtCore.pyqtSignal(int) def __init__(self, parent): super(ProbeViewBox, self)._...
e1ddb6041279e8cd0fc86b67e4a77313ca87115d5c7a8be56f7ea3a7dba7db0b
Python
3,654
124
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestDataFramePctChange: @pytest.mark.parametrize( "periods, exp", [ (1, [np.nan, np.nan, np.nan, 1, 1, 1.5, np.nan, np.nan]), (-1, [np.nan, np.nan, -0.5, -0.5, -0.6, np.nan, np.nan, np....
217b48a1f01e9e5135bcbea2df27fff5ea5caa51eb808f8dceab0feb067d3c33
Python
3,655
137
from collections.abc import Generator import contextlib import weakref import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm from pandas.core import accessor def test_dirname_mixin() -> None: # GH37173 class X(accessor.DirNamesMixin): x = 1 ...
ad02c14f3b286a4563cecd4977d6e00136cf8f08bbad4f4555f0ebe68beeff20
Python
3,656
91
import os, sys, re, copy, argparse sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) import tree argparser = argparse.ArgumentParser(''' Transforms unlabeled dependency graphs into unlabeled phrase structure trees, following the procedure in Collins et al (1999). Resultant...
0613dc36bf12e43888d46514eb780c479bf09c74fb4b44e150b9c680c0b17ecc
Python
3,657
117
__all__ = ["match_spectrum_mz", "MS2SpectrumAnnotatorBase"] import abc from typing import Generic, Literal, TypeVar, Union import numpy as np from ...chem.common.mz import MzAnnotationProto from ...specio.spec import MassSpectrum from ...util.config import Configurable from .spec import MS2SpectrumProto, MzArray d...
7c778ef877a7874cb7c2db613bd4d244184ba3e432104816e259542462dde7ed
Python
3,658
131
import numpy as np from src.nexi.models.functions.nexi_functions import ( M, nexi_signal, nexi_jacobian, nexi_hessian, nexi_signal_from_vector, nexi_optimized_mse_jacobian, ) def test_M(): x = 0.5 b = np.array([1, 2, 5]) t = np.array([20, 30, 40]) tex = 30 Di = 2 De = 1...
b75dc47d1e1759a4a02ad8edc56dbf985f4641c6ffc11fc0f245ca905c95e8d4
Python
3,658
110
"""L1 Norm.""" import torch from mrpro.operators.Functional import ElementaryProximableFunctional, throw_if_negative_or_complex class L1Norm(ElementaryProximableFunctional): r"""Functional class for the L1 Norm. This implements the functional given by :math:`f: C^N \rightarrow [0, \infty), x \rightarro...
0b32f5d3f4f7f7c3adf0a365625c0528a0606a2e07a90ce5f3f6c539fdf10b78
Python
3,659
94
# Copyright 2018-2025 Xanadu Quantum Technologies 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...
7e0bd175c285affe8eaabbe1ea3ac16509bceba0fdb8f27df71710b415305b0c
Python
3,659
95
import os import pandas as pd from cptools2 import splitter from cptools2 import filelist # need to have an image list CURRENT_PATH = os.path.dirname(__file__) TEST_PATH = os.path.join(CURRENT_PATH, "example_dir") TEST_PATH_PLATE_1 = os.path.join(TEST_PATH, "test-plate-1") # just use a single plate IMG_LIST = filelist...
9578533e969080c1cf5f7ceda2a3639339df309c722f221639ef456c63f20e10
Python
3,660
91
import torch import torch.nn as nn from gvp import GVP, GVPConvLayer, LayerNorm class GVPEncoder(nn.Module): ''' GVP-GNN encoder. Takes in protein structure graphs of type `torch_geometric.data.Data` or `torch_geometric.data.Batch` and returns an embedding. Should be used with `g...
2df0096ed4f259902189374e2629c5ba5a92941209edc56f0b5c12420219f6e5
Python
3,662
91
"""Local validation and sidecar selection for per-clock Hugging Face sync.""" import importlib.util import json from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[1] _spec = importlib.util.spec_from_file_location("hf_repo_sync", ROOT / "clocks" / "hf_repo_sync.py") hf_repo_sync = importl...
c1b63dde9447cf6ab229fff70a88ef750995016427e5a47a261c8f43cfe1e9b4
Python
3,665
92
import argparse import configparser import logging import os import sys import numpy as np from datetime import datetime from typing import Tuple from local.common import BCI2000MatFile from prepare_corpus import get_feature_extractor logger = logging.getLogger("baseline_offline.py") def get_default_session_name() ...
3d1259915669d0d6f1d226c2a8e33fa6519a179fb03ded31c27f388691c438a3
Python
3,666
104
import sys import os import re from bs4 import BeautifulSoup sys.path.append(os.path.join(os.path.dirname(__file__), "..")) info_dict: dict = dict() with open(os.path.join(os.path.dirname(__file__), "../nesvor/version.py")) as fp: exec(fp.read(), info_dict) print("post processing starts") BASE = sys.argv[1] cmd...
6cc3a670db7d1fcf117b968f529efeff7bb8f4d44fc8cea287fce303eacd402a
Python
3,668
134
# coding: utf-8 from pytest import raises from atropos.adapters import ( Adapter, Match, ColorspaceAdapter, FRONT, BACK, parse_braces, LinkedAdapter ) from atropos.io.seqio import Sequence def test_issue_52(): adapter = Adapter( sequence='GAACTCCAGTCACNNNNN', where=BACK, max_error_rate...
cb99a1f7962bcf38cdb604189469954a6125625a633ff108b896e504bb367a93
Python
3,669
69
import json # 优势在于从json文件层面把废物样本信息给剔除了,而不是从系统层面把文件删除。 # 该函数用于删除废物样本 # file1是所有实体打标文件 # file2是需要删除的样本名称文件 # final是最终的样本数据文件 # 需要删除7次 def delete_trashsample(file1,file2,final): final_samples = [] with open(file1, 'r') as f: data = json.load(f) with open(file2, 'r') as f: da...
e159b6121a0d38c297989859cae4c4398b78fc56ed9b577d6537578e1b2f56ad
Python
3,669
102
#!/usr/bin/env python """This script is used to count the unique reads spanning exon-exon junction from the alignment ======------------------------==========------------------------========================= ======|==========|========================= The input file can be generated in Lin...
54ae621d087e1dc981dc25ad7a59877a29f3996622b1685c530759e134f1bf02
Python
3,670
94
# # File to train networks built from the hnn.py class. # # This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters, # loads holograms from .npy files, and then tests the network via a function call. # import os import numpy as np import tensorflow as tf print("Num GPUs Available:...
b6bab0c80abf4e864a4b2fc30bbcec96a016ea56c3ed40738e5bf383b95ab050
Python
3,670
98
"""Envpool wrapper guard: MyoSuite tasks on envpool < 1.2.6 are refused (deterministic resets, envpool#432) unless env_config sets allow_deterministic_resets: true. The stub-module tests run without envpool installed (CI has none); the real-path test skips unless envpool is importable. """ import sys import types impo...
d4d7abaf423e6ba88d12ce717a07b8ab35387e3d5db50bba2a3a2185a0994073
Python
3,671
97
"""Zero functional.""" import torch from mrpro.operators.Functional import ElementaryProximableFunctional, throw_if_negative_or_complex from mrpro.utils.reshape import normalize_indices class ZeroFunctional(ElementaryProximableFunctional): """The constant zero functional.""" def __call__(self, x: torch.Ten...
d4e8acda09a59121b7ef9e11ef2ebcae28968003ce9d3c004e2303fab8640476
Python
3,671
81
import numpy as np output_labels = ["pLA_min", "pLA_max", "dpLA_dt_min", "dpLA_dt_max", "VLA_min", "VLA_max", "dVLA_dt_min", "dVLA_dt_max", "pLV_min", "pLV_max", "dpLV_dt_min", "dpLV_dt_max", "VLV_min", "VLV_max", "dVLV_dt_min", "dVLV_dt_max", "pRA_mi...
bcbaac6602dd38f9a292d8a8016281e27b247773e70629d067226e0c0a6af04b
Python
3,674
92
import torch import torch.nn as nn import torchtext from models.lstm.embed_regularize import embedded_dropout from models.lstm.weight_drop import WeightDrop # Define the model class LSTM(nn.Module): def __init__(self, config): super(LSTM, self).__init__() # self.V = n_vocab self.D = config...
5a9245ca9ae81dd8cc40aedfa1c47f9ab729dd55a195153c888bc0172c8703c9
Python
3,677
100
import os import pandas as pd from matplotlib import pyplot as plt import math import os import numpy as np import scipy as sc import pylab as pl import seaborn as sns from scipy.stats import ranksums import random # def plot_sim_denovo_accuracy(sim_hifi, sim_ont): # # fig = pl.figure(figsize=(1.8, 5)) # ax...
6a5b0b5fc4ee19fc29f3ed21620dfc5b671527bea42c6a1749590cc00735a08a
Python
3,677
104
from ..utils import get_phenolist from .. import conf from ..file_utils import get_tmp_path, get_dated_tmp_path, get_pheno_filepath from .load_utils import PerPhenoParallelizer from boltons.fileutils import mkdir_p # to make tmp directory import sys, argparse from boltons.iterutils import chunked from typing import L...
af1366bc248a62d1720b26f7c9d46ee9891d74047d25d8ecb98f941a83dec035
Python
3,677
84
from matplotlib import pyplot as plt import seaborn as sns import pandas as pd import numpy as np from functions.OneDCNN_Utils import read_pkl from functions.OneDCNN_Utils import change_bar_width camPath = 'data/OneDCNN/CAM/' resultPath = 'data/OneDCNN/savedResult/' figPath = 'fig/' epochTypes = ['Feedback', '...
ff79977998bb8aae98afe1eceac7abd6d8a5ca87bfb0c2c384e36474127f2d3a
Python
3,678
101
import torch class PenaltyBuilder(object): """Returns the Length and Coverage Penalty function for Beam Search. Args: length_pen (str): option name of length pen cov_pen (str): option name of cov pen Attributes: has_cov_pen (bool): Whether coverage penalty is None (applying it ...
a7a60a9b87abbd09e2b4ff2179efd0875a3813f954f61a3704daadfe84cc0c02
Python
3,679
124
"""Collect relevant icons to icon theme subdirectories The icons used rely on the KDE breeze theme. apt install breeze-icon-theme This script must be run on a linux machine. Please make sure that `icon_root` is correct. """ import pathlib import shutil # The key identifies the theme; each list contains icon nam...
7d06564fab0d31102f17a236c052f85caf63cd8a79774a8d121c8e064ea0410d
Python
3,680
108
#!/usr/bin/env python # Filename: manual_annotator.py # Author: Alessandro Gerada # Date: 2023-01-28 # Copyright: Alessandro Gerada 2023 # Email: alessandro.gerada@liverpool.ac.uk """ This script shows random images from 96-well plates, and waits for user input to annotate the image. Supports up to 10 growth lab...
d6813fdec1f25a03974d8ea6bcfa2b2f1209397fd9ad34f81cebdfb8ace5e80c
Python
3,681
83
import pandas as pd import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) import logging from app import create_app, db from load_db.PPMI import get_ppmi_condition from app.models import Sub...
447cfed2c24267ff2e01988b35beb22a9e2715d21bbcb304d145b04b2ecc23f0
Python
3,682
127
""" frozen (immutable) data structures to support MultiIndexing These are used for: - .names (FrozenList) """ from __future__ import annotations from typing import ( TYPE_CHECKING, Any, NoReturn, Self, ) if TYPE_CHECKING: from collections.abc import Iterable from typing import SupportsInde...
127b5d38cd4fae0c9032e0796e1df5e428b3548352dab70e186fc5ee3fe7230f
Python
3,683
88
""" @author: Hongao ZHU @description: read from the .itemmeasures and the .csv files, integrate the information within, and output a comprehensive .csv file @example usage: python3 integrate.py -C <input_csv_path> -S <input_itemmeasures_path> -O <output_csv_path> """ import argparse import pandas as pd...
89d9bae00e6fcf9848a483ab472536f0a8421871e1a0d9ff34aa535fddbde097
Python
3,685
117
import torch import numpy as np import torch.nn as nn import time import torch.utils.data as Data from scNovel.scNovel_classifier import classifier from scNovel.weightsampling import Weighted_Sampling from scNovel.score_functions import get_ood_scores def scNovel(test = None, reference = None, label = None, proces...
1f7d6a5b7462a2459948b394f5443fc45878d9395af28cfc601765f179663e61
Python
3,686
97
# Copyright (c) 2018-2023, NVIDIA Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of condit...
b46b283fef8d6c96dca5637dffd5a180b1f3d1f3c345a6d6f56c0f0a72ccc708
Python
3,686
120
import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid1.inset_locator import inset_axes import numpy as np import os import argparse import matplotlib as mpl label_size = 16 #mpl.rcParams['xtic...
20bdc22fce69dfeeab5dace54bfdcec75cec9dbbe34e38da825b5c056b1f7229
Python
3,687
106
from indices.base import BaseComparisons class BaroniUrbaniBuser(BaseComparisons): """Class to calculate the Baroni-Urbani-Buser index. n=2 formula: (sqrt(a * d) + a)/(sqrt(a * d) + a + b + c) Attributes ---------- fingerprints : np.ndarray Numpy array with the fingerprints that ...
87b91ca96d11dc7bae4c5725b873bbe82260c20f95be01fdd107f042a77c1644
Python
3,687
79
import json import pandas as pd import numpy as np import fire import text_extensions_for_pandas as tp import gpmhc.data as data_utils import gpmhc.learner as learner_utils import os #Only one GPU inference is currently suppported, cpu inference not supported def infer(input_model='./models/baseline_model/', sub_model...
689fc14ae8a70694f0ce5b253e099b27f73c1fea4fc5afd443e86147cc5dc948
Python
3,688
106
from indices.base import BaseComparisons class GoodmanKruskal(BaseComparisons): """Class to calculate the Goodman-Kruskal index. n=2 formula: (2 * min(a, d) - b - c)/(2 * min(a, d) + b + c) Attributes ---------- fingerprints : np.ndarray Numpy array with the fingerprints that wil...
a217ffc57d9344cb65c0fd5ef7759ac01f5094b5b4701c8836417a1cde84befe
Python
3,689
102
from datetime import datetime import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestTruncate: def test_truncate_datetimeindex_tz(self): # GH 9243 idx = pd.date_range("4/1/2005", "4/30/2005", freq="D", tz="US/Pacific") s = pd.Se...
f5a7876efe0765b0698211c1383e73bda402cebd5ffb96bbb63b1d45739ffe01
Python
3,689
109
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
a15f25ecd98afbac2757d5b6afca45a613eb3f9622fcb542b0a1841a0fd406f0
Python
3,691
97
__all__ = ["AutomaticWeightedLoss"] from typing import Any, Mapping import torch import torch.nn as nn class AutomaticWeightedLoss(nn.Module): """automatically weighted multi-task loss Params: num: int,the number of loss x: multi-task loss Examples: loss1=1 loss2=2 ...
91455274bcab382422e0879d61fb432e4d1304439734da5f90a69f3fb700cbdb
Python
3,693
127
# some codes are from https://gitee.com/LynnHg/pytorch-medical-image-segmentation import sys import torch import torch.nn as nn import torch.nn.functional as F activation = nn.ReLU def initialize_weights(*models, a=0): for model in models: for module in model.modules(): if isinstance(module,...
c5c18c121eb22fd4daebc96a5f76d6a1f232685ec797a36eb71edf1240220a43
Python
3,693
73
import json # 传入总体的json文件,读取json文件的键值数据,一个一个遍历扫描 # 然后字典统计频次 def text_save(filename,allfilename, data, data1): file = open(filename,'a',encoding='utf8') for i in range(len(data)): s= str(data[i])+"\n" file.write(s) file.close() print("保存频率文件成功") with open(allfilename, 'w',en...
cf1821922eb6260ea4897dd7b041a4a3ace0b3f59f931e2993c3ada875e20ede
Python
3,693
112
import torch import numpy as np def ecdf(p): """Estimate the cumulative distribution function. The e.c.d.f. (empirical cumulative distribution function) F_n is a step function with jump 1/n at each observation (possibly with multiple jumps at one place if there are ties). For observations x= (x_1, ...
c3c207bae7a1a99adb1e9460328a77c171076d9f710cd88621b0056afd1fdec2
Python
3,694
92
from pathlib import Path import numpy as np import pandas as pd import pytest from pyaging.preprocess._tage import _map_to_mouse_entrez REPO_ROOT = Path(__file__).resolve().parents[2] FIXTURES = REPO_ROOT / "tests/data/tage" MAPPING_ASSET = REPO_ROOT / "clocks/weights/tage_gene_mapping.csv.gz" MAPPING = pd.DataFram...
198bd96db7f4c588653499c07f6214fa7e426cc5b8e01f31bd86a5e3d8319360
Python
3,695
121
from datetime import ( datetime, timedelta, ) import numpy as np import pytest from pandas.core.dtypes.cast import ( maybe_box_native, maybe_unbox_numpy_scalar, ) import pandas as pd @pytest.mark.parametrize( "obj,expected_dtype", [ (b"\x00\x10", bytes), (4, int), (n...
5d373c1fde54d7d123db2a53220b619943a406210d83c0155984f8e5d24acbfa
Python
3,695
121
import torch import bionetwork import matplotlib.pyplot as plt import numpy import plotting import time import pandas batchsize = 5 activationFunction = 'MML' parameters = bionetwork.trainingParameters(iterations=150, clipping=1) networkSize = 10 batchsize = 5 seed = 15 networkList, nodeNames = bionetwork.getRan...
7a35f4e8aedf2bf3ab6af73e3015987527ff4892f2abeecbd04f5d3fb3cf01a7
Python
3,696
110
import numpy as np from numpy.testing import assert_allclose, assert_array_equal import pytest from umap import UMAP import umap.distances as dist def _data(dtype=np.float64): return np.array([[0, 2, 5], [6, 1, 0], [2, 4, 3], [1, 0, 8]], dtype=dtype) def _expected(X, Y, metric, value): if metric == "minkow...
103952e2e0550181fe9be7a90fc5752d207c5ecbed118dee17e2d0c429251136
Python
3,700
99
# Copyright (c) 2018-2023, NVIDIA Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of condit...
7ac0e0b467320641279af9150ae7ca8f1cbf069da2e4e69f984eb04a756e06c3
Python
3,700
143
"""Test the initialization and training of context heatmap multi-head crnn models.""" import copy import pytest pytestmark = pytest.mark.gpu def test_supervised_heatmap_mhcrnn( cfg, heatmap_data_module_context, video_dataloader, trainer, run_model_test, ): """Test the initialization and tra...
cac08c391a435a0316b0c284e55f3769d747b58de3b98ef28ca46566f6eaf35b
Python
3,700
100
import ntpath from sys import path as sys_path sys_path.append('..') sys_path.append('../base') import os from base import loggingUtils import multiprocessing as mp from multiprocessing import Pool from glob import glob import pandas as pd import matplotlib.pyplot as plt import numpy as np import imageio.v3 as iio impo...
ead98f662c745253dce31341a0fbeac36fc7882d7a1c0f510147670b59282d30
Python
3,700
68
#!/usr/bin/env python3 """ Description: Directly convert transcript counts to Isoform Fractions (IF). Transcripts with no non-zero counts will still be filtered out. This module is useful when skipping pre-filtering step. Usage: ./transform_tx_counts_to_ifs.py -i <tx_counts.txt> -m <tx2gene.txt> -F <filtered_i...
f1bf199c09e0af4ec60c8efe1290560940a9904841998a71a506f1df51a72384
Python
3,700
143
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 17 16:08:44 2020 @author: reisertm """ import sys sys.path.append("/home/reisertm") sys.path.append("/home/reisertm/nora/src/python") import numpy as np import tensorflow as tf import math from tensorflow.keras import Model from tensorflow.keras ...
9739bc33da9fb53a52363967038ddc1e1085827f2a31643b2925034c3b027c3d
Python
3,703
128
# some codes are from https://gitee.com/LynnHg/pytorch-medical-image-segmentation import sys import torch import torch.nn as nn import torch.nn.functional as F activation = nn.ReLU def initialize_weights(*models, a=0): for model in models: for module in model.modules(): if isinstance(module,...
d86e988c6e077351a2cfbd4a06dfbbc37d2f80b0a6a6a66077ac1662b1d6c055
Python
3,703
93
# -*- coding: utf-8 -*- """ Created on Sun Dec 20 17:02:31 2020 @author: Wladek """ import numpy as np import matplotlib.pyplot as py import matplotlib as mpl from matplotlib.colors import LogNorm from figure_properties import * import matplotlib.patches as mpatches from scipy.signal import welch, argrelmin, butter, ...
c1ed426d812baba5f8f49a607bfe1e943b894e37576c28658398c04053754a62
Python
3,705
107
# MOFTransformer version 2.0.0 import numpy as np import seaborn as sns from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap DEFAULT_FIGSIZE = (8, 8) DEFAULT_VIEW_INIT = (0, 0) def get_default_cbar_kwargs(figsize): return { "num_ticks": 6, "decimals": 4, ...
bb8a03b94745017c343c723c4900286b6840e51c99bc253e1f467a7424e1b4ac
Python
3,707
91
import pandas as pd import matplotlib.pyplot as plt import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) from app import create_app, db from app.models import Image, Subject, SourceDataset, Prep...
5e283a59d3c814223eb05f6c288d3a2ba003292bac26767d3dd48f45147dc09f
Python
3,708
78
from botocore.client import Config import ibm_boto3 from io import StringIO import types import os import pandas as pd import sys import json sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) import pdb from...
b294dd50c94702f02275a3442bb11dceb4ff58187ed56c6a1379d297cbffb67c
Python
3,708
114
"""Custom exception classes. CLASSES ------- ProcessingOrderError : Exception - Class for raising exceptions/errors associated with performing processing steps in an incorrect order. UnavailableProcessingError : Exception - Class for raising exceptions/error associated with trying to perform processing st...
e8ca5e7e1bd43574230e2d0a1874cc2f726e903f16cd2a73560d950e7e788387
Python
3,708
84
import numpy as np, matplotlib.pyplot as plt, sys from scipy.stats import kstest import pumpprobe as pp plt.rc("xtick",labelsize=18) plt.rc("ytick",labelsize=18) plt.rc("axes",labelsize=18) ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" matchless_nan_th = 0.5 matchless_nan_th_added_only = True matchless_na...
0062bdd2bcc04fb86e0e5649e565200d3c8c6b5d14cf0422c92433a4c2f86bd4
Python
3,712
115
import importlib.resources from PyQt6 import uic, QtCore, QtWidgets from ... import pipeline class MatrixFilter(QtWidgets.QWidget): active_toggled = QtCore.pyqtSignal() enabled_toggled = QtCore.pyqtSignal(bool) option_action = QtCore.pyqtSignal(str) modify_clicked = QtCore.pyqtSignal(str) def _...
62b46a0c48b879443f3c2f581a8ca331a445b17785ce222d7a7ed9eb2e96b60a
Python
3,712
131
from typing import Callable, List, Any, Optional import torch from argparse import Namespace import logging import traceback import sys import io class LazyLog(object): def __init__(self, func: Callable[..., Any], *args, **kwargs) -> None: self.func = func self.args = args self.kwargs = kw...
3b9cfdc1128bc346f8945b9333162d5222f49f9ea9e8aba12f3435bd17d39ef2
Python
3,713
88
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
62fe2841bfd9602db4ff74b17b8d85de69af875d5377f7da99b11a699e305fc8
Python
3,713
113
""" This code incorporates modifications to software originally developed by the Turaga Lab, available at https://github.com/TuragaLab/DECODE. The original work is licensed under the GNU General Public License version 3.0 (GPL-3.0). We have adapted and extended this code under the same GPL-3.0 license. """ import t...
0c8475c213b7b6abedaf6b1edba254c58c2237714d0435918ca8b8727d360598
Python
3,716
103
"""Structural checks for the thin notebooks under `notebooks/` (not `notebooks/legacy/`). Parses `.ipynb` files as plain JSON (no `nbformat`/Jupyter dependency, so these tests always run in the default `just test` job): every new notebook must stay a thin orchestration layer over `multimodal_ad` -- no function/class d...
b71d090beb70eb1e53fdbe39c7fcfe4d9246b57da13a58876999eb92406eaa61
Python
3,717
119
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
e8c7e39ce4b3c01b84e1c9d5bc02224c4bab0a9b6ead56fa118a0c0099c19c49
Python
3,717
150
#!/usr/bin/python3 from draw_backbone import draw_backbone def read_aln(file): import sys aln_dict = {} f = open(file) for line in f: line = line.rstrip() tmp = line.split('\t') scaf1, strand1, bg1, ed1, scaf2, strand2, bg2, ed2 = tmp[0:8] if bg1 == '-' or ed1 == '-' or bg2 == '-' or ed2 == '-': continu...
7fef9c91c5c5eb2a1a977005e930f58a790c9369c47a110c337958040308e36f
Python
3,719
141
import numpy as np import pandas as pd from sklearn.metrics import roc_auc_score, average_precision_score import torch def train( model, train_loader, criterion, optimizer, ): total_loss = 0 total_sample = 0 y_list = [] prob_list = [] for static, dynamic, y in train_loader...
9e2586adaf47e674527461d257010a41c5a039aac5b50f95b8fc27cf61d66724
Python
3,719
135
import unittest import torch import math from tnn.regularization import TikhonovRegularization, SmoothTimeRegularization, BlockRegularization from tnn.utils import extract_data, insert_data class TikhonovRegularizerTest(unittest.TestCase): # setup tnn network def setup_network(self): torch.set_defau...
b18d1f7fd3167a571491d22b2a0db31ff041bc7ca6377794e2195c5450cc3df6
Python
3,721
124
import matplotlib.pyplot as plt import matplotlib.ticker as ticker from matplotlib.ticker import MaxNLocator import matplotlib.transforms as transforms import sys import argparse sys.path.append('../') from plotting_functions import * #create figure fig, ax = plt.subplots() #set font # plt.rcParams['font.fam...
2bf2a558eb6f162ffc30b26d2b38fcceda19afed5f21be10b6c636cb520b667a
Python
3,722
62
import sys import pandas import csv import re X = pandas.read_csv( sys.stdin, sep=' ', index_col=False, quoting=0, converters={'word': str} ) #, na_values=default_missing ) #quotechar='|' ) # quoting=csv.QUOTE_ALL ) #, quotechar=None ) #, quoting=csv.QUOTE_NONE ) #X.to_csv( sys.stdout, sep=' ', quoting=0 ) ## Find ...
e5ce76de8bcb866de589409ca5abdc129caa3ad4ab5e2b2cf99647df3c804c12
Python
3,722
124
import matplotlib.pyplot as plt import matplotlib.ticker as ticker from matplotlib.ticker import MaxNLocator import matplotlib.transforms as transforms import sys import argparse sys.path.append('../') from plotting_functions import * #create figure fig, ax = plt.subplots() #set font # plt.rcParams['font.fam...
479095add1e23085e99fb4a6814315e55a3c86dc9ea8cdafa48553be8a313de9
Python
3,723
121
# Copyright 2018-2021 Xanadu Quantum Technologies 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...
5d5e2a6af063b07f4927b11fbcd2e356f71d01ff71fde6bf3a78726429e190c7
Python
3,725
124
# Copyright 2026 Xanadu Quantum Technologies 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 agree...
a299cb14b81c3a18eb38fe768df63f6cec553159a67d7a534829ee75a3a9d969
Python
3,726
120
#!/usr/bin/env python ''' Testcases for the measurements binning ''' import windseer.utils as utils import numpy as np import torch import unittest class TestBinLogData(unittest.TestCase): def setUp(self): self.grid_dimensions = { 'n_cells': 2, 'x_min': 0.0, 'y_min':...
5b3610a02671d577d25327780d5f96aba534cf595db8ae57a0912dca9649fab1
Python
3,727
128
import os import argparse import zmq from collections import defaultdict from model_data_base import distributed_lock import sqlite3 import cloudpickle import yaml config_path = os.environ['ISF_MDB_CONFIG'] with open(os.environ['ISF_MDB_CONFIG'], 'r') as f: config = yaml.load(f) # we here assume backend is sqlite...
5f47bec77f419e53d87ce1f44e854892485b0d485d21e7f515d90a9bba1fa94c
Python
3,727
106
import json import math import os.path import numpy as np import cv2 class DetectionParser: def __init__(self, fname: str = None, py_data: dict = None): if fname: if fname.endswith('.json'): with open(fname) as jf: self.__data = json.load(jf) elif p...
2935b2ab7e82a5a8005253c20ac0ea5100222eb3cfa4b40a7d32308f65d74816
Python
3,731
114
import numpy as np import pytest from pandas.compat import is_platform_arm import pandas as pd import pandas._testing as tm from pandas.util.version import Version pytestmark = [pytest.mark.single_cpu] numba = pytest.importorskip("numba") pytestmark.append( pytest.mark.skipif( Version(numba.__version__)...
6382d039b180f5da14c5b650294805dca9de30a83a6a643b7ecd8903c6d725a1
Python
3,732
122
#adapted from Jacques Lerousseau #this script expects the following input variables with those names: # sfreq: the sampling frequency # trial_duration # prestim_duration: # poststim_duration: # condition_freq: # EVOKED: #import required packages import sys import os import numpy as np import mne import scipy.signal i...
05313bc2d04caf1d426be8d7bfa8234c605a7c1c019c3a3d1b758be8280cf246
Python
3,734
133
#!/usr/bin/python3 import sys import argparse # author: zhouyang zhouyang@genomics.cn from draw_gene import draw_gene_v1, read_gff_v1, draw_gene_model from draw_aln import draw_aln, read_aln from draw_backbone import draw_backbone def read_conf(conf): f = open(conf) gene = {} aln = [] rang = {} flag = 0 orient...
a5cf5119c958ff6e612ff4bde5244fa20cd2aa64d0199a10634c6d2da157ea3f
Python
3,737
108
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestIntervalIndexRendering: # TODO: this is a test for DataFrame/Series, not IntervalIndex @pytest.mark.parametrize( "constructor,expected", [ ( pd.Series, ("(0....
5aef1b8eec6cd8d7ea0f2cc423a69fdd475425d5526e167d547004b368508fdd
Python
3,739
106
from pandas import read_parquet import torch import torch.nn as nn import torch.nn.functional as F # types imports from torch import Tensor from torch.nn import Module, Conv2d, Sequential from sbrnet_core.utils.constants import view_combos RSQRT2 = torch.sqrt(torch.tensor(0.5)).item() class SBRNet(Module): def ...
6cb1f971c997ca9585904fed263985c0441ee7559b91977804fdffd1b31f6f64
Python
3,739
81
import argparse import os from cdr.config import Config from cdr.model import CDREnsemble from cdr.util import filter_models, stderr if __name__ == '__main__': argparser = argparse.ArgumentParser(''' Generate summary of saved model(s) ''') argparser.add_argument('paths', nargs='+', help='Path(s) to...
02cc6f31a50147e1c24b8bc5639b4e9fb9dd31d1362f32de1425276ff6b04b06
Python
3,740
162
""" Period benchmarks that rely only on tslibs. See benchmarks.period for Period benchmarks that rely on other parts of pandas. """ import numpy as np from pandas._libs.tslibs.period import ( Period, periodarr_to_dt64arr, ) from pandas.tseries.frequencies import to_offset from .tslib import ( _sizes, ...
ec7c567272216f18f820c6479a63874a47d92fec4661783707522c7e21987cdb
Python
3,743
94
""" .. module:: tool_smartbrush :platform: Linux, Windows :synopsis: Smart brush tool (2D or 3D) based on the SmartPaint method .. moduleauthor:: Fredrik Nysjo """ from tool_common import * import numpy as np import scipy as sp import scipy.sparse import scipy.sparse.csgraph import scipy.ndimage import glm c...
1f1e18f125c1884ae6c3cf9efa11c718c064d688832624ad1f807ad89075536e
Python
3,744
108
import pathlib import numpy as np from shapeout2 import pipeline def test_get_heredity(): path = pathlib.Path(__file__).parent / "data" / "calibration_beads_47.rtdc" # initialize slot = pipeline.Dataslot(path) ds = slot.get_dataset() ray = pipeline.FilterRay(slot) # come up with a few filte...
85083706e5b7170de1675d402fc29b3335cc8559a90364a9d2480c3822df3575
Python
3,744
113
import functools import itertools import logging from multiprocessing import Pool, TimeoutError import os import signal import time import warnings from Bio.PDB import PDBList, PDBParser from Bio.PDB.mmtf import MMTFParser from Bio.PDB.PDBExceptions import PDBConstructionWarning import h5py import numpy as np import p...
bcf7ec0c83dcd485fae4987675066d1d06b77da538fdf08e3f5a59f1fcc9061a
Python
3,745
82
import pandas as pd import matplotlib import matplotlib.pyplot as plt import numpy as np from pathlib import Path plt.rcdefaults() from matplotlib.backends.backend_pgf import FigureCanvasPgf matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf) if __name__ == "__main__": data_dir = '/Users/eghbalhosse...
0ff0cdd7bef9a86c4b5092203301ef810e65f4e55c59fa2f38e8b9113cda539e
Python
3,746
75
from botocore.client import Config import ibm_boto3 from io import StringIO import types import os import pandas as pd import sys import json sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) import pdb from...
81ce19793063debb3c66bbafb5d100fe38cd9cf2953e7276f14b5155fc489f24
Python
3,747
109
"""Tests for the nimare.diagnostics module.""" import os.path as op import pytest from nilearn.input_data import NiftiLabelsMasker from nimare.diagnostics import FocusCounter, Jackknife from nimare.meta import cbma, ibma from nimare.tests.utils import get_test_data_path @pytest.mark.parametrize( "estimator,meta...
121daee026919293af42626df29033c99994f44669701b746ee066543060d818
Python
3,752
108
#!/usr/bin/env python __version__ = '1.0' import os, sys import random from collections import namedtuple, defaultdict from Bio import SeqIO simType = ['sub', 'ins', 'del', 'match'] simTypeSize = 4 def throwdice(profile): dice = random.random() for i in range(simTypeSize): if dice < profile[i]: ...
ba0e8243e37d0865337e4647cb04aa52464bd006e1e9d5a71f9d7e44f5bf9bbe
Python
3,752
98
# -*- coding: utf-8 -*- import math class GCContent(object): """ Class is primarily used to determine the error probabilities based on the GC-content. """ @staticmethod def _default_error_function(gc_percentage): """ Default/Fallback function to calculate error probabilities base...
d96e13cc3d471205fd7cf65a0c77ae432b5eadb0cb498c76b24477acd648fcd8
Python
3,753
81
"""Iterative SENSE Reconstruction.""" from __future__ import annotations from collections.abc import Callable from mrpro.algorithms.reconstruction.RegularizedIterativeSENSEReconstruction import ( RegularizedIterativeSENSEReconstruction, ) from mrpro.data.CsmData import CsmData from mrpro.data.DcfData import DcfD...
6390f8673f85727e1f7ab3d1887293654f8d70e1fddd57c9f2d03e2d41952946
Python
3,754
87
#!/usr/bin/env python version = "v0.1.0.20220721" import os,os.path,sys,re from argparse import ArgumentParser sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '/home/hongxiaoning/pipeline/bin')) import myc import time if __name__ == '__main__': #Parameters to be input. parser=Argume...
e6f75c4295f7aab5a34f0b44f1d147f77fc8c4a50bb62de886a7d443fb4e9c2e
Python
3,754
113
import torch import bionetwork import matplotlib.pyplot as plt import numpy import plotting import time import pandas import saveSimulations batchsize = 5 activationFunction = 'MML' parameters = bionetwork.trainingParameters(iterations=150, clipping=1) networkSize = 100 batchsize = 5 #networkList, nodeNames = bionet...