sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
db213a6e28f6be3fa096cc2f4622df369cdcb6d6f437ab0577e7b1393d4011f5
Python
1,304
42
#!/usr/bin/env python """Parse job info from sacct. The output is two lines - the header row and the job info row with the largest MaxRSS value. """ import argparse from common import fileopen, parse_profile, parse_size import csv from subprocess import check_output def main(): parser = argparse.ArgumentParser() ...
f4e3e1b2aea1533b080e970dff2b4344d880f5167564705a165e5a4642ff41c9
Python
1,304
50
import sys sys.path.append('.') import time from StimulationSystem.VtkinterProcess.VtkinterThread import VtkinterThread from CommonSystem.Config import Config from StimulationSystem.stimulationOperator import stimulationOperator from StimulationSystem.ApplicationProcess.AppController import AppController from...
452d14f321add6c9aadb47312ea72c512008f838648ff5bbad6cfe23020c5dbf
Python
1,306
37
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Created by Roberto Preste from mtoolnote.human import HumanAnnotator from mtoolnote.nonhuman import NonHumanAnnotator def annotate(input_vcf: str, output_vcf: str, species: str = "human", csv: bool = False, crossref: bool = True, predict: bool ...
c764a0513d736043e89347fef69193508690612ea6c15a669b3420f833fb5cab
Python
1,307
40
# 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...
de16b94d461919bf3cd0c47dd27cfffb8cbf6eb14e9a21a0a205e2cf390b7400
Python
1,307
47
import os import sys import numpy as np import pandas as pd import scipy.io as spio import seaborn as sns import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap data_fname = '' # BSDS model statematch results path ofname = '' # figure output file name data = spio.loadmat(data_fname) co...
9389e61dbd4a323ae4056e6e00e5ec940ee900d344214d4af01d2d23a6261566
Python
1,308
41
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestRepeat: def test_repeat(self): ser = pd.Series( np.random.default_rng(2).standard_normal(3), index=["a", "b", "c"] ) reps = ser.repeat(5) exp = pd.Series(ser.values.repeat(5), ...
e4f967f8b952cdb4d03881ce187f02005b46e5221fd193cdff165b1b86495fad
Python
1,308
26
# Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
5ab70d91bddc51db9d70ff82b3db69ea74eaca1895a86f8cc5f3f3ad428ea776
Python
1,309
36
"""Add a colab badge and pip install to notebooks.""" import sys from pathlib import Path # the filename is the name of temp file created by jupytext, not an original notebook file = Path(sys.argv[1]) # the temp filename for "iteratitive_sense_reconstruction.py" is like "iterative_sense_reconstruction-42_5f4kv.py" ba...
e5512a4e82ea9f19bd0270ffcae40bdeeecaaeea60566fc61e86100a46c5c42b
Python
1,310
39
# 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...
375d2a959de138b911043ad2b5331a4dece35d0532a0477c5c7590eebc8aaa35
Python
1,311
47
import os import sys import numpy as np import pandas as pd import scipy.io as spio import seaborn as sns import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap data_fname = '' # BSDS model statematch results path ofname = '' # figure output file name data = spio.loadmat(data_fname) cl...
658f5c9c20ae449dd50c0d70a104030dc5c46043e8f5a13d5e3daf5083e9b827
Python
1,311
40
import shutil import tempfile import time from PyQt6 import QtCore TMPDIR = tempfile.mkdtemp(prefix=time.strftime( "shapeout2_test_%H.%M_")) pytest_plugins = ["pytest-qt"] def pytest_configure(config): """This is ran before all tests""" # disable update checking QtCore.QCoreApplication.setOrganiza...
b6e60f441009faf152dc996989be10464c40a7b32970d8ff8fd35489a059accf
Python
1,311
45
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.io.pytables import ( HDFStore, read_hdf, ) pytest.importorskip("tables") class TestHDFStoreSubclass: # GH 33748 def test_supported_for_subclass_dataframe(self, temp_h5_path): data = {"a": [1, 2], "...
f98c92efd89b9bcc2763d63ea074b6801118ba5df5555b7d0103c051bc1e15ce
Python
1,311
36
#%% from pathlib import Path from src.fs_roi_lut import read_rois from src.paths import Paths import pandas as pd import nibabel as nib import numpy as np import shutil #%% set paths data_dir = Path(__file__).parent.parent.parent / 'data' paths = Paths(data_dir / "paths.json") worklist_file = data_dir / 'derivatives'...
098eb08efdc5182c69c9fb1ee8c17134617deed383c3d9a3c932fbded468494f
Python
1,313
32
import sys, argparse import pandas as pd argparser = argparse.ArgumentParser(description='Generates naturalstoriesmaze.evmeasures data table.') argparser.add_argument('f1', type=str, nargs=1, help='Path to itemmeasures data table') args, unknown = argparser.parse_known_args() def main(): data1 = pd.read_csv(sys.s...
0c6cc12c1d0db4da5af1ea6b64d0d0f454c691c7c1adbf36eec786ed32e117fe
Python
1,313
46
from collections import deque import gymnasium import numpy as np class FrameStack(gymnasium.Wrapper): def __init__(self, env, k): """Stack k last frames. Returns lazy array, which is much more memory efficient. See Also -------- baselines.common.atari_wrappers.LazyFrame...
7f4d0dd5574419d384b8b503a70da8d6f2c89e551e47eae37ae5152f987d1f09
Python
1,314
43
from pandas.core.arrays.arrow import ArrowExtensionArray from pandas.core.arrays.base import ( ExtensionArray, ExtensionOpsMixin, ExtensionScalarOpsMixin, ) from pandas.core.arrays.boolean import BooleanArray from pandas.core.arrays.categorical import Categorical from pandas.core.arrays.datetimes import Dat...
bc9b513b98f19885c062fa3f69f869b60cc8b800fc84b345b4a69042035de610
Python
1,314
41
# Copyright 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 agre...
66604231e0d8a73b91c7763c25296a838042a07ff1c21a92b77ab355604ec3a6
Python
1,315
56
#!/usr/bin/env python3 # JN 2015-06-08 """ mark all clusters in a channel as artifacts """ from __future__ import print_function, division import os import tables from combinato import TYPE_ART, TYPE_NO def make_artifact(h5fname): """ mark the artifacts """ print('Setting all classes in {} to Artifac...
728b981232f164375d535a04c3bb18edf6d3bac1ebd2c5c3e56016d1103d8405
Python
1,315
28
# 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...
81b18462f71962b82edda05e4b99a3df59a4ffda60e3e459267f6bd5094afa26
Python
1,315
42
import sys, argparse argparser = argparse.ArgumentParser(''' Outputs sentences from line-separated RT tokens and a target sentence tokenization. ''') argparser.add_argument('targ_sents_file', action='store', nargs=1, help='Target sentence tokenization file') argparser.add_argument('-w', '--word', dest='w', action='sto...
0f9da8b1900712e636c3719dcc7d39cbd583fe084b2324a07ca6882699cb640c
Python
1,316
36
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.construction import sanitize_array @pytest.mark.parametrize( "values, dtype, expected", [ ([1, 2, 3], None, np.array([1, 2, 3], dtype=np.int64)), (np.array([1, 2, 3]), None, np.array([1, 2, 3]))...
3242aebefded92e1fcedc3fea2092c2c96d2a7f3d7bc552be42a25c33b27e018
Python
1,316
38
import sys roi_mapping = { "Lang_LH_AngG": "LangLAngG", "Lang_LH_AntTemp": "LangLAntTemp", "Lang_LH_IFG": "LangLIFG", "Lang_LH_IFGorb": "LangLIFGorb", "Lang_LH_MFG": "LangLMFG", "Lang_LH_PostTemp": "LangLPostTemp", "MD_LH_antParietal": "MDlanglocLAntPar", "MD_LH_insula": "MDlanglocLInsu...
8197fd9e7d32793d50107dc51b0c1ce43d8ce2d40004d4d6de5b5c7496c3f7cd
Python
1,316
42
from datetime import datetime import sys import enum sys.path.append("..") from app import db class GenderEnum(enum.Enum): male = 1 female = 2 undefined = 3 class HandEnum(enum.Enum): left = 1 right = 2 ambidextrous = 3 undefined = 4 class RaceEnum(enum.Enum): white_non_latino = 1 ...
d50600f5d617414d697e3ff6153820374331f1374f0315324d0bf21fdd4c3610
Python
1,316
41
import numpy as np import matplotlib.pyplot as plt import argparse import os.path def read_logs(filelist): loaded_data = np.loadtxt(filelist[0]) X = np.zeros((loaded_data.shape[0], len(filelist)+1)) X[:, 0:2] = loaded_data var_names = [os.path.basename(filelist[0])] for i, file in enumerate(filelis...
3c6c9134e1adffb5bfa72ae8293bc31d1b46c17ae73281a8717ee37578181f6d
Python
1,318
34
from aigarmic.process_plate_image import find_threshold_value, split_by_grid from tests.conftest import plates_images_paths import cv2 # pylint: disable=import-error import pytest @pytest.mark.assets_required def test_find_threshold_value(plates_images_paths, growth_image): # successfully find a valid threshold ...
c6063401d528a212a55a83e914bb2bd26ecd1a739c2bdaf97d81b50080e509a9
Python
1,318
48
"""DatasourceDriver factory. Resolves a driver by ``DataSource.kind``. Drivers register themselves here so adding a new backend is a single new import + ``register()`` call. """ from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from pycaret_server.datasources.base import Data...
6810cf9ea07983061b7a6408cf4c6b10c37e30b62a2705a3ba13effec06c1126
Python
1,319
53
from datetime import datetime import pytest import pandas as pd import pandas._testing as tm class TestDatetimeIndexOps: def test_infer_freq(self, freq_sample): # GH 11018 idx = pd.date_range( "2011-01-01 09:00:00", freq=freq_sample, periods=10, unit="ns" ) result = p...
da3328f9de82fb21d0309882df36cfd513b97a65831d17e6916733d9b41dc79f
Python
1,319
53
# -*- coding: utf-8 -*- from importlib.metadata import PackageNotFoundError, version try: __version__ = version("emcee") except PackageNotFoundError: __version__ = "unknown version" # General stuff extensions = [ "sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinx.ext.napoleon", "sphinx....
93764fd2e4f9fe5183e4eb6088a5570bc2b8973e3d2d3552b677882d5fda496e
Python
1,321
35
import torch def add_edges(edge_index, new_edge_index, num_nodes): # Adjacency matrix of the original graph A = torch.zeros((num_nodes, num_nodes), dtype=torch.bool, device=edge_index.device) A[edge_index.split(1)] = True # Add the new edges to adjacency matrix A[new_edge_index.split(1)] = True ...
9ea1b5f6037db52ae649336ebcbab965bf0708dcd4203615d8c50ca9b1d3511d
Python
1,322
33
import os, sys import apnet import pickle import argparse import numpy as np from atom_model import AtomModel from pair_model import PairModel parser = argparse.ArgumentParser(description='Train single model with provided train and test set') # Mandatory arguments parser.add_argument('training_path', help='[string] P...
d98134c56ffdfd9a502859e299be672b97de5077417fa0e599c5f6408c9715aa
Python
1,322
34
#if an unannotated region neighbors two regions with the same annotation, then it should also have that annotation def check_previous_next(file_path): lines = [] with open(file_path, 'r') as file: lines = file.readlines() outputfile.write(lines[0]) for i in range(1, len(lines) - 1): #e...
dce7d60fc9a9168bb9c0325dc1fe2eb7bde188dd3da1a22d52a4727c4d8bf591
Python
1,322
37
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestValues: @pytest.mark.parametrize( "data", [ pd.period_range("2000", periods=4), pd.IntervalIndex.from_breaks([1, 2, 3, 4]), ], ) def test_values_object_extension_dty...
2c5ce6903361f151b3a3205f8e0fdf256785c46c74184c970b7c92ff87d62af9
Python
1,323
42
# 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...
9305ce4fa120b27436ec56b59ffb794f629f650d7c43476cbb5bf5653ae20482
Python
1,323
43
from setuptools import setup from setuptools import find_packages with open("README.md", "r") as f: long_description = f.read() setup( name="neuroxai", version="0.1", description="Interpretability Callbacks for Tensorflow 2.0", long_description=long_description, long_description_content_type=...
10c1557ea8f040f01a58fe646ce35f9909442fb118f1386defca2f73a79e14e9
Python
1,325
44
import sys, os, re, collections sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) import tree for line in sys.stdin: Q = [ ] f = 0 j = 0 p = '' w = '' def calccontext ( tr, s=1, d=0 ): global Q, f, j, p, w #### at preterminal node... if len(tr.ch)...
14987b19df3ae910b9ef5914792b34f843500018f4d85122a99901dade65ff3d
Python
1,325
37
from CommonSystem.MessageReceiver.EventManager import Event import time def operate_fcn(message_queue, event_manager, stop): while True: if message_queue.qsize() > 0: message = message_queue.get() if len(message) > 4: event = Event(type_=message[0:4]) ...
a3d59e94552d781859214af998bfb50c584c678952da1a69359498f0b381b4ae
Python
1,325
48
"""Removes regional indicators from a font.""" from fontTools import subset from fontTools import ttLib import functools from pathlib import Path import sys from typing import Set def codepoints(font: ttLib.TTFont) -> Set[int]: unicode_cmaps = (t.cmap.keys() for t in font['cmap'].tables if t.isUnicode()) ret...
aed43e48fb103a4b1c9ecf922640f8555c93353800207f6923a7ba4de2ddaad2
Python
1,325
48
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestPeriodRepresentation: """ Wish to match NumPy units """ @pytest.mark.parametrize( "freq, base_date", [ ("W-THU", "1970-01-01"), ("D", "1970-01-01"), ("B", "...
d8c6920407d476fba84535b03b5c6c006a990a1021e3325a2925954a19eac7ee
Python
1,326
42
txt_file = '../string/preprocessed/shk148.txt' inp = txt_file ofile = 'string_vec_partial.txt' #train import logging import os.path import sys import multiprocessing import time from gensim.corpora import WikiCorpus from gensim.models import Word2Vec from gensim.models import Phrases from gensim.models...
1d7a004ddfab56c19c0f672429e80048f74e9fb6070dd660ae4d0d6200c7b12d
Python
1,327
53
"""Screenshots for quick guide R-lme4""" import pathlib import sys from PyQt6 import QtCore from PyQt6.QtWidgets import QApplication from shapeout2.gui.main import ShapeOut2 from shapeout2.gui import compute test_data = pathlib.Path(__file__).parent / ".." / ".." / "tests" / "data" app = QApplication(sys.argv) QtC...
8e0ea864df0ce1450ef5f40ecd0bafdf3f23628bb633bb0f13186acaf309c980
Python
1,327
37
# 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...
65d0fa50166ecfbf0f64204a06ac26e6e500bd34f752ca165773d33f33a419db
Python
1,328
48
import sys import glob import pandas as pd import numpy as np import h5py file_list = sys.argv[2:] print(file_list) LABEL = 'cell.type' total_data = pd.DataFrame() for ff in file_list: data = pd.read_csv(ff, sep='\t', index_col=0) total_data = total_data.append(data) print(total_data.shape) gene_anno = ...
879fc48178357a2a8e86f17329bfce2b0c79711585b8247bdbdacdc5572b47b7
Python
1,331
37
"""End-to-end test for scripts/hyper-sweep/run_single_job.py. Downloads the real, ~1MB `paninski-lab/mirror-mouse-tiny` test-fixture dataset from HuggingFace and runs a tiny (`--debug`) training job through it, checking that the whole pipeline -- dataset download/extraction, `litpose train`, and checkpoint cleanup -- ...
fcee8ec7d93f2310f2c225e30f8e320dbc173cb6f7da338fed239ecd689d2fba
Python
1,331
41
# 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...
199efb47706d89c0e4111531d373d5525f471135908f6300ff71e457806318b5
Python
1,332
41
from msmfcode.core.config import * from msmfcode.evaluation.plot import plot_optimization_results_3d, plot_optimization_results_3d_sequential from msmfcode.models.cann import DMSMF, FMSMF import plotly.io as pio pio.renderers.default = 'browser' # Config plot_sequentially = False net = FMSMF experiment_nums = [15] ...
da9eda16bb48a1464dcb07749264891dfe63e7cee6f84ce6c459151a09592758
Python
1,332
32
import numpy as np class SelfPlayManager: def __init__(self, config, writter): self.config = config self.writter = writter self.update_score = self.config['update_score'] self.games_to_check = self.config['games_to_check'] self.check_scores = self.config.get('check_scores', ...
7d92581e8522fa609271b732fa63942e2b5ed86595eaf7f73e1de97761d182cb
Python
1,333
39
from . import dm_element class MatrixElement(dm_element.MatrixElement): def mousePressEvent(self, event): # toggle selection if not self.invalid: self.active = not self.active self.element_changed.emit() self.update_content() event.accept() def ...
9c33b5574618d1702cf4961851d0f95e7d91b9032a376e508c449095f8659403
Python
1,333
44
def main(splash=True): import importlib.resources import sys from PyQt6.QtWidgets import QApplication from PyQt6.QtCore import QEventLoop # import before creating application import pyqtgraph # noqa: F401 app = QApplication(sys.argv) if splash: from PyQt6.QtWidgets import QSp...
5b57325004c1ec6f2c74a8bbbc716d87aa33cf779d615f4c601367aff02a9ba3
Python
1,334
37
# 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 agre...
0663e5d78dab9e5fc64c1b11474bf5d3914650a6b3e039ee7ab765d63a8e4373
Python
1,336
53
""" ipython analogue: tr = TimeResolution() mi = pd.MultiIndex.from_product(tr.params[:-1] + ([str(x) for x in tr.params[-1]],)) df = pd.DataFrame(np.nan, index=mi, columns=["mean", "stdev"]) for unit in tr.params[0]: for size in tr.params[1]: for tz in tr.params[2]: tr.setup(unit, size, tz) ...
0bd03c465f7b9cdd74e914747931d6cc91f54b7fe0ffea47685dc2903d5379f6
Python
1,336
27
# # Copyright (c) 2020 Gabriel Nogueira (Talendar) # Copyright (c) 2023 Martin Kubovcik # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the...
5e5d40e9ac05c090e3f62170cba395fdcc0a6b63b95706a56f2fcccb7cae5c0e
Python
1,336
47
#! /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...
5e6b8a77abcb600328a74dad6439094ae30036f926f0699ecdd2ebe93701ce21
Python
1,336
47
import inspect import logging import os import sys class SingleLevelFilter(logging.Filter): def __init__(self, passlevel, reject): super().__init__() self.passlevel = passlevel self.reject = reject def filter(self, record): if self.reject: return record.levelno != ...
9e0d33c22fb3982924f9c2544b42712bfe2ebbffa5ac4126f1e669ce731c89c7
Python
1,336
31
# from cellPLATO.cellPLATO.initialization.config_trackmate import * from initialization.config import * from initialization.initialization import * from data_processing.cell_identifier import * from data_processing.cleaning_formatting_filtering import * from data_processing.clustering import * from data_processing.dat...
dc54657f1ed0c777ef6915b79fd74c2c7abe90826fa4bfa159dc4236fdbb1d72
Python
1,336
36
# Code taken from post by Stack Overflow user alex.forencich (https://stackoverflow.com/users/839411/alex-forencich) import sys from os.path import basename try: from StringIO import StringIO except ImportError: from io import StringIO from docutils.parsers.rst import Directive from docutils import nodes, st...
024f74e9820f70782e7752ae30779a8894f96af342b3b68cd1b9ef9a35c7b1d5
Python
1,337
43
#! /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...
19ba493728f634ce7da56ad6d744335d4a8d04784c44e00982eebf48e17850ea
Python
1,337
43
import numpy import pandas as pd def updateNames(nameList, dictionary): for i in range(len(nameList)): if nameList[i] in dictionary: nameList[i] = dictionary[nameList[i]] return nameList #%% stimName = 'LPS' control = 'PBS-BSA' metaData = pd.read_csv('filtered/metaData.tsv', sep='\t') met...
9ace921080e8351afbbfae9b6e90d78b859e80ea1c529609479b95ec653c3d8e
Python
1,337
24
import sys import re #remove F model features where antecedent is null and k is a pronoun k such as f[01]&Top?&X-xX:he_1 #he, him, his, she, her, they, them, their, its #multiple models for different subtypes of coreference? #example F model line - "F <comma-sepfeatvals> : fresponse = count #F d0&tT=1,d0&&Top&=1,acor...
6cc8600ec68e98479e944f7b6239df5b0370833592c4b5e9506d2b5e16ddb238
Python
1,339
34
from setuptools import setup, find_packages import treeshrink param = { 'name': treeshrink.PROGRAM_NAME, 'version': treeshrink.PROGRAM_VERSION, 'description': treeshrink.PROGRAM_DESCRIPTION, 'author': treeshrink.PROGRAM_AUTHOR, 'url': treeshrink.PROGRAM_WEBSITE, 'license': treeshrink.PROGRAM_LI...
37941b57e675fb9a7184df81af29e9c82107374fa716e36b75fad009877adb3e
Python
1,340
39
import pandas as pd def _format_test_results( result: pd.DataFrame, test: str, test_name: str ) -> pd.DataFrame: """Formats the results of a test into a multiindex dataframe with first level = "test" and second level = "name". The final dataframe has a column called value corresponding to the "name" ...
d9bb938d75eb3dbde030af182e00282d63b518fbc04edf67db9c9675aacd28ff
Python
1,340
41
import pytest import tempfile import yaml from sklearn.dummy import DummyRegressor from src.model_builder import ModelBuilder, ModelRepresentation from src.test_config import model_config def test_model_representation(): name = 'dummy' model = DummyRegressor(strategy='mean') paramgrid = {'C': [0.1, 1.0, 1...
66a3449dad8480d820c8992b0852154ead191e61efb49d199306431a37a087f5
Python
1,343
50
import sys import rdkit from argparse import ArgumentParser from rdkit import Chem, DataStructs from rdkit.Chem import AllChem import pandas as pd pred_mols = pd.read_csv('', header=None).values.reshape(-1) ref_path = 'actives.txt' with open(ref_path) as f: next(f) true_mols = [line....
e6c3da38c2b74ef94ef2f10a090e8737a3bff7cb3b7c33a7ff5cc63e0f8ed5ec
Python
1,343
36
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
20dfd33f9d866fa0566db78334154999e1f2f32f83cb1ca581a09f7d78ade478
Python
1,346
33
class TestIteration: def test_keys(self, datetime_series): assert datetime_series.keys() is datetime_series.index def test_iter_datetimes(self, datetime_series): for i, val in enumerate(datetime_series): assert val == datetime_series.iloc[i] def test_iter_strings(self, string_s...
4aaa03e5dd714b38fd98c6514aa545c58c3e505e459bf0df8582062684d2e663
Python
1,347
39
""" .. module:: ui_imgui :platform: Linux, Windows :synopsis: Helper functions for ImGui styling, etc. .. moduleauthor:: Fredrik Nysjo """ import imgui def set_style_color_rgb(idx, r, g, b): """Update global ImGui style color without changing alpha""" style = imgui.get_style() tmp = style.colors[...
9f006181ebd94836a6702a0235a8b9d0586a4e7beb37e749b003e2d73f4aa307
Python
1,347
38
from CommonSystem.MessageReceiver.EventManager import Event import time import json def operate_fcn(message_queue, event_manager, stop): while True: if message_queue.qsize() > 0: message = message_queue.get() if len(message) > 4: event = Event(type_=messag...
d7ee6f4a8a725e486ef673594e94a463c358eb93db98b98b4467a071faea91f7
Python
1,347
52
import numpy as np def pandas_collumn_to_numpy_array(pandas_series): new_array = [] for i in range(len(pandas_series)): element = pandas_series.iloc[i] if len(np.shape(element)) == 0: new_array.append(element) else: new_array.extend(element) return np.array...
bbc0714108e49fc7fcb10ec82e531421d3e933fe73344d026dd6758393bdc2bd
Python
1,348
49
import pytest import pandas as pd import pandas._testing as tm def test_take_validate_axis(): # GH#51022 ser = pd.Series([-1, 5, 6, 2, 4]) msg = "No axis named foo for object type Series" with pytest.raises(ValueError, match=msg): ser.take([1, 2], axis="foo") def test_take(): ser = pd....
ec080f4bc20254a20efa5b2dae7cca3cdd657d008cfa328b4f0b310c0738f307
Python
1,351
33
# Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
0502a5057382e0bb177bb793d822b9991191ff6e60f6a63291067aa23a068db1
Python
1,352
40
import numpy as np import pytest from pandas._libs.tslibs import fields import pandas._testing as tm @pytest.fixture def dtindex(): dtindex = np.arange(5, dtype=np.int64) * 10**9 * 3600 * 24 * 32 dtindex.flags.writeable = False return dtindex def test_get_date_name_field_readonly(dtindex): # https...
7b5d51e1d33bd9dcafe94557c5b03c937ae94fa525b03a417f1ad8a8e3993789
Python
1,352
43
# 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 agre...
84abf87c18eef54a6018845a93e29ff872cbfbbead49474bf2938c67000c4dff
Python
1,352
42
import pathlib from PyQt6 import QtCore, QtWidgets def get_directory( parent: QtWidgets.QWidget, identifier: str, caption: str = "Select directory", force_dialog: bool = True, ): """Retrieve the path for a given identifier When called for the first time, a directory dialog is...
016c81e52168bd984475eef078634bcc22d461a0700bc50ef72db5bda7c17e73
Python
1,353
55
# Copyright 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 agre...
3482e398843a47a1d64d28f0868816f0874078d02a66db73d1d7bbfa7fbc67f0
Python
1,353
43
import argparse import os import numpy as np import pandas as pd def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='GTDBTk-Organize.py', description="""Grab all summary files from GTDB-Tk and merge.""") parser.add_argument(...
91ca2cfd17939c081a3a11bee0c29f4f88b8d22af7a6a6beddd80405a0fe93f4
Python
1,353
46
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('README.md') as readme_file: readme = readme_file.read() requirements = [ "tensorflow", "numpy", "matplotlib", "seaborn", "jupyter", "scikit-learn==0.23.2", #"brain-score @ git+https://git...
a8747b9a1c6d75ece10d05002649b120633242953d74bfa2e73321bc3d93e470
Python
1,353
50
import torch from tnn.tensor_utils import modek_product def facewise(A, B): r""" Batch multiply frontal slices of tensors (first two dimensions) :param A: (n_1, p, n_3, ..., n_d) array :type A: torch.Tensor :param B: (p, n_2, n_3, ..., n_d) array :type B: torch.Tensor :return: (n_1, n_2, n...
cb954432e5ed48a6a43349e2ca2fd9a69ed956e3dd0fb6b084a90dbb8cf76576
Python
1,353
72
##################################################################################################################### # Date created : 10/21/2022 # Date modified: 10/21/2022 # Purpose : This program calculates the volume and area of virtual convex hull formed by all-atoms in residues ###########################...
08a0250a4d55f146a5d25811e692c66339519af55d085603a5ecd4a50bd920fa
Python
1,354
64
""" Reversed Operations not available in the stdlib operator module. Defining these instead of using lambdas allows us to reference them by name. """ from __future__ import annotations import operator from typing import Any def radd(left: Any, right: Any) -> Any: return right + left def rsub(left: Any, right:...
21636f89c07c1cf6f28aeb7e9249a7e7bdd0fbf48adb5c844ab37d0d95f60fb8
Python
1,355
47
from OperationSystem.AnalysisProcess.TestingProcess import TestingProcess from OperationSystem.AnalysisProcess.WaitAnalysisProcess import WaitAnalysisProcess class AnalysisController: def __init__(self): self.current_process = None self.algorithm = None self.actualWin = None d...
52c0f750b8dfdf87291eb5b966b3e7569b8210cb3c6be9fdda53d74491d87522
Python
1,355
44
from torch import nn import torch import torchvision """pretrained models""" class DualFC(nn.Module): def __init__( self, num_ftrs: int, num_classes: int, p: float = 0, is_dual: bool = True ) -> None: super().__init__() self.is_dual = is_dual self.fc1 = nn.Linear(num_ftrs, nu...
97b998752018130d262aa57a10c87413284f45a8158e401fcaa693f6e54cdf47
Python
1,355
32
""" @author: mkowalska """ import os import numpy as np from figure_properties import * from kCSD_with_reliability_map_2D import matrix_symmetrization from reliability_map_2D import generate_reliability_map if __name__ == '__main__': path = os.path.join(os.path.expanduser('~'), 'Dropbox', 'kCSDrev-pics') lar...
e6a3f9ebd7946c660566a35a59f3ef27518c1b4fd9a387e7af80d33f34fe1ddd
Python
1,355
42
# 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 agre...
5a81ab1eef3a54b70b10e0cd1bd997e15933836d38df7b042bc749aa3fdddb7b
Python
1,356
41
from setuptools import find_packages, setup def read(path): with open(path, 'r') as f: return f.read() setup( name='dynast-release', version='1.0.1', url='https://github.com/aristoteleo/dynast-release', author='Kyung Hoi (Joseph) Min', author_email='phoenixter96@gmail.com', descr...
772476e6b14b3c35a4460711ba46cb85657a1cc59e531e12e72518e5bd2d240d
Python
1,359
42
#! /usr/bin/python3 # -*- coding: utf-8 -*- # @FileName: config.py.py # @Author: Li Chengxin # @Time: 2023/6/30 22:12 # Global configuration variables. If you are not sure what these parameters are, please do not modify them, # except for those marked with * from __future__ import annotations from typing import Li...
86bdfc3b3e2dc57707519a70d988b9f310dc3594a48f4d4b0caa8b5b168ee191
Python
1,361
28
# Guided Grad-CAM from .grad_cam import get_grad_cam from .guided_backprop import get_guided_backprop from ..utils.process import get_last_conv_layer import numpy as np import tensorflow as tf from tensorflow.keras.layers import Conv2D, Conv3D from skimage.transform import resize # for N-dimensional images def get_gu...
896a81e9bfd1cb98ddffde0f5033da042e05d282af55e9de6aedc568df3ea047
Python
1,361
54
import numpy as np import pytest import pandas as pd @pytest.mark.parametrize( "data, expected", [ # empty (pd.DataFrame(), True), # multi-same (pd.DataFrame({"A": [1, 2], "B": [1, 2]}), True), # multi-object ( pd.DataFrame( { ...
b7be41645083679a7d5f5c9d23e2a0e09744b90dfe898999714520743b39a1bd
Python
1,361
40
# -*- coding: utf-8 -*- """ Created on Thu Dec 16 17:09:27 2021 @author: Daniel Hulsey this script is used to align a CCF to a multimodalmapping session. Points selected to align the ccf will be saved for future use. """ import os from skimage import io import uobrainflex.utils.image_utilities as im_util imp...
a80ae8294ca7e2a518b5343d5586a3eaade527d756a970457eea9de5cf01c1bc
Python
1,362
62
import pickle import tree import re import sys def readStrFromTree(f): strDic = {} for line in file(f): t = tree.Tree() t.read(line) s = re.sub(" +", " ",t.leaf()) strDic[s]=line return strDic chtb = sys.argv[1] devSent = readStrFromTree("genmodel/chgcg.same.dev.linetre...
d48f1121826343b73ae6d360ab99d02e4b5ae889f4323e5501ec9f614d182c03
Python
1,362
37
# 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 agre...
dc038ff46496536f02307044836da78000806f8d63faeae6658ebb9e3226d769
Python
1,363
38
import pandas as pd import numpy as np import os import scipy.stats as st def get_pvals(df_magma): ''' usage: convert Z stats to p-values ''' df_magma["P"] = 1-st.norm.cdf(df_magma["ZSTAT"]) # https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html # subtracting an array from 1 g...
ed7e9e1a532cdd15a79396c89bf6d902db484b9d6d1f1bd21553315d9182db9f
Python
1,363
58
from os import listdir import re def get_diff(last, new): last_map = {} new_map = {} with open(last) as f: lines = f.readlines() headers = lines[0].split('\t') last_content = lines[1].split('\t') c = 0 while (c < len(headers)): last_map[headers[c]] = last_content[c] c+=1 with open(new) as f: line...
1e3e9f2f3dadaa7c288139e76fe33916c5794aa1a8e8252956486edf396a99a7
Python
1,365
62
import numpy as np from nilearn.connectome import vec_to_sym_matrix from bct import modularity_louvain_und_sign from math import sqrt def louvain_modularity(vect): """ Wrapper for `modularity_louvain_und_sign` from the Brain Connectivity tool box. Parameters ---------- vect : np.ndarray ...
b854f2d70aa637efdedfa3196509d15c0cc4b7e8da352a7994949c411ac54f3e
Python
1,365
53
# load our stimulus set, natural images, and white noise images # useful packages: import scipy import scipy.io as sio import os from PIL import Image import numpy as np import matplotlib.pyplot as plt import cv2 import pickle # set random seed np.random.seed(42) # number of images num_imgs = 2025 img_size = (224,22...
a9fe4f1b708dae278136b072712f4f7feed8af07c7bdaa696a40644db7a3614d
Python
1,366
46
import pandas as pd class TestIsLexsorted: def test_is_lexsorted(self): levels = [[0, 1], [0, 1, 2]] index = pd.MultiIndex( levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]] ) assert index._is_lexsorted() index = pd.MultiIndex( levels=l...
0bf23fdf60d2dce8dd4649d6975a11504c5970a2f807e567961ed7092342200c
Python
1,367
51
__author__ = 'etseng@pacb.com' """ Misc APIs for reading BED format UCSC BED format: https://genome.ucsc.edu/FAQ/FAQformat#format1 SimpleBED --- chr, 0-based start, 1-based end """ class SimpleBED(object): def __init__(self, chrom, start, end, name=None): self.chr = chrom self.start = start ...
97c547a0249cc0c02266c8bdacfb60b6e902641762319095e35984e51884891c
Python
1,367
50
import json import numpy as np import random AUG_PARA = ['001001', '001101', '001201', '001301', '102001', '102101', '102201', '102301', '202001', '202101', '202201', '202301', ...
ca686d70841d6c81e18345715291deff98ea8e067dc55d829b848d73d0a3e1d8
Python
1,367
39
# 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...
8dbbf23aef96fd228cd5c1f61d649f4963c74df97a42075e714596edbf49bc97
Python
1,368
28
import models.args import os def get_args(): parser = models.args.get_args() parser.add_argument('--max-tokens', type=int, default=512, help="Maximum number of tokens to use with BERT, max 512") parser.add_argument('--lr', type=float, default=0.0001) # thesis 0.00001 parser.ad...
2865188f5a529fc2f797ff6b00e42cefddbf314a31226cdd9d2cbd366638930d
Python
1,371
36
"""Module contains statistical routines.""" from scipy import stats import numpy as np def compute_kde(data, mask, a1, a2, extents, res=100j): """Compute a 2D KDE.""" if extents is None: xx, yy = np.mgrid[np.min(data.T[a1]) : np.max(data.T[a1]) : res, np.min(data.T[a2]) : np.max(data.T[a2]) : res] ...
4d75185389e8c33ccb36a536c4b2dff85f56f4a3c2ae9eaf4c2e641026c19682
Python
1,371
53
#from pymatgen import MPRester from pymatgen.ext.matproj import MPRester from pymatgen.io.cif import CifWriter import csv import sys import os print('start') ###need 2 files: csv containing materials project IDs and atom_init.json (generic) ###get API key from materials project login dashboard online API...