sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
86ea53357e191342c4b2e30e99f6f8609da9a2acceb35249db259fbeccdf7a54
Python
2,054
75
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize( "keep, expected", [ ("first", [False, False, True, False, True]), ("last", [True, True, False, False, False]), (False, [True, True, True, False, True]), ], ) def test_duplic...
92dfe1d780e5872c9f8f2e3f8546264019d80b1a1c92766810f0e2d8983cb60b
Python
2,054
93
from __future__ import annotations from typing import TYPE_CHECKING from pandas.plotting._matplotlib.boxplot import ( BoxPlot, boxplot, boxplot_frame, boxplot_frame_groupby, ) from pandas.plotting._matplotlib.converter import ( deregister, register, ) from pandas.plotting._matplotlib.core impo...
bbb1713cc1e3662d0ced53c6d5f8e0a8b3527ebf0492b3a13aeb354e193b2949
Python
2,054
42
############################################################################### # This script converts the table to a network and prepares the files to the # # gephi format # # # ...
963cbd9cea2c433dc893367a941b37303d52de9d56c601530d0df8743c1c9b7d
Python
2,055
65
# Copyright 2018-2024 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...
c03062c17333c9b03eb4d26cff12d87fc3cf766d890fad5be7b7a3db316a6698
Python
2,055
83
# Copyright 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 agre...
092166ad58da6c9dae12a691eabef0c06ab22532d5d4a4970e02573d52645291
Python
2,056
39
import pandas as pd import os import sys from pathlib import Path 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 from config.globals import ENVIRONMENT visit_dictionary = { ...
6f87001ca2c52e7eb20b15a9163aee86ef8f712763cbedc742eb911c75a3d5fa
Python
2,057
47
"""Transparent exposure and transferred-risk calculations, without health records.""" import numpy as np def who_band(values, cutpoints): """Upper-inclusive guideline bands, with -1 reserved for missing values.""" values = np.asarray(values, dtype=float) result = np.searchsorted(np.asarray(cutpoints), val...
7772d44d48f613b5291aa2506c4cefe819f413f684eeb37b19470753d18ff361
Python
2,057
68
"""Alembic environment. Pulls the database URL from `pycaret_server.config.get_settings()` and the metadata object from `pycaret_server.db.Base`, so new tables auto-appear in ``alembic revision --autogenerate``. Override the URL for one-off ops (e.g. running migrations against a staging DB without touching env vars) ...
3f0edc30586c44ab39fc590dfd5e110cea4a2376c748f39669e5686ca34b1d57
Python
2,059
82
# -*- coding: utf-8 -*- import json import time import sys import uuid import qsub dcc_data_path = "/projectnb/dunlop/JB/deepcellcontrol/" dcc_repo_path = "/project/dunlop/shared_python_packages/deepcellcontrol/" sys.path.insert(0,dcc_repo_path) import deepcellcontrol as dcc def params_change(params): pri...
a0d0c2532f023e73a8148b1e84195920054ec6cc3e42e25b3978ea09756f3770
Python
2,059
69
import pytest import pandas as pd from pandas.tseries.offsets import ( BaseOffset, Day, Hour, MonthEnd, ) class TestFreq: @pytest.mark.parametrize("values", [["0 days", "2 days", "4 days"], []]) @pytest.mark.parametrize("freq", ["2D", Day(2), "48h", Hour(48)]) def test_freq_setter(self, ...
beff8aa0efc867e071b7f87f60ac6449948e16a003af5ff9817ae0f7f0a02583
Python
2,059
58
##################################################################################################################### # Date created : 10/21/2022 # Date modified: 10/21/2022 # Purpose : This program is to crate features for forward and reverse direction to next and previous Ca-Ca total 6 ########...
3ef3a99dee47fc99c1fa19e9c645976bc9e312c864ae7d30cc41b6779eefed4b
Python
2,060
64
""" .. module:: tool_manager :platform: Linux, Windows :synopsis: Manager for handling state of segmentation tools .. moduleauthor:: Fredrik Nysjo """ from tool_common import * from tool_brush import BrushTool from tool_polygon import PolygonTool from tool_livewire import LivewireTool from tool_smartbrush impor...
1e5b83f899e7a9ddaa1bf0eb8c5dc42dc56b9afdc0c853c1c7934a77beab5275
Python
2,061
104
background_style = """ QMainWindow { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 #000000, stop: 0.25 #0f3460, stop: 0.5 #000000, stop: 0.75 #0f3460, stop: 1 #000000); } """ separator_style = """ color: #4b77be; background-color: #4b77be; """ title_style...
4777cb88482932dda199717031ff5086ece1a223a295afaa870d04d667fd9c91
Python
2,061
51
#! /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...
7dd88377eef260bcca9dcf44365e4e50b089606b2b11cd222eb1531ba45bc2d3
Python
2,061
48
import sys import os import argparse import pandas as pd from cdr.data import compute_splitID, compute_partition if __name__ == '__main__': argparser = argparse.ArgumentParser(''' A utility for splitting a dataset into train, test, and dev sets given splitting criteria. ''') argparser.add_argument(...
f572bf242a1a10621b2f827c66103134471422ab6d4992f5bf81e1ffa6454660
Python
2,061
69
###################### ### Import Library ### ###################### from rdkit import Chem import networkx as nx ########################## ### Utilities Function ### ########################## # smiles to mol def mol_to_smiles(mol): smiles = Chem.MolToSmiles(mol) return smiles # mol to smiles def smiles_t...
d974fcca24e421ca7cc91e722317c609a77113aff663bb18f132203a614c4214
Python
2,062
84
# %% from pathlib import Path import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from scipy.stats import pearsonr results_dir = Path(__file__).parent.parent / "results" / "3_gf" # %% preds_fname = "cv-LOO_corrsign-pos_sigthresh-0.01_cvpreds.csv" preds_df = pd.read_csv(results_dir / preds_fname...
77009cdb85528710b116ce92bf04f38ba103e1e58e2942da68bcf0b57608412c
Python
2,065
90
# coding: utf-8 from pytest import raises import io from multiprocessing import Process, Queue import time from atropos.commands.multicore import * class TimeoutException(Exception): pass log_capture_string = None def setup(): ### Create the logger logger = logging.getLogger('basic_logger') logger...
0839d8aaf5ca6ae8002faf0063e4f0953aafd3ce068da8e8949921daa998be8e
Python
2,068
59
# NHE3 exchanger modules #--------------------------------------------------------------------- # NHE3 EXCHANGER AT LUMINAL MEMBRANE OF CELL # n is for Na, c is for Cl # p (or prime) is for the luminal compartment (M) # pp (or double prime) is for the cytosolic compartment (I) #-----------------------------------------...
14942584b15cf5ba59b737ccb8441f8dfc40ed071fcd5da558394972edf270ea
Python
2,068
59
class RLScheduler: def __init__(self): pass def update(self,current_lr, entropy_coef, epoch, frames, **kwargs): pass class IdentityScheduler(RLScheduler): def __init__(self): super().__init__() def update(self, current_lr, entropy_coef, epoch, frames, kl_dist, **kwargs...
ea0133e9b276f1e264364d0799f46963827f91496c7595df7e271ef68b1e3641
Python
2,069
51
import numpy as np, matplotlib.pyplot as plt from scipy.stats import mannwhitneyu import pumpprobe as pp plt.rc('xtick',labelsize=18) plt.rc('ytick',labelsize=18) plt.rc('axes',labelsize=18) wt_f = np.loadtxt("/projects/LEIFER/francesco/funatlas/funatlas_intensity_map_cache.txt") unc31_f = np.loadtxt("/projects/LEIFE...
4240df608c99bc02ef6825f5337069cb48f3fb418a6eda7ec3e170a101fbe91d
Python
2,072
65
import pytest import pandas.core.dtypes.concat as _concat import pandas as pd import pandas._testing as tm def test_concat_mismatched_categoricals_with_empty(): # concat_compat behavior on series._values should match pd.concat on series ser1 = pd.Series(["a", "b", "c"], dtype="category") ser2 = pd.Serie...
8a2892aca8a147115eac9e3b3f6f0daa188d67dcfc24fd526f6b65abfb5def45
Python
2,074
69
"""A clock may demand a preprocessing marker in ``adata.uns``. No shipped clock uses this any more -- the cohort-relative clocks preprocess themselves inside ``predict_age`` (see ``test_cohort_transform.py``) -- but the mechanism stays for any future clock whose input contract cannot be satisfied automatically, and a ...
1c3b9781cf68690324cec9f95335385246d77d4008235400ecc155553588cb44
Python
2,078
73
import pytest import pandas as pd import pandas._testing as tm class TestSeriesDelItem: def test_delitem(self): # GH#5542 # should delete the item inplace s = pd.Series(range(5)) del s[0] expected = pd.Series(range(1, 5), index=range(1, 5)) tm.assert_series_equal(...
c8559ca35a3ab019452701c5a04b98ff561f7d9019f5c5fcfee990070816f0bf
Python
2,079
53
import numpy as np, matplotlib.pyplot as plt, sys import pumpprobe as pp, wormdatamodel as wormdm plt.rc('xtick',labelsize=14) plt.rc('ytick',labelsize=14) plt.rc('axes',labelsize=14) ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" funa = pp.Funatlas.from_datasets( ds_list,merge_bilateral=Tr...
64b8c5d23eef989f702cc4f4c51d7beeeaa772964d22c44b2ee612b8a2ddf984
Python
2,080
78
import torch import torch_geometric import logging from pathlib import Path from tqdm import tqdm import os from ocpmodels import models from ocpmodels.common import logger from ocpmodels.common.utils import setup_logging, load_config from ocpmodels.datasets import LmdbDataset from ocpmodels.common.registry import regi...
a500259674820bf6e8a52b7d2c413281e53e151afad1054c070b2c493b94f49b
Python
2,080
73
import dclab import matplotlib.pylab as plt # dataset ds = dclab.new_dataset("unknown_dataset.rtdc") # kernel density estimate kde = ds.get_kde_scatter(xax="area_um", yax="deform") # isoelasticity lines isodef = dclab.isoelastics.get_default() iso = isodef.get_with_rtdcbase(lut_identifier="LE-2D-FEM-19", ...
0f41127c9343e8c7944eac183989b0ac9b1f0de608408a56d8235a07307d28d2
Python
2,083
73
from datetime import ( datetime, timedelta, ) import pandas as pd import pandas._testing as tm def test_unique(tz_naive_fixture): idx = pd.DatetimeIndex(["2017"] * 2, tz=tz_naive_fixture) expected = idx[:1] result = idx.unique() tm.assert_index_equal(result, expected) # GH#21737 # En...
29353b9712cad398274ff147a1cab94553381163ce293c32e82ec032a2367913
Python
2,086
52
from __future__ import print_function vapor_version='vapor.py V1.0 12-21-2015' def print_read_me(): print (vapor_version) print ('Contact: Xuefang Zhao (xuefzhao@umich.edu)') print ('') print ('Usage: vapor.py [Options] [Parameters]') print ('Options: ') print (' svelter') print (' vcf') print (' bed') print (...
9a5f8e131f4109065d4bc013af9a256f518d4d8121f4382172ce8977047aefdc
Python
2,086
60
from setuptools import setup, Extension, find_packages import sys import numpy as np from Cython.Build import cythonize __author__ = "etseng@pacb.com" version = "29.0.0" ext_modules = [ Extension("cupcake.tofu.branch.intersection_unique", ["cupcake/tofu/branch/intersection_unique....
d0e4ae3c5b72d9fe9e41508ced1b449bb4070d164a5e7fb6eb711e7eb005d5b4
Python
2,087
61
# -*- coding: utf-8 -*- class Homopolymers(object): """ Class is primarily used to determine the error probabilities based on homopolymers. """ @staticmethod def _default_error_function(homopolymer_length): """ Default/Fallback function to calculate error probabilities based on hom...
1bc3ea9b58a3965a00ac7a9394ce3892f46dfe10cdcbd30c3f0b575eced3c204
Python
2,091
60
import torch from torch import nn from torch_geometric.utils import scatter from ..mlp import MLP # Typing from torch import Tensor from typing import List, Optional, Tuple class EdgeProcessor(nn.Module): def __init__(self, dims: List[int]) -> None: super().__init__() self.edge_mlp = nn.Sequenti...
2396e191348551adc47349b990b8c5cf2ccf1b6b5bfcfd4876f3637bbb04f898
Python
2,093
56
import os import cv2 import numpy as np def _colorMap_blur_JET_(image): # image = cv2.imread("figure/temp.jpg", cv2.IMREAD_GRAYSCALE) # imput origin image data image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) zoomScale = 0.8 # res_image = None res_image = cv2.resize(image, dsize=None, fx...
d8317acdea9dab86769914620f2230d371bc8fa255427d0410cfe68f2dc59551
Python
2,095
66
# Copyright 2018-2022 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...
08abe4c75ed52de8391d9cad961e492fdf5807367fbca1a6630ff3f7371804b8
Python
2,096
82
import h5py import matplotlib.pyplot as plt import numpy as np import sigpy as sp from sigpy.mri import sms, retro import os DIR = os.path.dirname(os.path.realpath(__file__)) print('> current directory: ', DIR) HOME_DIR = DIR.rsplit('/', 1)[0].rsplit('/', 1)[0] DAT_DIR = HOME_DIR + '/data' print('> data directory: ...
163614ad430017b84ece985a5c40ffffcca3785d074dc7194baab4e7ffeb1f8e
Python
2,096
81
import json import os import re from pandas.util._print_versions import ( _get_dependency_info, _get_sys_info, ) import pandas as pd def test_show_versions(tmpdir): # GH39701 as_json = os.path.join(tmpdir, "test_output.json") pd.show_versions(as_json=as_json) with open(as_json, encoding="u...
43b335f5a8ba31729179f26f49d1acb42e137e5ecf6e0859b4267c1cdaaee683
Python
2,096
55
#Run and save results of sweeps over time constants for 20 fields, for eta = 4 and epsilon = -3 (equiv to -12) #Date written and executed: 2021-12-18 import numpy as np from placerg.funcs import * from placerg.funcsrg import * from placerg.objects import * from placerg.runfunc import * from placerg.avafunc import * N...
e309d81ef1bffac5d8acf0b4323f06dae2885247c1a0d372409c4640c7ec3893
Python
2,096
63
import pytest from pcntoolkit.normative_model import NormativeModel from pcntoolkit.regression_model.blr import BLR from pcntoolkit.regression_model.hbr import HBR class TestNormFactory: """Test normative model factory functionality.""" @pytest.fixture(autouse=True) def setup(self, temp_output_dir): ...
e6c1a30be71ce33084f99deb28978115904fd14bb05d94694c9596781176acfc
Python
2,096
60
""" Script to prepare training csvs with pseudo-labels """ import shutil import matplotlib.pyplot as plt import pandas as pd import os import cv2 import numpy as np test_path = r'data\segmentation\test' test_list = os.listdir(test_path) test_list = [x.lower() for x in test_list] train_path = r'data\segmentation\trai...
ad2d1aaafc73fba8bcf19cc049b969cac653e9e60c24223f5a16fc111ec17b0a
Python
2,097
60
import argparse import json import os from typing import List parser = argparse.ArgumentParser() parser.add_argument("--rnng_data_root", type=str, default="rnng-pytorch/data") parser.add_argument("--train_file", type=str, default="npcmj-train.json") parser.add_argument("--val_file", type=str, default="npcmj-val.json"...
dd4cdf78c7ad5878eb4d8c3e7f40aeff996375ebd4f59b15c3b5b69452efbbae
Python
2,097
77
import sys import numpy as np from sklearn.model_selection import train_test_split from util.check_tools import get_input_file,check_label_config import os import setproctitle setproctitle.setproctitle("DASDC") soft_limit = 2000 hard_limit = 1500 ipt = sys.argv[1] config = sys.argv[2] outdir = sys.argv[3] if os.path...
14219fc90be28ae059e7994cdecaadeadec27b5b60345f2183beed58f6a5cecd
Python
2,098
72
# Copyright 2018-2023 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...
572c2733e0e83587e4fb80822402110270dafb52dce7a7ea4d55b386ddfe10dc
Python
2,099
55
import numpy import os import subprocess from distutils.core import setup, Extension from Cython.Build import cythonize from pathlib import Path from typing import List class LPCNetExtension(Extension): """ Extended extension class that runs the autogen.h and configure script before installing the LPCNet wrap...
bfa76ca91a5da238c0fbcbbc5bfbc86e79089ba2d215fb24139f2e638e6b6f1e
Python
2,101
54
import pandas as pd from src.plotting import set_r_params, set_style import seaborn as sns def load_worklist(path,column_names, column_name_mapping): """Load worklist from excel file args: path (str): path to excel file column_names (list): list of column names to load column_name_mappi...
ffec1014cae890bb13908885da0f047153d4263405e9bb030bbccb3b0eded0cb
Python
2,102
72
''' Script to generate a test dataset from an existing dataset with resampling and data augmentation if requested. ''' import argparse import windseer.data as data # parse the command line arguments parser = argparse.ArgumentParser( description='Script sample a fixed dataset for model performance evaluation' ...
c035f42b32eb0e36df0cd17b683ef7a11b51d42619ba5d0855b28ef4d0aa12a2
Python
2,103
60
import argparse import os from Bio import SeqIO def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='Fasta-Make-Long-Seq-Bins.py', description="""Write fasta seqs to individual fasta files if longer than length threshhold.""") ...
5b00488ea8591a742c7e73251096c1c34a5c78170280a05e7b8f26ea11dd2907
Python
2,108
71
import numpy as np import pytest from pandas._libs.byteswap import ( read_double_with_byteswap, read_float_with_byteswap, read_uint16_with_byteswap, read_uint32_with_byteswap, read_uint64_with_byteswap, ) import pandas._testing as tm @pytest.mark.parametrize("read_offset", [0, 1, 7, 11]) @pytest...
c359e87c3b2b2d7f75e46d374bc0a9cd5b4fc03a99a366ca92dad17a94cdf9d7
Python
2,109
60
""" Test to verify that MSLL is computed correctly regardless of data scale. This test addresses the issue where MSLL was scale-dependent because the baseline log-likelihood was computed on unscaled Y values while the model log-likelihood was computed on scaled Y values. The fix ensures both are computed on the same ...
7a66598ded7fd581caef601a0e4f48aef653f2be9984003541c7bad47473ece3
Python
2,111
74
# JN 2015-02-09 refactoring """ These functions allow for fast and convenient access to clusters """ from __future__ import print_function, division, absolute_import import logging logger = logging.getLogger(__name__) import numpy as np def get_data_from_sessions(sorting_man, sessions,\ sign='pos', items=Non...
d2900f6f9767d1947e3ed0d555af00a3cb2226ca9d26f247e506387365c8914a
Python
2,111
59
# 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...
f582d25531f7f20867bd113a273dbb5e09150a437e856ca8030c15deb02bd15d
Python
2,112
60
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
2f9a35d7f13357e4ab56c160b9e6f59bb714080b8eff7a0a62dc59c02380650c
Python
2,113
65
from pandas.core.internals.api import make_block # 2023-09-18 pyarrow uses this from pandas.core.internals.concat import concatenate_managers from pandas.core.internals.managers import ( BlockManager, SingleBlockManager, ) __all__ = [ "Block", # pyright:ignore[reportUnsupportedDunderAll] "BlockManage...
c39e61c62232d350e427ea69a04faef484909aa956cea6870ec7eace66e7ec4b
Python
2,113
79
# -*- coding: utf-8 -*- from itertools import product import numpy as np import pytest from emcee import moves from .test_proposal import _test_normal, _test_uniform __all__ = [ "test_normal_gaussian", "test_uniform_gaussian", "test_normal_gaussian_nd", ] @pytest.mark.parametrize("mode,factor", produ...
234096c8bc19202c32f02929b02eee69e4e559a4ed51240173ffb29060bba3e8
Python
2,117
78
from setuptools import find_packages, setup with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() long_description += "\n\n" with open("README.md", "r", encoding="utf-8") as fh: long_description += fh.read() extras = { "all": ["dm-reverb", "flappy-bird-gymnasium"], "rever...
cea4d9370d6a27047ef21c3a740fcce01c3f5e6daa885fe2d68482d52092e8cc
Python
2,117
59
import torch import pandas as pd import copy import itertools from pytorch_classes_and_functions import AmesDataset, DNN, do_training device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") #store parameters and auc in lists for each hyperparameter combination parameter_list = [] auc_list = ...
0198e743ab9a636e623358b9508022a3e79e1260abe35e365fdeef6afd68b74e
Python
2,119
46
from matplotlib import pyplot as plt 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_hcc1395_recall(): fig, ax = plt.subplots(1, 1, figsize=(4, 4)) size = 0.2 ...
4b515e43b0280aadc5aab29a8a984bb82a28364523a8f41b72063d6357c54cac
Python
2,119
50
# 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...
4f561d4dab5546fb0009624094e0a5ec5b6d759b7d0e67259864b5fc8ec22c44
Python
2,119
74
""" Three Gaussians spread along the diagonal of a six-dimensional hypercube. This coding style for the integrand is the simplest but also gives the slowest runtime. Compare performance with faster.py and fastest.py. """ from __future__ import print_function # makes this work for python2 and 3 import vegas impor...
910c361c9a8872129972f266884e02e0953df01ab943b28cd2a8cd59356c6048
Python
2,119
75
import os import pandas as pd from matplotlib import pyplot as plt import os import numpy as np def plot_denovo_number(): val_dict = { "debreak_SURVIVOR": 8269, "debreak_Jasmine": 10597, "cuteSV_SURVIVOR": 5831, "cuteSV_Jasmine": 12074, "SVision_SURVIVOR": 6813, "...
6938fa4b4de5da1a1ab6059657464f659a919126298d22c627376d0ba5c1d5e2
Python
2,120
66
import sys sys.path.append('.') import time from CommonSystem.MessageReceiver.ExchangeMessageManagement import ExchangeMessageManagement from CommonSystem.Config import Config from OperationSystem.operationOperator import operationOperator from OperationSystem.AnalysisProcess.AnalysisController import AnalysisC...
9b6353065794009ad9595277094f497a9fdefa933f2f8fdad861c74484884988
Python
2,120
70
from os.path import join import sys import argparse import json import h5py import VINNA.utils.misc as misc from VINNA.utils.load_config import get_config from VINNA.train import Trainer def setup_options(): # Training settings parser = argparse.ArgumentParser(description='Segmentation') parser.add_argu...
174eea24d4a6c24e2a3e352e0c9e13925443d62ea7991c495a6ec1b53639fab2
Python
2,121
47
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__), "..", ".."))) from app import create_app, db from app.models import Subject, SourceDataset from config.globals import ENVIRONMENT ...
4823e60518a1f7a9dca601ebf21b7f0e5efaf73c2f583151824c0e624fd26efb
Python
2,121
49
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_data.ipynb (unless otherwise specified). __all__ = ['canonicalize_with_dict', 'generate_buchwald_hartwig_rxns'] # Cell from rdkit import Chem from rdkit.Chem import rdChemReactions # Cell def canonicalize_with_dict(smi, can_smi_dict={}): if smi not in can_smi_di...
bbc961439ddc9cc9839e6865ea94f6e908d00557fbb4884d9390090932187cc9
Python
2,122
45
# SmoothGrad from .guided_backprop import get_guided_backprop from .grad_cam import get_grad_cam from .guided_grad_cam import get_guided_grad_cam from .guided_ig import get_guided_integrated_grads, compute_grads from .integrated_grads import get_integrated_grads from .vanilla_grad import get_vanilla_grad from ..utils.p...
eb1c927376d8e268e1d1c09e4740874bc33214444866f7eb24bdb9c22b7c9c92
Python
2,122
92
"""Module for zernikegram convention""" from typing import Iterable,List,Dict import numpy as np channel_ordering = ['C','N','O','S','H','SASA','charge'] def channel_freq_to_ind( channel: str, freq: int, channels: Iterable[str]=channel_ordering, freqs: Iterable[int]=np.arange(21) ) -> int: """Ge...
8c705a7ccf8618a764f51e182e51affa7447e44470441e98751093b5541381e5
Python
2,123
68
import setuptools import codecs import os.path def read(rel_path): here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, rel_path), 'r') as fp: return fp.read() def get_version(rel_path): for line in read(rel_path).splitlines(): if line.startswith...
bb65b87507572cb3caf06a2a21a40e16c6fc08c4c9c5cf64db743ebd0683dfca
Python
2,123
74
import torch import torch.nn as nn from copy import deepcopy class BlockRegularization(nn.Module): def __init__(self, args): super(BlockRegularization, self).__init__() self.regs = [] for a in args: self.regs.append(a) def forward(self, net: nn.Sequential): reg = 0...
245f8caff1c9102f6c900d050636d56d2f0da15e55e3b3f5d62744d518e438b4
Python
2,125
54
import numpy as np import pandas as pd from immupute_dis import immupute_dis def tfidf(ATAC): O = 1 * (ATAC > 0) tf1 = O / (np.ones((O.shape[0], 1)) * np.log(1 + np.sum(O, axis=0))[np.newaxis,:]) idf = np.log(1 + O.shape[1] / (1 + np.sum(O > 0, axis=1))) O1 = tf1 * (idf[:, np.newaxis] * np.ones((1, O.sh...
72e040f9244e44703f7cfa4b439840e5b12bf39b325c23c96aaa37a81f4f022f
Python
2,128
71
import vegas import numpy as np from outputsplitter import log_stdout, unlog_stdout import gvar as gv dim = 20 x0list = np.array([ 5 * [0.23] + (dim - 5) * [0.45], 5 * [0.39] + (dim - 5) * [0.45], 5 * [0.74] + (dim - 5) * [0.45], ]) @vegas.batchintegrand def f(x): ans = 0 for x0 in x0list: ...
db8ed95a08594307cd48a9d5e333b4b8e2aa02d5df22a2f61a058442ab2a5c5e
Python
2,129
65
#%% from src import estimator from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF import numpy as np def test_estimator_gpr_kernel_none(): gpr_expected = GaussianProcessRegressor() gpr = estimator.GPR(kernel=None) assert gpr.kernel == gpr_expected....
83850a3351b5bbb6072d74355b25827a4c7a6b95e47f52092da702d0e56c1b9a
Python
2,130
45
import numpy as np, matplotlib.pyplot as plt import pumpprobe as pp plt.rc("xtick",labelsize=18) plt.rc("ytick",labelsize=18) plt.rc("axes",labelsize=18) '''funa = pp.Funatlas(merge_bilateral=True) RID, ADL, URX, AWB = funa.ai_to_head(funa.ids_to_i(["RID","ADL","URX","AWB"])) act_conn = np.loadtxt("/projects/LEIFER/f...
8e117545b0abd9386ad37411f2e0083048a4ef18f228438ed5924763d5da3d1d
Python
2,130
54
# -*- coding: utf-8 -*- import json SYNTHESIS_ERROR_JSON = "config/error_sources/synthesis.json" STORAGE_ERROR_JSON = "config/error_sources/storage.json" SEQUENCING_ERROR_JSON = "config/error_sources/sequencing.json" class ErrorSource(object): def __init__(self, process=None, config_file=None): """ ...
4681716308498f14441b1fac59bc185fcbc1306f7b2287c73a36fd776946c19c
Python
2,131
53
import os import json import concurrent.futures import time from collections import defaultdict # 提取permission ,并统计频次 # 此处的filename传入的是反编译后的apk文件名 # 遍历提取每个文件的permission并存储 # 写多线程 # 多进程 一次处理20个 开16进程: permission_frequency = {} #统计所有权限出现的频次 apkfilename = [] #带绝对路径的文件名列表 path = r'E:\pythonProject\Experiment\...
478825b0613dbdea93a512d6d03d547a24bff2ed44cd2aac2518733514180f72
Python
2,131
76
import numpy as np import pandas as pd from pandas import DataFrame try: from pandas.core.construction import extract_array except ImportError: extract_array = None class DataFrameAttributes: def setup(self): self.df = DataFrame(np.random.randn(10, 6)) self.cur_index = self.df.index ...
9d2e1f36236c733cf2c9d6930f72ad1388a20f2b688430aa191bbe8a06f880cd
Python
2,131
92
import os import sys import time from multiprocessing import Pool import h5py import matplotlib.pyplot as pl import numpy as np import emcee sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", ".."))) # import acor def lnprobfn(p, icov): return -0.5 * np.dot(p, np.dot(icov, p)) def random_cov...
7ab49da583d0746b961ead1b23a2a925aada4e5e8cabbcee86615d69b6521ffb
Python
2,133
77
import numpy as np import torch from sequence_models.convolutional import ByteNetBlock, ByteNet, ConditionedByteNetDecoder, \ HierarchicalCausalConv1d, MaskedCausalConv1d if torch.cuda.is_available(): device = torch.device('cuda') else: device = torch.device('cpu') b = 5 d = 8 ell = 7 k = 3 dil = 2 block ...
4f65c95475e242b04baa8f480c3bda711c94615371881abf586842ac5ec3f6cf
Python
2,134
52
import time from ApplicationProcess.BasicAppProcess import BasicAppProcess from psychopy import core, event class AppdisplayProcess(BasicAppProcess): def __init__(self) -> None: super().__init__() def run(self): escape_key = 0 while escape_key == 0: ...
88afad58c0eed0a9582591c300052d11f2d8a269f7ae43b0fcd4383bd3455f8f
Python
2,134
46
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np import json import time import openmc from utils.mcsimulation_square import * from env_config import * #=========================set values below========================== num_sources = 1 # the number of radiation sources to place. a_num = ...
3e380dcbe3e7631159fb93f411122a2a326ee6ea4be403763b8a837ed82ebc0c
Python
2,136
61
import logging from pathlib import Path import click from dotenv import find_dotenv, load_dotenv import mlflow from train_model import load_data from evaluation import summarize_per_seqlens import glob def get_last_models(exp_name, run_id=None): exps = mlflow.search_runs(experiment_names=[exp_name]) if run_id...
adb1bf40e88aef687a01533da314c470a576664f6a242ac1c9f90e28f4ed88c7
Python
2,136
49
import torch from torch_geometric.data import Data from graphite.nn import bond_angles, dihedral_angles class MolData(Data): def __inc__(self, key, value, *args, **kwargs): if key in {'edge_index', 'bnd_index', 'aux_bnd_index'}: return self.x_atm.size(0) if key in {'ang_index', 'bnd_a...
f3dd78e97872c55fda283369b2c3e2bd4fccf64716c9dbb7adde0f16ed58c29c
Python
2,136
67
#----------------------------------------------------------------------------- # Vina Features #----------------------------------------------------------------------------- import os import fileinput import sys def runVina(fn, protpdbqt, ligpdbqt): """Run modified AutoDock Vina program with Vina score and 58 fea...
ca46ec5b57ddb0652ffbc7ae36ab5c69e381aa5b561e64b85e4fdc4a5f1c6540
Python
2,137
66
#!/usr/bin/env python synopsis = "\n\n usage: format_OrthNetEdges_4SIF.py <input.clustered.edges>\n\ \n\ 1. Input\n\ - expect the format same as the '*.clustered.edges' file generated by 'create_ortholog_network.py'.\n\ - i.e. <clusterID>, <queryID>, <subjectID>, <CLtype_fwd>, <CLtype_rev>, tab-delimited.\n\ 2. O...
1ad9aad4fcca0376626f7f97713a1ba336e573c5554fdcd892846f36793e1bfd
Python
2,138
75
import sys import os from ._version import get_versions class Versions_cached: def __init__(self): self._git_version = None self._conda_list = None self._module_version = None self._hostname = None @staticmethod def _get_module_versions(): out = {} for ...
d32b3f82f6bc69efb58b553a534b6d59362350f96524d65b4a6b63b3836a32ec
Python
2,138
87
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun May 14 08:11:31 2023 @author: tomas """ import numpy as np import glob import random import pathlib import math from matplotlib import pyplot from skimage.io import imshow from matplotlib.patches import Ellipse from sklearn import decomposition, clust...
a805f17a586e99147192b195f3b5ecdf66785732139b7d4dac5a633934b1014b
Python
2,140
64
__all__ = [ "AminoAcidInfo", "AminoAcidCollection", ] import os from dataclasses import dataclass from typing import Dict, Mapping, Optional from ...util.io.yaml import load_yaml from ..common.elements import ElementCollection, ElementComposition @dataclass(frozen=True) class AminoAcidInfo: name: str ...
8018898c47a0c11ca668b1107c416c4b2dcc8bf7532faf310f8f398d61738b7b
Python
2,141
66
"""Text extraction tools.""" import logging import os.path as op import pandas as pd from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from ..utils import get_resource_path LGR = logging.getLogger(__name__) def generate_counts(text_df, text_column="abstract", tfidf=True, min_df=50, max_d...
879c0cdb4afb3ff43c09c62fc7f71dd7faf95384111ce0246640c5e4f5e3cc4f
Python
2,141
82
#!/usr/bin/env python from __future__ import print_function import argparse import windseer.nn.models as models import windseer.utils as utils import numpy as np import time import torch import os import gc parser = argparse.ArgumentParser( description='Script to plot a prediction of the network' ) parser.ad...
18c5dc8a566ceace766f336de3202227adb9299438c435208efde63ba3740336
Python
2,142
46
# 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...
b7e0ab185bc49f883c34c7e191c5d83fbe938623af572ff5ca0f459c71e0ee27
Python
2,142
65
import torch from torch.utils.data import Dataset, DataLoader from torch.distributions.bernoulli import Bernoulli import numpy as np torch.manual_seed(0) # stationary bandit class StationaryBbs(Dataset): def __init__(self, n_samples, n_actions, lamada): super().__init__() self.n_samples = n_sampl...
311039b247981d23cf79a9da90b341fe68b65f7ff440ddcdcfd2811da9c558ad
Python
2,143
44
"""PyTest fixtures for signal models.""" import pytest # Shape combinations for signal models SHAPE_VARIATIONS_SIGNAL_MODELS = pytest.mark.parametrize( ('parameter_shape', 'contrast_dim_shape', 'signal_shape'), [ ((1, 1, 10, 20, 30), (5,), (5, 1, 1, 10, 20, 30)), # single map with different contrast ...
a837d0bb31ef3a3245afbfe45ecd20a0dccf3c33c358d2bd917c7f1abe600fd1
Python
2,143
81
import matplotlib.pyplot as plt import numpy as np import pandas as pd import sys import matplotlib.ticker as ticker import matplotlib.transforms as transforms from pathlib import Path #set font plt.rcParams['font.family'] = 'Gargi' #create figure fig, ax = plt.subplots() #import data dataSheet = sys.argv[1] #p = P...
acd56a8c3f47e093c6ff6a45679e318d4c8ea37619a30a3603b96ebe190aa38d
Python
2,144
62
import numpy as np, shutil, os import pumpprobe as pp, wormdatamodel as wormdm, wormbrain as wormb ds_tags = None ds_exclude_tags = "inx1" ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" dst_main = "/projects/LEIFER/francesco/funatlas/exported_data_full/" # Load Funatlas for actual data funa...
88be541c19132695cece01854033723bfdc79b5c8b39b6f204df1b22ee6b4df1
Python
2,145
77
#%% from src.config_handler import read_yaml, get_entry from src.step_factory import StepFactory class PipelineRepresentation(): """ A class representing a pipeline with a name, description, and steps. Attributes: ----------- name : str The name of the pipeline. description ...
a8bf201293df3e02cb479895b53f01f01c2ecb98f42efd05e656eb44c738fe31
Python
2,145
62
"""Remap command for the lightning-pose CLI.""" import argparse from pathlib import Path from textwrap import dedent from typing import Any def register_parser(subparsers: Any) -> argparse.ArgumentParser: """Register the remap command parser.""" # Choose documentation link depending on whether we're being im...
d1644fb21b8e9fdea78332de3e653ca17bd7a8d02947bbd088c0337c2a2384c7
Python
2,145
64
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Get ROI time course from ROI. Vinding, M. C., Eriksson, A., Low, C. M. T., Waldthaler, J., Ferreira, D., Ingvar, M., Svenningsson, P., & Lundqvist, D. (2021). Different features of the cortical sensorimotor rhythms are uniquely linked to the severity of specific sympt...
5717373e36d60d6f10f3bcda61704bba3083b657968d4d1439d718d7174b36f2
Python
2,146
88
import re from typing import List, Optional from nltk import Tree def _remove_wrapper(tree: Tree) -> Tree: tree = tree[0] return tree def _remove_thematic_role(tag: str) -> str: tag = re.sub(r"([^-]+?);.*", r"\1", tag) return tag def _remove_func_tags(tag: str) -> str: if tag == "multi-senten...
b965ab93aba7cc60f9f2d76964afb3cf6d08cbf759e3b83237b033b14df59d27
Python
2,147
43
_chained_assignment_msg = ( "A value is being set on a copy of a DataFrame or Series " "through chained assignment.\n" "Such chained assignment never works to update the original DataFrame or " "Series, because the intermediate object on which we are setting values " "always behaves as a copy (due t...
0b8c175d19b9e145e887bf2eb95f1869f2dea9daf681cd8f2f59dc7967c62860
Python
2,148
71
# 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...
a6c562227af80ba6e01bfe2c6bd1d81cf09406194403400ebae1847cb05e3a0e
Python
2,150
50
"""Run native compatibility tests with explicit parent installation guards. Run from a source checkout. --installed requires that checkout to have no in-place extensions, imports the installed package before pytest collection, and verifies that every subprocess test derives that same installation. """ import argparse...
35a09c7160bd6c3af34367e7a952fde1bbcf8eeefc52c8af5fcde388fdd5aac9
Python
2,151
64
from Bio import AlignIO ####bonobo de novo gene regions idx = AlignIO.MafIO.MafIndex("panpanY.mafindex", "mPanPan1.dip.20221111.chrY_onto_X.maf", "mPanPan1.chrY") multiple_alignment1 = idx.get_spliced( [28075448,28076422,28077214,28077861], [28075528,28076556,28077296,28078641 ], 1 ) idx = AlignIO.MafIO....