sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
d2015c6084c37c4f25840b0bf13fe9401599478322cec228c045ec47c6e5360a
Python
11,849
333
""" Similarity matrix computation for metabolites, proteins, and GO terms. This module implements three types of similarity computations as described in the paper: 1. Metabolite similarity: Tanimoto coefficient based on Morgan fingerprints 2. Protein similarity: BLAST sequence alignment with BLOSUM62 matrix 3. GO sema...
9be8a368e564b713410200694dfdb4ff18c8407963883e1e786c44230ae7483c
Python
11,853
273
import os import numpy as np import h5py import git import yaml import sys import matplotlib.pyplot as plt from scipy.stats import wilcoxon pathpath = 'PATHS/filepaths_IBLTuning.yml'# myrun = 'runIBLTuning_utypeP' dset = 'IBL' plot_examples = True n_ex = 10 tdict_type = 'equaldur'#IBL styler pthr = 0.001 #layers_a...
8d8af0f964e154c7d3dcd74e0488b63443f816a4edfb3ff3a54e310c249b3c1d
Python
11,854
343
import argparse import logging import lightning as pl import torch from rich.progress import track from mcmlnet.experiments.utils import ( load_model_configs, preprocess_datasets_for_model, save_results_to_csv, validate_model_metadata_file, ) from mcmlnet.training.data_loading.preprocessing import ( ...
7c8397d46aae553a6dd88f15e73ad2cdc93bdb0429371f69b5edf202454b9808
Python
11,858
328
import os import os.path as op import time import random import numpy as np import torch import matplotlib.pyplot as plt from torch import nn from torch.utils.data import Dataset, DataLoader, Sampler from sklearn.model_selection import StratifiedKFold from sklearn.metrics import ( accuracy_score, precision_score, r...
040f307c511b07895245b4a1aa4be1f1bd5aff370b261422c65932cd93616941
Python
11,859
278
import torch.nn as nn import torch from torch import Tensor from typing import List, Tuple, Optional, Union from functools import partial from bism.modules.unet_block import Block2D, Block3D from bism.modules.concat import ConcatConv2D, ConcatConv3D from bism.modules.upsample_layer import UpSampleLayer3D, UpSampleLaye...
d8fbb856069dea1be5a7325cf2f7e193381580fcb66d02ae0547db7260c3da94
Python
11,861
389
import textwrap from collections.abc import Sequence from pathlib import Path import pandas as pd from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save from docs.doc_modules.serve_experiments_utils import load_data_for_serve from docs.doc_modules.serving_experiments import ( AutoDoc...
a634bafca4641b5e78e6c8ae2577947c30089343b2faa6bdc29f2b624465b43d
Python
11,864
337
"""Route-matrix tests for the endpoint × protocol layer. Each case exercises an endpoint's ``prepare`` directly and asserts the resolved endpoint name, protocol, base URL, wire model name, credential source, and final client kwargs, including protocol-specific Argo routing. """ from __future__ import annotations imp...
f550f621510f30b80173aefdfef8500af147475775dc09b532ab8fd5c6342ae6
Python
11,865
316
import os import os.path as osp import torch import numpy as np import scipy import pandas as pd import argparse import os import torch_geometric.transforms as T parser = argparse.ArgumentParser(description='display graph features and summary.') #parser.add_argument('-d','--devices', help='Specify CUDA_VISIBLE_DEVICES...
2ab8cb484ba04c41ab7f7b659aa7097a9424892f716f39dbb67f866b9cbfa107
Python
11,868
308
# Kai Sandbrink # 2023-04-27 # Evaluate survey responses # %% LIBRARY IMPORT import numpy as np import pandas as pd import os import matplotlib.pyplot as plt from human_utils_project import sort_train_test from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from ...
e8250f32f228a27cdc1c88e80e9bc189389717e1f87ca1ce7e3f615f01a7fabe
Python
11,871
258
""" One of the design principles of AllenNLP is the use of a modular, declarative language (JSON) for defining experiments and models. This is implemented by giving each AllenNLP class a method .. code-block @classmethod def from_params(cls, params: Params, **extras) -> 'ClassName': ... that contains...
48d61eba43907307d9d90aed8c9e2f8acc5486a1948e0cfb762c4fe56e82e1ad
Python
11,878
291
# Copyright 2024 BDP Ecosystem Limited. All Rights Reserved. # # 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 applicab...
9bb7c4a94323f71de52de24202d3128f3d25264827e0985d94cd2350dd17876d
Python
11,878
265
import re import os import sys import numpy as np import pandas as pd import subprocess def update_autofp_script(new_pcr_file_path, autofp_script_path): if not os.path.exists(autofp_script_path): raise IOError("The file '{}' does not exist.".format(autofp_script_path)) with open(autofp_script_path...
6ac2b431bcc59929a859c76e541ba026035ae5bd50520890a3c660e7b25b58a5
Python
11,883
365
import os import logging import unittest import pandas as pd import numpy as np from pandas.testing import assert_frame_equal from numpy.testing import assert_array_equal from heig.ldmatrix import ( partition_genome, find_loc, get_sub_blocks, LDmatrix, LDmatrixBED, check_input, ) MAIN_DIR = os...
94528de8614d0d59d47bc14270d5d38583fcb1d3418443844acda34cfc45ccd2
Python
11,883
258
""" One of the design principles of AllenNLP is the use of a modular, declarative language (JSON) for defining experiments and models. This is implemented by giving each AllenNLP class a method .. code-block @classmethod def from_params(cls, params: Params, **extras) -> 'ClassName': ... that contains...
bfb3700fb14dcf9e771964259f029797074c305a2dcba5aa46aa5ca8c2d46e6b
Python
11,883
271
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from .modeling import Sam from typing import Optional, Tuple from .utils.transforms imp...
18b5f657e6563ad589ad351b32bdef14d2abef0493648d27cae615fab7118e18
Python
11,887
310
import matplotlib.pyplot as plt import matplotlib.ticker as ticker import jax.numpy as jnp import jax import os import json import sys import glob import matplotlib.colors as mcolors from matplotlib.colors import to_rgba plt.rcParams["font.sans-serif"] = ["DejaVu Sans"] # Best available plt.rcParams["font.family"]...
f4125a596a7871043c3f29217b9ff69dfc779490beec2f743d71d8ffe8c51a40
Python
11,891
286
# -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from segment_anything.modeling import Sam from typing import Opt...
7c4476719939617fcd0ef01e48edc37f54ad8e22a736d7586317a22667d17c5b
Python
11,892
198
#!/usr/bin/env python3 """ 04-tpm-transcript-representation.py ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Calculate rna-seq expression (tpm) gene isoform (transcript) representation for patients who have samples in both rna-seq and methylation datasets """ __author__ = ('Eric Wafula (wafulae@chop.edu)') __version__ = '1.0' __dat...
72ef0e8bb35cb1dc5e22ede6aadaf975f6233d214f0e32e2e6ad0e7f17582ff4
Python
11,895
340
"""Globus Transfer file-staging manager. Transfers files between a local Globus collection and a remote HPC collection using the `Globus Transfer API <https://docs.globus.org/api/transfer/>`_. This avoids encoding large input files (e.g. atomic structures) inside Globus Compute function payloads. **Prerequisites** ...
d693cb3231f6d390f210840e371f73105133444c3e6a041ac31e3d7dab8a2e5a
Python
11,895
361
import os import json from itertools import product from typing import Optional, Union, List, Tuple, Dict, Any, Generator import numpy as np import torch import pandas as pd from loguru import logger from sklearn.preprocessing import StandardScaler, RobustScaler from sklearn.model_selection import StratifiedKFold, Stra...
bd40968e7fe7fffb0fb6b7c827c86615fd5cc7e69d931e9e12799fe16dfba49e
Python
11,896
282
#Lucas Sancéré - import glob import os import shutil import numpy as np from PIL import Image as im from tqdm import tqdm ### Utils Functions # Check this function as it can just REMOVE files if not used properly # Maybe add GUI with users to understand fully want is happening def anaylser2featselect(folderpath: ...
f2d1466cf49264b1251b08ff1e16db5c15cfa04b151c71c6d226f19c325e1ba0
Python
11,896
314
# -*- coding: utf-8 -*- # cifar10_resnet18_td_vs_baseline.py import copy, random, os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader, random_split from torchvision import datasets, transforms import matplotlib.pyplot as plt # ==...
57d870a9e6f4df8ac5d5b120fed0fb1602055c3692b50029cbe4bacc7b4f6ef2
Python
11,898
492
#!/usr/bin/env python3 # # read_config.py formats Cytosim's configuration files # # FJN 13-15.11.2013 - 31.07.2014, 3.09.2015, 12.08.2018, 11.12.2019, 27.05.2021 """ Read cytosim configuration files Syntax: read_config.py FILE read_config.py - FILE Description: Reads a config file and prints...
698819016cbefafacff907ba2802231ad2a2915a895e6e2f52d665227a0ef1a1
Python
11,899
383
import argparse import os import tempfile from argparse import Namespace from collections.abc import Mapping from copy import copy from dataclasses import dataclass from pathlib import Path from typing import Any import pytest import yaml from hypothesis import given, settings, strategies from eir.setup import config...
fc45837d7122c6ce2a7f3f2f23c515992e4b232aadb919efabb72337fac88e4e
Python
11,900
373
import pandas as pd from textwrap import dedent # brian 2 from brian2 import NeuronGroup, Synapses, PoissonInput, SpikeMonitor, Network from brian2 import mV, ms, Hz # file handling from pathlib import Path # parallelization from joblib import Parallel, delayed, parallel_backend from time import time default_params...
eb6aa915edfca2cd3e06180c57c6f515077165878d5f99bdfedb48bbe7f03e85
Python
11,902
276
import numpy as np from scipy import signal from scipy.ndimage import interpolation from pipeline.utils import galvo_corrections class Position: NONCONTIGUOUS = 0 LEFT = 1 RIGHT = 2 class StitchedSlice(): """ A single slice from a stitched ROI. """ def __init__(self, slice_, x, y, dtype): ...
0354bedf7abbc8aca835f2c8f34b3727848e73453f3b211262326d0552b52b0b
Python
11,906
242
"""Contains functions, which generate example dataset, attribution, and analysis HDF5 files. These functions are mainly for documentation purposes to show the structure of the different HDF5 files that can be generated using CoRelAy for the usage in ViRelAy projects. """ import h5py import numpy def make_group_examp...
510f36ea8c8c7b70a72f8198bb979389b3d7ee0c1725048fe9e7230ed8db7d07
Python
11,908
332
#!/usr/bin/env python3 """ Split-half robustness analysis for laminar gradients. - Uses the same connectivity construction as your main pipeline. - Keeps the original number of gradients (n_components). - On each iteration: * randomly splits subjects into two halves * builds group FC for each half * runs g...
c72489e65f761009137303ae8a51157e3979eddc7fc5b74ef9c458ec8ab675be
Python
11,910
348
""" Copyright 1999 Illinois Institute of Technology 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 rights to use, copy, modify, merge, publis...
90a47fc770537b16ea382cfd32e301c1d772dc8357e5db067f9209b75587ff3b
Python
11,916
242
"""Contains functions, which generate example dataset, attribution, and analysis HDF5 files. These functions are mainly for documentation purposes to show the structure of the different HDF5 files that can be generated using CoRelAy for the usage in ViRelAy projects. """ import h5py import numpy def make_group_examp...
981842450500de27eebcb18f240de48457da7df1956a7d30a975eb5ce04d75e2
Python
11,916
300
import os import time import tqdm import itertools import numpy as np import scipy.sparse as sparse import scipy.sparse.linalg def read_eigenvectors(file): """ Takes a dataset and returns the J1J2 values that are associated for the eigenvector for each line :param file: str - file location :return...
3ee216f330da319c87ff3122b28f0a7571e4c178d64422fc187aa7477b67cbe9
Python
11,917
321
""" Center Settings Widget for Quadrant Folding This widget provides UI controls for setting the center point of images, including calibration, manual setting, chords, and perpendiculars methods. """ from PySide6.QtWidgets import ( QLabel, QPushButton, QGridLayout, QDialog, QVBoxLayout, QRadio...
840a37fc8c4d5c07d31c3366db7255515a275f1bab0ef947ba840fa326455926
Python
11,917
309
import os import time import copy import argparse import torch import torchvision from torchvision import datasets, transforms, models from torch.utils.data import DataLoader, random_split, Dataset import matplotlib.pyplot as plt import seaborn as sns from tensorboardX import SummaryWriter import numpy as np from torch...
92688dae6edd2c98114b0408ea45515231ebe039771173140efd86181badc0bc
Python
11,917
335
# The ImpedanceFitter is a package to fit impedance spectra to equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019, 2020 Julius Zimmermann, julius.zimmermann[AT]uni-rostock.de # # This program is free ...
b7ca44098889ba21d78c3046971efd0e4e7e41d3a6854233e44527c024877b44
Python
11,917
288
# Import Packages, Libraries and Files from psychopy import visual, core, event, __version__, data, gui, logging, monitors,constants from psychopy.hardware import keyboard from psychopy.hardware.emulator import launchScan import os import random import exp_utils """ The active condition consisted of two complex figure...
e775840189b51254e5d4c08663d23e103067d74a1a9c2c3913188de1d12429a0
Python
11,917
289
import pandas as pd import random import tensorflow as tf def create_fake_index_list(max_events, max_nodes): """Create indices for fake patients e.g. [[56,23,99], [34,3,98]] such that each sublist would be [start_node, end_node, timestep]. Returns: list of lists: indices for 3D matrices. """ ...
26dc94ba6aaa2c9510b5b5c932ac189313267c7460f3f76923df636d3e410202
Python
11,918
254
import logging import os import pickle import pandas as pd from dgl.data import DGLDataset, download, check_sha1 from project.utils.deepinteract_utils \ import construct_filenames_frame_txt_filenames, build_filenames_frame_error_message, process_complex_into_dict, \ zero_out_complex_features class CASPCAPRI...
50300dc6719cc0ca14c598abfeae1750682105c56779a99c3fbf87c3ffd6ddc4
Python
11,926
290
#Lucas Sancéré - import json import os import numpy as np import yaml from attrdictionary import AttrDict as attributedict from histo_miner.utils.misc import ( convert_flatten, convert_flatten_redundant, noheadercsv_to_dict, rename_with_ancestors, ) script_dir = os.path.dirname(os.path.abspath(__fil...
c2ebdf0f8141e4958681bd3dd06552b2f7e9fb0d5cd6de5b9ff05e12d65d559c
Python
11,928
267
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from typing import Any import numpy as np from .byte_tracker import STrack from .oc_sort import OCSORT, OCSortTrack from .utils import matching from .utils.gmc import GMC from .utils.reid import build_encoder, smo...
2d27ace7a1d2efbd87b835f32b7015b02ddf9170d9bfc014e7c3f43f10873f66
Python
11,929
320
"""Classes and utilities for mutliple alignments from the EPO pipeline""" import logging import os import pickle as cPickle import re from collections import namedtuple from ._epo import ( # noqa: F401 bed_union, cummulative_intervals, fastLoadChain, rem_dash, ) log = logging.getLogger(__name__) c...
ad49cb897740e24369e1b500074a0212093ecc2120fabd4412985a1222329b13
Python
11,929
361
# -*- coding: utf-8 -*- """ Most of this code was modified from code by Emmanuel Caruyer <caruyer@gmail.com>. See his original code on GitHub: https://github.com/ecaruyer/qspace/tree/master The code was reorganized, but general process is kept the same. """ import numpy as np from scipy import optimize from scilpy...
9ea85442e22416f2825ca04357d0f9d4a3380e91d8b549ec4d43a4f26c9ea56e
Python
11,931
384
# -*- coding: utf-8 -*- """Apply transformations.""" import datetime import os import shutil as sh from shutil import copyfile import nibabel as nb import numpy as np import numpy.linalg as npl from sh import gunzip from .. import execute_command from ..io.affine import apply_affine_chunked from ..io.filename import...
fb489969f23f293a90955863b755a1ee63f45936f12b77e6f42cf8f936104940
Python
11,931
296
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Module for building position mapping models based on a flatmap""" import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import progressbar from scipy.inter...
4268b482bca2b6c4e525012c31fd512fa1a8adef7bdaeacfa610d5e3149310b2
Python
11,932
387
# -*- coding: utf-8 -*- import logging from enum import Enum from dipy.core.gradients import get_bval_indices import numpy as np DEFAULT_B0_THRESHOLD = 20 class B0ExtractionStrategy(Enum): FIRST = "first" MEAN = "mean" ALL = "all" def is_normalized_bvecs(bvecs): """ Check if b-vectors are nor...
8d78f491e55286754c0faad9f70fac8e329f7073c930d7aa68962cb2aae69938
Python
11,932
292
''' Modified from https://raw.githubusercontent.com/pytorch/vision/v0.9.1/torchvision/models/mobilenetv2.py BSD 3-Clause License Copyright (c) Soumith Chintala 2016, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditi...
225e6a3634ee63e6356df13a0ad795559b7588f889693e835df6522cc9d9e332
Python
11,935
210
import multiprocessing import os from time import sleep from typing import List, Type, Union import numpy as np from batchgenerators.utilities.file_and_folder_operations import load_json, join, save_json, isfile, maybe_mkdir_p from tqdm import tqdm from nnunetv2.imageio.base_reader_writer import BaseReaderWriter from...
e4e3daadf485f9203ce7e2afb765b4364c10f764e96a7417a9a4663790b01c24
Python
11,935
382
import os import random import warnings # audio from ctypes import POINTER, cast from datetime import datetime import pandas as pd from comtypes import CLSCTX_ALL # psychopy from psychopy import core, event, gui, sound, visual from psychopy.constants import FINISHED from pycaw.pycaw import AudioUtilities, IAudioEndp...
a6b785c4644ff6249e16bf4608f0841f28d867c290df4091d302d1a16a484147
Python
11,936
345
#%% Imports from IPython.display import display import pickle from pathlib import Path import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix from config.config import settings from data.preprocessing import run_full_preprocessing from evaluation.performance import compute_operating_metric...
6194fd087714fbaa620e89430713781268b63366683b88b4bd499d26e1af1fb6
Python
11,943
330
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, Str, traits import os import glob import re import subprocess import numpy as np import nibabel as nib from cvdproc.config.paths import get_package_path HCP842_QA = get_package_path("data", "standard", "MNI152", "...
a449344b4d2e9d8072cfd09a0e3504172f2475b8ddce2cb92abbeb6548db5800
Python
11,943
307
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Agatha Schmidt, Henrik Zunker # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complian...
62a6a7f5bd210479d165bb4287567993a01ba862ec41aa1e5404412c3880311d
Python
11,950
380
""" HUMOTO dataset loader: Mixamo GLB/GLTF + YAML → normalized COCO-17 clips. Directory layout expected: humoto_/ ├── humoto_0805/ │ ├── carry_frying_pan_both_hands_walk_around-505/ │ │ ├── carry_frying_pan_both_hands_walk_around-505.glb ← used │ │ ├── carry_frying_pan_both_hands_walk_a...
879e0bde09224f63a2255ec8e59117e882b6a43b71221f4be7cdfd860f1b35aa
Python
11,950
274
# Kai Sandbrink # 26.06.2022 # Implements a bandit task with k regular arms but stochastic transitions import numpy as np import random from PeekTakeTorchTask import PeekTakeTorchTask class ObserveBetEfficacyTask(PeekTakeTorchTask): def __init__(self, **kwargs): #print("Setting bias to 0") self...
662e6ad2e780b4b82ed2139df87b85964259eaa6f4b13aaf71626315506d18f4
Python
11,953
269
import hashlib import os import warnings import tempfile from subprocess import call from pathlib import Path import numpy as np import imageio from imageio_ffmpeg import get_ffmpeg_exe from . import _perlin from .util import generate_frames, filter_frames, filter_frames_index_function, XYSCALEBASE, discretize class...
258daf8640f89401233e20c15cf869a7684228eb597d26998ccedd3a94e9dac1
Python
11,959
257
import logging import os import pickle import pandas as pd from dgl.data import DGLDataset, download, check_sha1 from project.utils.deepinteract_utils \ import construct_filenames_frame_txt_filenames, build_filenames_frame_error_message, process_complex_into_dict, \ zero_out_complex_features class DB5DGLDat...
20427d08eb48f402d7cc65de61a9f701be36f5227d0915807f753934e5c828e0
Python
11,966
292
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: GM @edit: CD #----------------------------------------- Brain AGE v2 - hold-out #----------------------------------------- Age prediction of brain images with convolutional neural networks. --- Before using this script, please be s...
e4009f0d249ff0cd3926c3168979eb15805ad8c83ec235bbc6312b4a05c9a2db
Python
11,967
252
""" Script to save fitted PLS models. """ import numpy as np import pandas as pd import scanpy as sc from joblib import Parallel, delayed, dump from numpy.random import default_rng from sklearn.utils import shuffle from itertools import chain import gc from sklearn.cross_decomposition import PLSRegression from skle...
1000f704a64efcc2c4bae9198b395093fbe1b4fff8223dafb8b631425aa95e71
Python
11,968
243
from brainvoice.data.estimates_loader_utils import load_estimate_labels, load_latent_variables_estimates from sklearn.decomposition import PCA from sklearn.metrics import adjusted_rand_score, adjusted_mutual_info_score from sklearn.cluster import KMeans import pingouin as pg import matplotlib.pyplot as plt from matplo...
262aab63d6b8066b7decff5a16458cad3afceaa4bee3933525feb65ae3b352f5
Python
11,973
365
from __future__ import annotations import math import typing import numpy as np import pytest from numpy.typing import NDArray from labelme._automation import MASK_REQUIRED_SHAPE_TYPES from labelme._automation import AiOutputFormat from labelme._automation import Detection from labelme._automation import assign_avai...
9b6f724e6d4c5f35edc0fcb8ccc085a1b58266feee25a6931c7ca8d4b783b761
Python
11,973
263
import argparse import torch import torch.utils.data from simulation.dataset import SimulationDataset from model.eghn import EGHN from utils import collector_simulation as collector, MaskMSELoss, EarlyStopping import os from torch import nn, optim import json import random import numpy as np parser = argparse.Argumen...
eadbdf0c2ffd06f07333dfddb0149615e2b9c1b9fe7233a94f4702f9981ce29a
Python
11,974
354
# tifffile/examples/write_dng.py # Copyright (c) Christoph Gohlke # SPDX-License-Identifier: BSD-3-Clause """Write Digital Negative (DNG) compatible file using tifffile. Writes a synthetic, 12-bit CFA (Bayer mosaic) array as a DNG 1.7 file. DNG-specific TIFF/EP tags are passed via TiffWriter's extratags parameter. F...
40fde3d4734e6235a137c8f6490c723900423a4a4421f0c083c4632420d1261c
Python
11,976
361
import os import logging import hail as hl import heig.input.dataset as ds from heig.wgs.relatedness import LOCOpreds from heig.wgs.utils import read_genotype_data, init_hail, get_temp_path, clean """ TODO: 1. consider providing more preprocessing options? such as --chr """ def parse_ldr_col(ldr_col): """ ...
245fca17900cdc7edbfa2c979ef5b957e9917b679e84f07c12797abe9d5256d0
Python
11,981
312
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
2c77f18c44dcedd9efeb54454163903006b307e23ee4d14bdbf31536424a7135
Python
11,981
276
import os from itertools import groupby import subprocess import numpy as np import pandas as pd from tqdm import tqdm import mne import lunapi as lp proj = lp.proj() def add_symmetric_detection(df1, df2, ch1, ch2, col_ch, col_start, col_stop, col_other): df3 = [] for i in range(len(df1)): ...
454731940f60866ae870ac7681d15b6d40dce5a289993cc8d15beed6ee0da256
Python
11,981
241
#!/usr/bin/env python3 # -*- coding: utf-8 """ Script that evaluates model based on single-cell spatial data. Created on 2021/07/16 @author romain_lopez """ import os import click import numpy as np from utils import metrics_vector, discrete_histogram import scanpy as sc import matplotlib.pyplot as plt import seabo...
2fd749f128be72bfc53626e020c6d4c20f286144e270ce26a1143a97fb68b7e1
Python
11,983
343
# This file is part of Zennit # Copyright (C) 2019-2021 Christopher J. Anders # # zennit/canonizers.py # # Zennit is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at ...
060575fd3ab116f595bed3d5623de2f685ee7304a57cb2ed71700b91a6b0c149
Python
11,984
281
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from .modeling import Sam from typing import Optional, Tuple from .utils.transforms imp...
b786ee24166dccad1530e46aa8e1825e2c15a7e309db40aa3b03ef5d5e606ffc
Python
11,988
273
# -*- coding: utf-8 -*- """ Example script to set up the parameters for the image processing pipeline """ ######################### Import modules import os, numpy, math import ClearMap.Settings as settings import ClearMap.IO as io from ClearMap.Alignment.Resampling import resampleData; from ClearMap.Alignment.Elas...
7e326faa06dbe9a7e22c3e00723dba47b99a9107f34cf4bbc4d58e1f1aad2ed2
Python
11,989
382
# -*- coding: utf-8 -*- """BOLD correction for VASO.""" import os import nibabel as nb import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline as Interp from sh import gunzip from .. import execute_command from ..io.filename import get_filename __all__ = [ "split_vaso", "boco_vaso_regr...
a2cca83fb56063e1305ae3e43bbfa1e89ce99dbc66be51d0ce959a240d72b148
Python
11,993
357
import attrs import numpy as np from attr import field from typing import Literal, get_args from typing_extensions import Self from neuralib.suite2p import Suite2PResult, get_neuron_signal, sync_s2p_rigevent from rscvp.util.cli.cli_suite2p import NeuronID, get_neuron_list from stimpyp import Session, SessionInfo, Rigl...
45d962db8f1aa4ae9b7d81dfa898de28282ea865ff6018d037f348f969bbe7b5
Python
11,994
369
""" Support for scoring alignments using arbitrary scoring matrices, arbitrary alphabets, and affine gap penalties. """ from numpy import ( float32, int32, ones, zeros, ) class ScoringScheme: # note that gap_open and gap_extend are penalties, which means you should make them positive def __in...
75473cb9427f2c6d6223377780da94aec08f8d5da4f92ca4da73e360fef28e47
Python
12,005
255
"""A module that contains unit tests for the :py:mod:`corelay.utils` module.""" import re import sys from types import LambdaType from typing import Any, Callable import numpy import numpy.testing import pytest from corelay.utils import get_fully_qualified_name, get_lambda_expression_source_code, get_object_represen...
da827206212796d035c12049dcd644e7e808f203d0f2cab87161e23ddccdcec6
Python
12,005
278
"""Test CAT-NAP against raw data it may not own: read-only, shared, or remote. Run from the repo root:: uv run python python/test_catnap_derived.py Three changes, all aimed at making a suite2p folder something the pipeline only ever *reads*, and reads once: A. **Derived files leave the raw folder.** Denoising...
ac23849884bad12053815e826043f083c06f1807bc183c4eaaad2c02ed726e6a
Python
12,006
406
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import colorsys from dataclasses import dataclass from typing import List, Tuple import cv2 import matplotlib as mpl import matplotlib.colors as mplc import numpy as np import pycocotools.mask as mask_utils def rgb_to_hex(rgb_color): """ ...
aaa0d830ffab130bbadb9d946cd8c26e07ae800dadba0f73a3d6d5b1273e9e79
Python
12,023
283
# -*- coding: utf-8 -*- """ EPI <-> EPI <-> ORIG registration The purpose of the following script is to compute the deformation field for the registration between anatomy in conformed freesurfer space and native EPI space via a registration between two EPIs and application of an already existing EPI <-> deformation. T...
9cd5f79102d88f6ba06e2dae6e6d358b2c0eb5bdbbfdfea2132ddc6c0764f440
Python
12,024
384
from __future__ import annotations import dataclasses import datetime import logging import time import uuid from typing import Any, Collection from chemgraph.agent.events import ( EventCallback, _TurnEventCallback, _call_name, _message_tool_calls, ) from chemgraph.graphs.single_agent import construct...
c0c1d0ef6a3991e3fa869aa45eef84224bafa258539ac7010785c8b48f1d6f06
Python
12,027
334
"""Data loading utilities for Monte Carlo simulations.""" import os import numpy as np import pandas as pd import torch from mcmlnet.utils.env import require_env from mcmlnet.utils.logging import setup_logging logger = setup_logging(level="info", logger_name=__name__) class SimulationDataLoader: """ Unifi...
075b8770d9541439536a75afb178b3387b11a70c1326e6f66e7851fe29276ad5
Python
12,028
289
"""LangChain ``@tool`` wrappers for OCSR: read a structure image, return a SMILES. The tool delegates to a plain function, so a human or a test can call the same logic without an agent: :func:`image_to_smiles` is a ``StructuredTool`` and is not callable directly, :func:`image_to_smiles_core` is. Same split as :mod:`ch...
a824d44d98b9076fc650ad73e6e5ae6a5c9db2c3707978969596f21c593cc374
Python
12,028
330
""" Functions used to perform MIRACLE (Motion Insensitive RApid Configuration reLaxomEtry) Author: florian.birk@tuebingen.mpg.de """ import numpy as np from numba import jit @jit(nopython=False, error_model='numpy') def fgss_T1(fid: np.ndarray, fid2: np.ndarray, tr: float, te1: float, te2: float, flip: float, t2: ...
64527c29d4bd913242e8d9f29d10705fab95c656c13d81be2dad007f445d1bcd
Python
12,030
346
import pandas as pd import torch import numpy as np import pandas as pd from glob import glob from tqdm import tqdm import os import random from torch_geometric.utils import to_undirected, remove_isolated_nodes, remove_self_loops, train_test_split_edges, negative_sampling import multiprocessing from itertools import pr...
85224bcb07b29b00ac905a06a8be8d8661f0cdab166971a7b919030c91f4eb30
Python
12,033
391
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
96829565659251cf57efaed4925a2248a4f001654a40e6d3881ce625c3c724bc
Python
12,042
337
from typing import List, Optional, Union import torch from torch import nn as nn from torch.nn import functional as F from .config import use_fused_attn from .create_conv2d import create_conv2d from .helpers import to_2tuple from .pool2d_same import create_pool2d class MultiQueryAttentionV2(nn.Module): """Multi...
e02a061bc5572c99ac1312031a58c3edb9bae865c23b2f526a24fb6bfd860096
Python
12,044
340
## #Load Modules import numpy as np from numba import njit import pdb @njit() def EPGMotion(opt, MotionScale = None, Sequence = 'DW-SSFP'): #Account for DW-SE Sequence if Sequence == 'DW-SE': opt['nTR'] = np.asarray([2], dtype='f8') #Initialise some values to prevent repeat calculations n...
50c7047182fcd616076b30b3e18d8cd1a73f7335d0d2fdf487bbc8f2f58c1c44
Python
12,046
400
import base64 import json import os from collections.abc import Sequence from functools import partial from pathlib import Path from shutil import copytree import matplotlib.pyplot as plt import numpy as np from PIL import Image from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save from...
48a1579bb2d0db82009809b2d09c02762eec234faa908eca204412e843232563
Python
12,048
345
""" Tests for deepreg/model/layer_util.py in pytest style """ from test.unit.util import is_equal_tf from typing import Tuple, Union import numpy as np import pytest import tensorflow as tf import deepreg.model.layer_util as layer_util def test_get_reference_grid(): """ Test get_reference_grid by confirming...
811f6fd954d46a8da1e7410aece5a184ce5a6550285851835c4a1322c93cf6a5
Python
12,050
367
"""inference.py.""" from functools import partial from typing import Any, Literal, TypeAlias import jax.numpy as jnp import numpy as np import numpy.typing as npt import numpyro.distributions as dist import pandas as pd from jax import Array, jit, pmap, random, vmap from jax.lax import scan from jax.tree_util import ...
095b409305e4e53890d245e833f0075c2ebfa007a7dd82c21b4d3be5fc8658ae
Python
12,058
389
#!/usr/bin/env python3 import os import re import numpy as np import pandas as pd from nctpy.utils import matrix_normalization from nctpy.energies import get_control_inputs, integrate_u import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt # =========================================================...
cce66a1607e9b2a391b97ace783321fd4cbf8587f6a3bfcafac9db95c8c8ebc0
Python
12,063
348
""" Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) @author: tstandley Adapted by cadene Creates an Xception Model as defined in: Francois Chollet Xception: Deep Learning with Depthwise Separable Convolutions https://arxiv.org/pdf/1610.02357.pdf This weights ported from the Ke...
351e9fe5b14c9d1a6c3494981940c50ba356ad577f1fc95a8c9cc68a588e954b
Python
12,064
379
"""Metrics for evaluating model performance.""" import numpy as np from scipy.linalg import eigvalsh from sklearn.metrics import confusion_matrix as sklearn_confusion_matrix from tqdm.auto import trange def alpha_correlation(alpha_1: np.ndarray, alpha_2: np.ndarray) -> np.ndarray: """Calculates the correlation b...
be308ad897d7ead625d36a28142c27ec4376b050a882b256ca99711bc09872f0
Python
12,065
366
""" LightGBM classifier for metabolite-disease association prediction. This module implements the LightGBM-based binary classifier that operates on concatenated node-disease embeddings learned from HGNN. """ import numpy as np import lightgbm as lgb from sklearn.model_selection import KFold from typing import Dict, L...
3bed00505c06566fd20552bef1075dea2a19856d7a665dc3a0d732c1af9ec8cf
Python
12,067
258
import argparse import torch import torch.utils.data from motion.dataset import MotionDataset from simulation.dataset import SimulationDataset from model.eghn import EGHN from utils import collector_simulation as collector, MaskMSELoss from tqdm import tqdm import os from torch import nn, optim import json import rand...
1ecf71b230e8088888256cd9836106b264f2950c30588865c1acc35118bb8d7b
Python
12,072
293
"""Turn a bundle back into an ordinary output folder. An express run keeps only the ``.meanap``, because every figure in it is a pure function of the data it carries and re-drawing one takes about a tenth of a second. That is the right trade for the person who ran the analysis. It is the wrong trade for the person the...
30cb3d6eff54c9fde722f4bf80e53745b631955803416539dac11a7350ebd939
Python
12,072
330
"""Hermetic gRASPA tests exercise the public tool, real preparation and parser.""" from concurrent.futures import ThreadPoolExecutor from importlib.resources import files import json from pathlib import Path import subprocess import sys from unittest.mock import Mock from ase import Atoms from ase.io import write imp...
d9c4e721eeda9cd5fdedebf13d5ffaca0dddb1ff5662fba369c637d23cea8765
Python
12,072
249
"""Generates a random dataset and random attributions for this dataset, which can then be used to generate a meta-analysis and ultimately a test project for ViRelAy. """ # pylint: disable=duplicate-code import argparse import json import os import h5py import numpy from numpy.typing import NDArray def append_sampl...
500418b08e8b5f7126f39a689b2507b3363389dcceabf8a8d7a8f47cbff1f3bb
Python
12,073
285
# -*- coding: utf-8 -*- """ Created on Tue Mar 7 14:34:59 2023 @author: gu47yiy """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 6 13:51:12 2023 @author: mgruenig """ # import libraries import tensorflow as tf from tensorflow.keras.models import Model from tensorflow....
c2f500b2b2cf7775fa9003113920afbcaf46da87c2295cb4682d5a9f04c7fb5b
Python
12,073
353
import numpy as np eps = 1e-6 def projection(va, vb): return np.dot(va, vb.T) / np.dot(vb, vb.T) * vb def get_rotation_matrix(theta, d): x, y, z = d[0], d[1], d[2] M = np.zeros((3, 3)) cos, sin = np.cos(theta), np.sin(theta) M[0][0] = cos + (1 - cos) * x * x M[0][1] = (1 - cos) * x * y - si...
7376a762904bb8c3911d0a43844109c2061680d1fad1f38e23f92121c9066624
Python
12,076
317
import sys sys.path.insert(0, '../') sys.path.insert(0, '../../') sys.path.insert(0, '../../../') sys.path.insert(0, '../../../ogb') import os import argparse import time from shutil import copy import torch import torch.nn.functional as F from torch.utils.data import DataLoader from ogb.linkproppred import PygLinkPr...
d1db421805f18ec829440de493464bdb599b754fe7836f04ea2b4905442e977b
Python
12,080
269
''' Sampling ------------------- Functions for sampling a synthetic retina. ''' import numpy from numba import jit ####################### # SCANNING FUNCTIONS # ###################### @jit(nopython=True) def performScanning(retina_params_pixels, pixel_value_array, x, y, nstdev=6.0): '''Performs the scanning...
3e804c4509f7e54b2f87448ed55541482b618d55316874e2eacb2cc50ba58aea
Python
12,086
256
import os import os.path as osp import torch import random import numpy as np import pandas as pd from torch_geometric.data import (Data, InMemoryDataset, download_url, extract_gz, extract_tar, extract_zip) from torch_geometric.data.makedirs import makedirs from torch_geometric.utils ...
ea7125497a4f09fdb58db45edea3ee9c49b7025da6f5886feda46744435ee378
Python
12,086
283
import re from scipy.io import savemat from sklearn.model_selection import StratifiedKFold from tqdm import tqdm from LocationRegressionHelper import * import time from numpy.random import default_rng import argparse import platform import numpy as np from pathlib import Path import requests print("Code is running o...
f165d976e8b3568a874d018be2171a87303da01dfbfe82f51aa42b4d5582f6da
Python
12,092
332
#!/usr/bin/env python3 -u import os import sys import json import pickle import logging from typing import Dict, Any, List, Tuple import numpy as np import torch from unicore import checkpoint_utils, distributed_utils, options from unicore import tasks from unicore.logging import progress_bar logging.basicConfig( ...