sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f3e04939b6c0721806fb36b4b65c2b47150af4f1d1acff4148852e8d78666998
Python
2,993
56
""" Tests if sum of gaussian curvatures approximates 2*pi as the gaussian curvature of a closed surface should be. """ from scanometrics.core import ScanOMetrics_project import numpy as np import matplotlib.pyplot as plt bids_database = '/home/david/Documents/DATA/test_precomputed_dataset' proc_pipeline = 'freesurfer...
f9e08247e7112d807d8c81835b6948b71b026a8e219c3bbb5f18d37838c2bc3a
Python
2,993
91
"""PufferLib vectorized environment integration for rl_games. pufferlib is optional and not a declared extra: releases up to 3.0.0 pin numpy<2.0 and gymnasium<=0.29.1, which conflict with this project's floors (the extra returns with pufferlib 4.0). Install it without its pins -- the core vectorization API works on cu...
15561b51d1a0b7ab06caf8f6cc95f9a2aa5efb5d23e10188049b72323cf7011b
Python
2,994
88
# Calculate structure searching performance import numpy as np dataset_dir = "../../dataset" with open("out.m8") as f: mmseqs_lines = [l.rstrip() for l in f.readlines()] domid_to_fam = {} fams_search = [] with open(dataset_dir + "/search_all.txt") as f: for line in f.readlines(): cols = line.rstrip(...
e1132668ce984ebbdea997a355244b45ad6f39c7298723364db193b89bb878d5
Python
2,994
86
""" What this script does: Combining subwords and generating a new vec representation file for Futrell2018 dataset Supported Arguments for model variant: * For GPT-Neo and OPT family, everything before the slash shown in the get_llm_vec.py file (i.e., EleutherAI/ and facebook/) is not needed in any step after get_l...
446bf2cb6a618fe7d3db69a16381ecd7fd0b27f8a273b5e0a16871912f682ead
Python
2,995
81
import jax import jax.numpy as jnp import numpy as np import os from hyperparameters import SimArgs from utils_training import run_epoch import utils import parameters import data def check_save_folder(sim_params: SimArgs): base_path = '../simulations' # 'check_params' # building a simulation ID based on th...
f535cff300af6c2c812931e3f65441842cb36acb7b6cc38b01096149a3301157
Python
2,995
83
"""Regression test: `uv build` artifacts must not leak research data assets. Builds both the sdist and wheel into a temporary directory (never the repo's own `dist/`, to avoid a build-inside-build trap) and asserts the installable package files are present while non-package historical research assets (root `.nii`/`.np...
b2fc50d135b68db476f6c0f90c16ce0dee392e22906b06699989eb03f2daa18e
Python
2,996
96
import math import os import sys import unittest import numpy as np sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) from treeshrink.threshold_lib import threshold_l_kernel, threshold_loglnorm KERNEL_VALUES = np.array([ 1.02, 1.05, 1.08, 1.11, 1.25, 1.32, 1.41, 1.55, 1.76, 2.05, 2.40, 2.90, ]...
cc8c949964bb91645150fee72195005463356ea3b4708e3b22564c243ceb55f2
Python
2,996
115
"""Unit test for cooridnate-gathering routine""" import os import sys import numpy as np from pathlib import Path import h5py import pyrosetta import pytest import protein_holography from protein_holography.coordinates.pyrosetta_hdf5_proteins import ( get_structural_info, pad_structural_info) from protein_hologr...
4a68d3402956eae39593d39db4d5e6dbee4fff5cee8eedba677f5d38a7c17402
Python
2,997
87
import json import random import cine import tube2 from skimage import io as skio from matplotlib import pyplot from matplotlib import patches #import scipy import numpy from sklearn import neighbors, svm, ensemble import itertools PAUSE = 1/64 def draw_object(ax, entry): row = entry[1] col = entry[2] ma...
56beb431e6cea909ccc42cda37b84d74584f2b5964b93dad2b56d4a624daff64
Python
2,997
80
from numba import njit, types from numba.typed import Dict import numpy as np, sys from Wavenet.evaluation import evaluation from configuration import config from Wavenet.training import training @njit(cache=True, fastmath=True, nogil=True) def Nagumo_3D(dic, Iapps, noise, w0, v0, y0): n_integrations = int(dic['i...
bc45efd975dae671a4c6a39424f8d00114e57a1798a622e18d71eac48884bff1
Python
2,997
75
#Run and save results of sweeps over eps, eta for 5 fields. #Date written and executed: 2022-04-26 #Runs multiple replicates at each set of parameter values # ran test run with two replicates at one set of parameter values import numpy as np from placerg.funcs import * from placerg.funcsrg import * from placerg.object...
61550784608107267123e229ba7382d965c8f3f935c22db54b06df34ffed07fd
Python
2,998
59
import sys, argparse import pandas as pd argparser = argparse.ArgumentParser(description='Does an inner merge of two space-delimited data tables.') argparser.add_argument('f1', type=str, nargs=1, help='Path to first input data table') argparser.add_argument('f2', type=str, nargs=1, help='Path to second input data tabl...
23a96c77c299c1c89d9f2c8cbf3c0217bfce5574ca78b7306c5fcfd68a2fa28d
Python
2,999
86
import sys import types import pytest import pandas as pd pytestmark = pytest.mark.single_cpu @pytest.fixture def dummy_backend(): db = types.ModuleType("pandas_dummy_backend") setattr(db, "plot", lambda *args, **kwargs: "used_dummy") return db @pytest.fixture def restore_backend(): """Restore th...
8c85c77b4785f3c9ba2cb5c3878455b12761dda730e26542b6401b4e739f1652
Python
3,000
83
''' This program will scrub an upload order file of searchable_neurons using a manifest ''' __version__ = '1.0.0' import argparse import re import sys from tqdm import tqdm import jrc_common.jrc_common as JRC #pylint: disable=logging-fstring-interpolation MANIFEST = {} def terminate_program(msg=None): ''' Term...
2c30165fc9a24311ad4174374e9ca89b77124c9c29a706da25ca895f17e7fec2
Python
3,002
67
import os import numpy as np import cv2 import argparse from multiprocessing import Pool def image_write(path_A, path_B, path_AB): im_A = cv2.imread(path_A, 1) # python2: cv2.CV_LOAD_IMAGE_COLOR; python3: cv2.IMREAD_COLOR im_B = cv2.imread(path_B, 1) # python2: cv2.CV_LOAD_IMAGE_COLOR; python3: cv2.IMREAD_COL...
2f08d0123decd1c39ff1c2c601a1a68d7f56bb71e3f2f1ea845f5d3a4cdef378
Python
3,002
113
import argparse # Performs predictions using a trained model. # Predictions are performed the same method we used and are saved to a # target directory. def get_args(): parser = argparse.ArgumentParser( description='Train UNet Model', formatter_class=argparse.ArgumentDefaultsHelpFormatter) p...
e97bbd955c8b6f294572da2b337e536c227cfd374494e9518b132070c74ff0a1
Python
3,002
81
# -*- coding: utf-8 -*- import os from keras.callbacks import * from config import ModelConfig from callbacks import SWA class BaseModel(object): def __init__(self, config: ModelConfig): self.config = config self.callbacks = [] self.model = self.build() def add_model_checkpoint(self...
03c3413192571cacef600f15bdd42e89746ed5e3a74ab43a5cb4c6a048274b6c
Python
3,003
89
# 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...
81bfaa3284f13528b45f3b5840a39cd673a1610dc492d523182787f0945bf35c
Python
3,003
84
import pytest import pandas as pd import pandas._testing as tm class TestAssign: def test_assign(self): df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}) original = df.copy() result = df.assign(C=df.B / df.A) expected = df.copy() expected["C"] = [4, 2.5, 2] tm.as...
8a6389f0d5e53152fe395e5312d29d9ddec1a17df012040353656a19c414e494
Python
3,003
64
""" Module to run FSL processing scripts. """ import os from scanometrics.utils import logging import subprocess import nibabel as nib from shutil import which def fsl_pve_vols(fsl_dir, subj_id, T1_file): """Run FSL's BET and FAST scripts on subject subj_id, and extract Partial Volume Estimates (PVEs) for CSF, G...
c1d14296d57b07adf4115cc169eea52ccb29abb70a06a8fe3ad6a1734fa6ccd2
Python
3,003
84
''' @Author: your name @Date: 2019-12-20 19:02:25 @LastEditTime: 2020-05-26 20:58:12 @LastEditors: Please set LastEditors @Description: In User Settings Edit @FilePath: /matengfei/KGCN_Keras-master/config.py ''' # -*- coding: utf-8 -*- import os RAW_DATA_DIR = os.getcwd()+'/raw_data' PROCESSED_DATA_DIR = os.getcwd()+...
03319f1ddb9e70cf8eafe7f18a6aaacf156f3cef750bad4e0e5f4406887d2159
Python
3,004
56
from pathlib import Path import subprocess import sys import os import pandas as pd recording_folder_to_process = sys.argv[1] # something like /mnt/datastore/Harry/test_recordings or /mnt/datastore/Harry/Cohort7_october2020/of N_SHUFFLES = 1000 local_scratch_path = '/exports/eddie/scratch/s1228823/recordings' ELEANOR...
6d3dc9a4574aabd3ce8edf2645fbe40384b8e0120def312207b58c854fe7bd0c
Python
3,004
72
"""Tests interpolation.""" import pytest import torch from mrpro.utils.interpolate import apply_lowres, interp, interpolate @pytest.fixture def data() -> torch.Tensor: """Create a simple 5D tensor with a linear ramp of step size 1.""" data = torch.arange(0, 20).repeat(10, 10, 1).unsqueeze(0).unsqueeze(0) ...
c4880a74af4d10d223f098bba18239ac031194b92bc163e9adb3c06f2ce006db
Python
3,008
116
import torch import numpy as np def convert_numpy2tensor(array: np.ndarray, device: torch.device) -> torch.Tensor: """ Performs conversion of Numpy array on the CPU to Torch Tensor on the GPU. :param array: A Numpy array. :param device: device to run inference on. """ return t...
312f8f7688b2c371f8df055a3c957d89294b0dbd793e3fe82594698876d53b5d
Python
3,009
80
import sys import os import numpy as np from scipy.optimize import curve_fit from helper_make_data import make_data from helper_history import history from helper_make import make def savefiles(B11, B12, B21, B22, B, H, string): np.savetxt("data_processed/Bias11_%s.txt"%string, B11) np.savetxt("data_processed/Bias12...
9186fd4c2d4493468453bc22337ac854649c40ad0c6d0074391ce3191ae83afa
Python
3,012
92
import numpy import pandas as pd import matplotlib.pyplot as plt from scipy.stats import pearsonr def updateIndexName(df, dictionary): allIndex = df.index.values for i in range(len(allIndex)): if allIndex[i] in dictionary: allIndex[i] = dictionary[allIndex[i]] df.index = allIndex re...
dde8a1d5c10ca73f5bb8deae89abeeaa0f32fe6c1348ef13a29de59ddfe3e7fe
Python
3,013
64
import argparse import os import shutil import logging import time from deepddi import DeepDDI from deepddi import preprocessing from deepddi import result_processing if __name__ == '__main__': start = time.time() parser = argparse.ArgumentParser() parser.add_argument('-o', '--output_dir', required=True,...
20f9424f8cd8b3b2627e4ee0ea829945b271b8eb44684f07d33b05694c693167
Python
3,014
98
import os import subprocess import math import shutil import numpy as np from os.path import isfile, join from PIL import Image import random import csv from datetime import datetime, timedelta path = 'phase_recognition_annotations/' video_path = 'dataset_videos/phase_recognition/' case_list = os.listdir(path) case...
eff91f3624da019f36fc053625548a844563cb15585d1c3fd178dfb953f7da03
Python
3,014
84
"""Tests for `multimodal_ad.data.synthetic`.""" from pathlib import Path import numpy as np from multimodal_ad.data.manifest import ScanManifest from multimodal_ad.data.synthetic import ( SyntheticDatasetConfig, generate_synthetic_dataset, load_synthetic_manifest, ) from multimodal_ad.data.volumes import...
0c88b3d710a352cdf01ffa7fd9a2e70b4e724ba8a0242dc202590052196d4262
Python
3,015
87
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize("by", ["A", "B", ["A", "B"]]) def test_size(df, by): grouped = df.groupby(by=by) result = grouped.size() for key, group in grouped: assert result[key] == len(group) @pytest.mark.parametriz...
10cbd845e065c4985c12060beb152950b52e2eb05c4a4da330267cd82d43a4af
Python
3,015
91
import argparse import numpy as np import random import torch import windseer.evaluation as eval import windseer.plotting as plotting import windseer.utils as utils parser = argparse.ArgumentParser( description='Evaluate the model performance on real flight data' ) parser.add_argument('config_yaml', help='Inp...
12772d1cf52debb3393b6ef7a61f06a3d952a1ecf44150987ff95b2ba824b54a
Python
3,015
102
import os import numpy as np from torch.utils.data import Dataset class P3B3(Dataset): """P3B3 Synthetic Dataset. Args: root: str Root directory of dataset where CANDLE loads P3B3 data. partition: str dataset partition to be loaded. Must be either 'train' ...
5371ef53162df455b32014d0561a2eeb08a6d0a81a53de7c38ce61ce85a6663f
Python
3,016
92
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
c9b32198e7be7d1c0a20f8448ec7ae3f2e109f87b1553a9c50f796eca29d1e78
Python
3,017
81
# 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...
713b0be8997626a378fe8541805132f0f268203868e83e847519ba6000c3e02b
Python
3,018
46
from prepare_data.create_cell_feat import * from prepare_data.create_drug_feat import * from prepare_data.create_drp_dict import * from torch.utils.data import Dataset, DataLoader from torch_geometric.data import Batch drug_response_dict, drug_name, cell_name = read_dr_dict() ge_HN_feat, ge_sim_dict, cnv_dict, mut_dic...
8c8cb9e7d62a7f5310ef218819880295525aa7c4982b792320dada1fef62a51f
Python
3,018
83
import numpy as np import timeit import os import matplotlib.pyplot as plt from glm_config import cfg # https://stackoverflow.com/a/72875625 import numba as nb @nb.njit(parallel=True) # , fastmath=True def diag_dot(a, b): res = np.zeros(a.shape[0]) for i in nb.prange(a.shape[0]): for j in range(a.shap...
28b2765ac9b14acef5d105e52932f3776bdbb525e0b4a62109bceff65a309e1c
Python
3,020
76
import pathlib import importlib.resources from PyQt6 import uic, QtWidgets import dclab from ... import session from ...util import get_valid_filename class ExportFilter(QtWidgets.QDialog): def __init__(self, parent, pipeline, file_format, *args, **kwargs): super(ExportFilter, self).__init__(parent=par...
d357ff7057e26c36202b90353d34302fc41bb3f5ea27146c02e5b69a00550b66
Python
3,020
90
# 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 ...
28754204e0ae7a1f1969727748a52dd9fb14d5668bdd1315d6f197f4b7f967e9
Python
3,024
80
import torch import torch.nn as nn from darts.api import Model from darts.modules.conv.mixed_layer import MixedLayer from darts.modules.operations.conv import ConvBlock, FactorizedReduce class Cell(Model): def __init__(self, num_nodes, multiplier, cpp, cp, c, reduction, reduction_prev): """ :par...
0247449c21a229ab3f488d86a5f612c4deaf277e5e128cd5ecc5c24c237e84ff
Python
3,025
83
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GCNConv, GATConv, GINConv, global_add_pool from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp # GCN-CNN based model class GAT_GCN(torch.nn.Module)...
e2abff9995ebd179c87e7f35a69cc6c2b134d8fc82a81494690a7e7ea233f154
Python
3,025
79
# 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...
b331f4419239d5f92227a50cec819ab39b6a01fd255e5481c2e1b064c3913f6c
Python
3,027
84
from __future__ import print_function import sys, os, re, getopt sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) import tree import pdb def smallestContainingCat ( tr, targbeg, targend, catbeg=0 ): catmid,lfind = smallestContainingCat ( tr.ch[0], targbeg, targend, cat...
a2a1023876db99baa510a6951a9ec9348b6a1d605a43e667c243259a1a9a4119
Python
3,031
78
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys sys.path.insert(0, os.path.abspath('../')) # -- Project information -------------------------...
d417f90eb90c461afac7d34dc719247be351bf032d3e410ee721fed6190c729b
Python
3,031
59
import torch import torch.nn as nn import torch.nn.functional as F from typing import Tuple, Optional LstmState = Tuple[torch.Tensor, torch.Tensor] # region Model architectures class UnidirectionalVoiceActivityDetector(nn.Module): """ A recurrent neural network that uses unidirectional LSTM cells to predict...
851dde8b536da6cb75b03023fb06bb685d3fc2ad8f63ffbaef8051082b8239ea
Python
3,033
95
"""Exponential Moving Average (EMA) dictionary.""" from collections.abc import ItemsView, KeysView, Mapping, ValuesView from typing import Any import torch class EMADict: """ Exponential Moving Average (EMA) dictionary. Maintains an EMA of values for each key. On update, existing keys are updated w...
b0763e5aff5a9d0201517e911a23769b90a2302623a0e600c0066d279c482839
Python
3,034
102
"""Parsing module for HCNN predictions""" import logging import os from typing import Dict, List import numpy as np from tensorflow.data import Dataset from tensorflow.keras import Model from protein_holography.utils.protein import ( ol_to_ind_size) L_MAX = 5 def get_energy( seq: str, energies: np.ndar...
284ad4ac6646eb989ddc0e7af65aeca8d04c95dca17a56cc236f5495f786b723
Python
3,037
110
from math import log, sqrt def minVar_outliers(L,max_out_num,min_gvf=0.2): # perform minVar bisect multiple times as long as # the lower half (i.e. L1) can still be bisect with # gvf at least the specified min_gvf; if the first # bisection has gvf < min_gvf, then return the max value L.sort() n = len(L) ...
aa4b34aecbc3f8b8d240a55e85de47fe4b17efdf360dae05bf6f10b734af1e3f
Python
3,037
124
__all__ = [ "MzCalculatorBase", "MassAnnotationProto", "MzAnnotationProto", "MassArray", "MzArray", "ChargeArray", ] import abc from typing import ( Generic, Iterable, Protocol, Sequence, Tuple, TypeVar, Union, overload, runtime_checkable, ) import numpy as ...
cf7f696d3bbd99b354e842ff5880743cde376fe9419e6f262264ec6ab485e842
Python
3,037
96
# %% from julearn import run_cross_validation, PipelineCreator from julearn.utils import configure_logging, logger, raise_error from sklearn.model_selection import RepeatedStratifiedKFold import pandas as pd import numpy as np from pathlib import Path configure_logging(level="INFO") data_dir = Path(__file__).parent...
33cf492c66bbebd11ff28f9e00eece776f765ffcd3ff39e569898efaba43b0ed
Python
3,038
72
from kcsd import csd_profile as csd #from kcsd import MoIKCSD from kcsd import ValidateKCSD, ValidateKCSD1D, ValidateKCSD2D, ValidateKCSD3D, SpectralStructure, ValidateMoIKCSD from kcsd import VisibilityMap1D, VisibilityMap2D, VisibilityMap3D # Function to initialize default parameters def initialize(value): if v...
c4f40658ad093cdc3f546eb8ba7ebefbdfa9aacc0efdcff8dfc587638fbbed75
Python
3,040
90
# Import libraries import pandas as pd import numpy as np import nltk from nltk.stem.isri import ISRIStemmer from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import train_test_split from sklearn.me...
f00ff0048ab760fbdefacdd0c4b92ba8f2c56734f614c050f11563aa96d16266
Python
3,040
95
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
6e7492f331cabcd0637aa298e2492b40bc883304d2398c0ae2ad555c00b115d6
Python
3,041
90
import logging import colorlog from msmfcode.core.config import * def addLoggingLevel(levelName, levelNum, methodName=None): """ Comprehensively adds a new logging level to the `logging` module and the currently configured logging class. `levelName` becomes an attribute of the `logging` module with...
4d4d13ce9552e4784dcb9f749b690a77a46041cddd7094215d0f1bc3891380b1
Python
3,046
86
# 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...
e08783b350dad687ef9bd8fe8c8086d3455b6cbfc812cffd8e672dcbed4bf888
Python
3,046
115
import argparse import copy import numpy as np from pathlib import Path import pickle from sklearn.linear_model import Lasso from sklearn.metrics import r2_score from sklearn.metrics import mean_absolute_error from model.data import Dataset parser = argparse.ArgumentParser(description='Predict property using Energy ...
70dd2ff801e927fb63394ac327c134cf1f66e996d9b1a70eb9ae44e9f9d2ffbe
Python
3,047
81
import glob import os import random import numpy as np import pandas as pd import torch.nn as nn import torch from src.model import common as common from src.model.ae_model import autoencoder from src.args_parser import get_parser import src.utils as utils BARON_DIR = str("./data/scPan/baron/CLASS_WISE/") MURARO_DIR ...
7bc0eaab0d715f56c8cb4bb7c4307141fab90283e97b793179d75108b6fe8e0e
Python
3,048
89
"""Tests for inversion recovery signal model.""" from collections.abc import Sequence import pytest import torch from mrpro.operators.models import InversionRecovery from mrpro.utils import RandomGenerator from tests import autodiff_test from tests.operators.models.conftest import SHAPE_VARIATIONS_SIGNAL_MODELS @py...
c2d1f96c33ac8b3b85cff77a68771d46fd17b0bbf602d640d5c4a4cc96a067e7
Python
3,048
100
1# -*- coding: utf-8 -*- """ Created on Thu Feb 11 09:20:31 2021 This file downloads text-to-speech from google servers @author: Simon Kern """ import os from google.cloud import texttospeech from scipy.io import wavfile # file needs to be present os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '../google-cloud-cred...
321fbcb3f6e8674897c8881c0b887f8eea97e93bd580e58d97bcc865561a542d
Python
3,051
89
# 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...
6ace7f69446cf72ba9e50cdcd2ca37d336a6e3e3dab9f73e23ac941c35dd45ef
Python
3,052
99
from __future__ import print_function, absolute_import, division import json import numpy as np import os from PIL import Image, ImageDraw from collections import namedtuple data_folder = 'semantic_segmentation_images_annotations/Images_and_Supervisely_Annotations/' folder = 'json' folder_masks_inst = 'mask_instrument...
ce67c20c92b3b9200009ff5e2928f69926717447f79874e0d802d178eee225d5
Python
3,053
102
#! /usr/bin/env python3 # Integrated tests of esl-shuffle miniapp # # Usage: ./esl-shuffle.itest.py <builddir> <srcdir> <tmpfile_prefix> # Example: ./esl-shuffle.itest.py .. .. tmpfoo # # SRE, Sat 07 Jul 2018 [Woodland Lodge, Titusville PA] # supersedes esl-shuffle.itest.pl # import sys import os import subprocess ...
d59fa9802d01e62a467aaf7738b7f761ab32e8d1adaa1886bddaa0c0606b75f8
Python
3,054
84
''' Created on Nov 6, 2012 @author: regger ''' import numpy as np import neuron h = neuron.h # TODO: this needs to be automated... i.e., should be such that # section, or better, segment is passed as an argument and all # ionic/axial/capacitive currents are automatically calculated # => add automatic rec...
dd6dcc9960c32efa328074f477d565180d911e5a6a7373465e73b77a2f86c2f2
Python
3,054
79
#!/usr/bin/env python import torch from torch.utils.data import DataLoader import pickle from rdkit import Chem from tqdm import tqdm import data_struct as ds from data_struct import MolData, Vocabulary from data_struct import Variable, decrease_learning_rate from model import RNN # import sys def pretrain(restore_fr...
64753774d36594d5256a3f749c0ee598d152d6cce108b1f355cd8a8a1b0aad17
Python
3,055
103
#!/usr/bin/env python3 # Copyright 2022 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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.apach...
86c1eaf51e9e5596039bfb5b20907f4c67d3e7cf0c44e073372dc0d1be84a415
Python
3,055
80
import argparse import logging def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='sam-merger.py', description="""Merge a series of SAM format files from a chunked alignment pipeline.""") parser.add_argument("-i", "--infile...
5979fbb645ded9c2038b1fe34a8460d47bc361efc894ec58f6b93bac7485296c
Python
3,056
82
"""MSE-Functional.""" from collections.abc import Sequence import torch from mrpro.operators.functionals.L2NormSquared import L2NormSquared class MSE(L2NormSquared): r"""Functional class for the mean squared error.""" def __init__( self, target: torch.Tensor | complex | None = None, ...
59ea429d5c6d4b763150a86e00e78852f632b58c41fbcbe59460ee7c21995307
Python
3,056
98
"""Test fetching data from OSF.""" import numpy as np import pytest from nimare.annotate import GCLDAModel from gradec.fetcher import ( _fetch_features, _fetch_gradients, _fetch_metamaps, _fetch_model, _fetch_neuroquery_counts, _fetch_spinsamples, ) @pytest.mark.parametrize( "dset_nm,mod...
62ecaaecbe52a465385f07f6e59025679bd5f3e69ffecc9c28f1ae6ba1568a11
Python
3,056
81
"""Load vision encoder from plain ViT models using HuggingFace.""" import logging import math import safetensors.torch import torch import torch.nn as nn logger = logging.getLogger(__name__) # to ignore imports for sphinx-autoapidoc __all__: list[str] = [] class VisionEncoder(nn.Module): """Wrapper around a g...
723204f6365bb1c4fe11ebad61c706e23e097f7467a8e1b128ebfd27d2848c44
Python
3,060
55
#!/usr/bin/env python """ Helper utilities for cleaning up intermediate BASALT files. """ import os def cleanup(assembly_list): """ Remove intermediate index/coverage files and archive key matrices. Parameters ---------- assembly_list : list List of assemblies. Currently unused but kept...
88459b460c6f311b42282e4a34e9ab3deeb70ecf8dcc82b2b8a51430af35e34f
Python
3,061
98
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, ) from pandas._libs import lib from pandas.compat._optional import import_optional_dependency from pandas.util._decorators import set_module from pandas.util._validators import check_dtype_backend from pandas.core.dtypes.inference im...
a711259da2f96e6cb31834025f609fabf6562743fe0a4d1cd7f99eb3eceda9f3
Python
3,063
89
"""Tests for `multimodal_ad.data.oasis`.""" from pathlib import Path import polars as pl import pytest from multimodal_ad.data.oasis import ( OasisLayout, OasisLayoutError, SessionIdError, load_clinical_table, load_scan_index, parse_session_id, validate_layout, ) def test_parse_session_...
a75932ad13f82ab4f036275cfb786418bb217d194caadd38397c5de35ea72ffb
Python
3,064
211
""" Fixed constants (units, atom types, etc.) """ import qcelemental as qcel au2ang = qcel.constants.conversion_factor("bohr", "angstrom") elem_to_z = { 'H' : 1, 'LI' : 3, 'Li' : 3, 'BE' : 4, 'Be' : 4, 'B' : 3, 'C' : 6, 'N' : 7, 'O' : 8, 'F' : 9, 'NA' : 11, 'Na'...
c562f99c05876b566e99755a9134620f9edef06b989a44fa0ff162291a539985
Python
3,064
87
import argparse import pandas as pd from time import perf_counter import multiprocessing as mp import os class controller: def __init__(self, namespace): self.args = namespace self.args.data_dir = self.args.script_dir + '/' + self.args.data_dir def run(self): args_str = '' for...
21b55daefa10b75e765a41bb5d2a3c4332f4430217a86e9087f050a65b9dcf1e
Python
3,065
104
# 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...
47423590d1eaa68e0d4649d80686c0321bcc069b47ba3df8e56a3dd1395077c0
Python
3,065
106
import torch.nn as nn from roost.cgcnn.model import DescriptorNetwork from roost.core import BaseModelClass from roost.segments import MeanPooling class CrystalGraphPreNet(BaseModelClass): """ Create a crystal graph convolutional neural network for predicting total material properties. This model is...
4471a24175390b6a37f20f0376063ca0dd8bbabc7c0bcf9fda40db9858d49333
Python
3,066
102
# 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...
a266b33b381e057d3be34b0856b7bf693ca1960644a3c56a6df1e4490f437a13
Python
3,066
88
"""Tests for the compact merge-proposition queue.""" from phylib.utils import connect, unconnect from phy.gui.qt import Qt from phy.gui.tests.test_widgets import _wait_until_table_ready from .._proposition_view import MergePropositionsView def test_merge_propositions_compact_projection_and_activation(qtbot): v...
389b3a82eeb6b231807bfea9f74521e57cc954f666005becb2bcc2199cdab10f
Python
3,067
86
#! /usr/bin/env python3 # rmanprocess.py # Massages output of PolyGlotMan's `rman -f latex2e` to fit Tufteian userguide style. # Example: # rman -f latex2e hmmbuild.man | rmanprocess.py > manpage.tex # import sys import re in_synopsis = False if len(sys.argv) == 1: f = sys.stdin else: f = open(sys.argv[...
e2344a0932a82315aff140bfcd8a73d2082fad22a4bbfa585cb82228063a35ca
Python
3,067
107
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.14.5 # kernelspec: # display_name: ol-connectome # language: python # name: python3 # --- # %% # %load_ext autoreload """ This cell does ...
561c56b89933b246fa932d21627100d7916284a8ed69f3e825472502d6ff1d05
Python
3,070
106
import sys import os import pysam import pybedtools from pybedtools import BedTool #print len(sys.argv) if len(sys.argv) != 6: sys.exit('Usage: python sc_atac_readcounter.py [Input Bam file] [Input Index table (NA if no table)] [Human Cell BED] [Mouse Cell BED] [Output file]') inputbam = sys.argv[1] indextable = sys...
e2bc449fbc26688e3b10ae7836e1f9fd6eda2ee9701cb2ac7f4dec8f515cc80b
Python
3,070
53
#TODO: split into multiple tests that share tmpdir and run in order import os def test_all(tmpdir, capsys): data_dir = str(tmpdir.realpath()) input_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'input_files/')) cache_dir = os.path.join(input_dir, 'fake-cache') conf = ['conf', 'data_di...
91a1bfe65b8abba7f5a7458272ce31cd067b5358025aa6dff0a4149325b6b68f
Python
3,071
110
import numpy as np import pytest from pandas.core.dtypes import dtypes from pandas.core.dtypes.common import is_extension_array_dtype import pandas as pd import pandas._testing as tm from pandas.core.arrays import ExtensionArray class DummyDtype(dtypes.ExtensionDtype): pass class DummyArray(ExtensionArray): ...
7a45382dddea218e0be55441004fcd15efd8d821f35e8603b4dbe6df2a227182
Python
3,073
65
from scipy.ndimage import * from base.diffeo import * from base.kernelFunctions import * from gaussianDiffeonsImageMatching import * def compute(createImages=True): if createImages: [x,y] = np.mgrid[0:100, 0:100]/50. x = x-1 y = y-1 I1 = filters.gaussian_filter(255*np.array(.06 -...
719db9a835460309115f3674869c0ccd50e57068abb49cf5e01212eaafb5876a
Python
3,074
89
import numpy as np import pandas as pd import datetime import time def parse_input(data: pd.DataFrame, annotation, verbose: bool=False) -> None: """Parse input data and annotation Checks that data and annotation / metadata match. Checks for duplicates. Appends _dp{n} to duplicated cell id's. ...
1f9ef90c0abc02e416aaef46db59c2b62fcdf7c455a870dfef2f43cc337c0042
Python
3,075
92
import json finalsample = [] filename0 = r"E:\experiment\mal\super\super3.json" filename1 = r"E:\experiment\mal\trash3.json" filename2 = r"E:\experiment\mal\super\super3final.json" with open(filename0, 'r') as f0: data0 = json.load(f0) with open(filename1, 'r') as f1: data1 = json.load(f1) for i in d...
3d1c309210cf4c1e052ac8bb9e2047580beadcfa9815cdcef512121179f76402
Python
3,075
98
# 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...
0a51145d306abca048d5f6774bf62c9390e0b5f088f06cc4368b563030239914
Python
3,076
99
import torch import bionetwork import numpy import time import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression import pandas def makeNetwork(curSize): parameters = bionetwork.trainingParameters(iterations=100, clipping=1) interactionsPerNode = 10 sparsity = interactionsPerNode/cu...
1b860697c64d1c3c5c8f4976d1281433d6009de5f36c9fe8391acd3fd3575076
Python
3,077
78
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__) == Version("0.61")...
d4ceacde5ff47088c09604e567520c202817730535f3104f77ad6e55858ff5fe
Python
3,077
96
from __future__ import print_function, absolute_import, division import json import numpy as np import os from PIL import Image, ImageDraw from collections import namedtuple data_folder = 'semantic_segmentation_images_annotations/Images_and_Supervisely_Annotations/' folder = 'json' folder_masks_anatomy_inst = 'mask_in...
4a35eae391ef1dfe492fc659a811fc0f6d174dda202cc14f6a9a6a9d5b85adbb
Python
3,078
76
"""Modified Look-Locker inversion recovery (MOLLI) signal model for T1 mapping.""" from collections.abc import Sequence import torch from mrpro.operators.SignalModel import SignalModel from mrpro.utils.reshape import unsqueeze_right class MOLLI(SignalModel[torch.Tensor, torch.Tensor, torch.Tensor]): r"""Signal...
20f5620b9ae9254a997e81aa6b505acca76e0ab3f0aa315fb417a3638381a721
Python
3,080
85
import os from typing import List, Optional import numpy as np import torch import logging import multiprocessing import importlib.util from .architectures import model_architecture, INPUT_SHAPE from .....image import Stack from ..... import CHECKPOINT_DIR, IQA3D_URL def get_iqa3d_checkpoint() -> str: model_dir =...
c824794b30b1d5dece81e61cd9c2384864317a63ea44f5f3e9dc95a56fae9188
Python
3,081
96
import matplotlib.pyplot as plt import numpy as np import pandas as pd import matplotlib.ticker as ticker import matplotlib.transforms as transforms import numpy as np from pathlib import Path from statistics import mean, stdev plt.rcParams['font.family'] = 'Gargi' p = Path('../../data/grouped_bars') #dataSheet = p ...
03950ae81d41e2f2c8e15fe40e2bd1ee7f8d0f3c9dd87838bd795444498807f3
Python
3,083
87
import numpy as np import pandas as pd import time import datetime from scipy import stats def anova(df: pd.DataFrame, annotation: np.ndarray, threshold: float=0.00001, verbose: bool=False): """Apply ANOVA and filter data Applies ANOVA to identify lowly / sporadically expressed genes and remove them. Value...
6d73aa43b7c10b187ba8daf23d0175772231aeccf6dcd8ba531d6a2d47a814ad
Python
3,083
105
""" Check that the test suite reaches the top-level pandas namespace through ``pd``. Objects in the top-level pandas namespace are used as ``pd.Series``, ``pd.concat`` and so on, rather than imported directly with ``from pandas import Series``. Anything else is imported from the module which defines it. This is meant...
1a2710e90f476088a28b7913b5ff7da86a4031499fb3bf8c30392b23150e2601
Python
3,084
105
import logging import argparse from datetime import datetime import time from sbrnet_core.config_loader import load_config from sbrnet_core.synthetic_data.generate_synthetic_data_v1 import make_synthetic_dataset # Get the current timestamp as a string current_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") # Def...
f22c2146084aac75aaeab33f666a0f7fdee23366e5ab3359ef649be63ba81179
Python
3,084
63
import os import re from sphinx.transforms import SphinxTransform from sphinx import addnodes from docutils import nodes class AutoIndexSectionTransform(SphinxTransform): # Priority 100 runs early during the parsing phase default_priority = 100 def apply(self, **kwargs): for section in self.docum...
24278c59ad88adad0fc5da697e471dfb04e641b8008f574e1d4871309d89b489
Python
3,087
119
# -*- coding: utf-8 -*- # @File name: model_Q10_comparation.py # @Author: Alicia Garrido-Peña # @Date: 2023-08-11 02:07:05 # @Contact: alicia.garrido@uam.es # "Copyright (c) 2023 Alicia Garrido-Peña. All Rights Reserved." # Use of this source code is govern by GPL-3.0 license that # can be found in the LICENSE file...
be85d67a4a4d615e3ac9a3fed29720a9accb370cb9d9b4c937e9c11eba5002be
Python
3,087
87
"""Contains a lazy-loaded interface to the HDF5 module. For internal use only.""" import importlib from collections.abc import Callable from types import ModuleType from typing import Any _MISSING_MODULES_EXC = ImportError( "This feature requires the 'aiohttp', 'h5py' and 'fsspec' packages. " "They can be ins...
17ea9af4a440abfb73ef867b91bb1e8abfbff6b7c0c04f532da5e114e1821542
Python
3,088
94
# MOFTransformer version 2.0.0 import argparse import textwrap from importlib import import_module from argparse import RawTextHelpFormatter from moftransformer import __version__ commands = [ # ('info' , 'moftransformer.cli.info'), ("install-griday", "moftransformer.cli.install_griday"), ("unins...
3f721924fe0bcc37f4fd8541b2951f58b4f62f1b87ee4c7cec6e7825a03f19a4
Python
3,090
85
# License: see [LICENSE, LICENSES/legged_gym/LICENSE] from legged_gym import LEGGED_GYM_ROOT_DIR import os import isaacgym from legged_gym.envs import * from legged_gym.utils import get_args, export_policy_as_jit, task_registry, Logger import numpy as np import torch import time def play(args): env_cfg, train_...