sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
ad0bb729ac589b7fb3412a8adba059c2b3d87312ecb08392f312307eba9e176d
Python
13,717
443
""" Test mesh operations """ import pytest import os import numpy as np import shutil import gzip import vtk from vtk.util.vtkConstants import VTK_TRIANGLE, VTK_LINE, VTK_VERTEX from brainspace.vtk_interface import wrap_vtk from brainspace.vtk_interface.wrappers import BSPolyData from brainspace.mesh import mesh_io...
668dc02b847c7fc7ae3d8d35c4421af4dfd860b324b41b73f1b249a23e85d250
Python
13,718
292
import scanpy as sc import numpy as np import pandas as pd import os from sklearn.neighbors import kneighbors_graph import datetime from typing import Optional def formulate_HRCHYCytoCommunity_input_from_anndata_singlecell(adata,sample_id,ct_col,categories, ...
75646d37c69dce0fe31cb66334371e8470f69efa21ede145498d6301dcf22e76
Python
13,727
331
#!/usr/bin/env python # coding: utf-8 import os import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader, Dataset from torch_geometric.nn import GCNConv from tqdm import tqdm from sklearn.model_selection import StratifiedKFold from skl...
139e86a1cdd1266d7b54eda0a81d10c6c03c748d5ba809e7b982cda154c71905
Python
13,728
295
# -*- coding: utf-8 -*- # # utils.py # # Copyright 2020 Amazon.com, Inc. or its affiliates. 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/...
927c80fcc47e6ad78b6369bed1426e56eaeb6e38f5b47d156321e6e976fb0534
Python
13,728
302
#!/usr/bin/env python """ The stage GUI. Hazen 04/17 """ import os from PyQt5 import QtCore, QtGui, QtWidgets import storm_control.sc_library.parameters as params import storm_control.hal4000.halLib.halDialog as halDialog import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.hal4000.hal...
4537a542e0a2278c11f8f51f5a11f87f34058041592557e0b9fbb9ac6101ed4a
Python
13,735
338
import pickle from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image, ImageDraw, ImageFont from sklearn.calibration import calibration_curve from sklearn.metrics import confusion_matrix from config.config import settings from evaluati...
534c9cf6778d658b067ffb1858ef917603ed90f70cf46cb04f59a1ffe1b3a06a
Python
13,742
509
import os import gzip from dataclasses import dataclass from typing import List, Tuple, Optional, Dict, Any import numpy as np from scipy.io import loadmat, savemat @dataclass class TinyTrackData: streamlines: List[np.ndarray] dimension: np.ndarray voxel_size: np.ndarray metadata: Dict[str, Any] de...
8be0331aaa29af37660f81954a52bcc92dd08424656e505a87d4cbcaa405d5d6
Python
13,742
440
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import re from collections.abc import Sequence from enum import StrEnum from pathlib import Path from types import NoneType from typing import TYPE_CHECKING, Any, ClassVar, TypeAlias from attrs import frozen from ...
c1295d88ad7f9dc9651463834e06268b2cca53883bfd24922c6ff9fda7cf5743
Python
13,745
405
"""EnsembleLauncher execution backend. Wraps `EnsembleLauncher <https://github.com/argonne-lcf/ensemble_launcher>`_ to conform to the :class:`ExecutionBackend` interface. Uses the cluster-mode API (``EnsembleLauncher.start()`` + ``ClusterClient``) so that tasks can be submitted dynamically. EnsembleLauncher must be ...
92bb63188e163c9ff18b509f71cc6ffa85f5a1a31e4c4efa85da89cc2fc6a1b8
Python
13,748
310
import os from pathlib import Path from argparse import ArgumentParser import json import numpy as np from tqdm.auto import tqdm from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_core...
ca80f8bc0fcabfa1403175f76a2541f56a74727f0fd2c0666816943b2b8cd09f
Python
13,748
310
import argparse import torch import torch.utils.data from motion.dataset import MotionDataset from n_body_system.model import GNN, Baseline, Linear, EGNN_vel, Linear_dynamics, RF_vel, GMN import os from torch import nn, optim import json import random import numpy as np parser = argparse.ArgumentParser(description='G...
316932c6e0865c50d7178ea38bd5785ca2856c4d60dcfcc7bd035d1566cbd08a
Python
13,751
467
# Copyright (c) DP Technology. # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib import importlib import logging import os import sys from copy import deepcopy from functools...
6af070478dc49668fed8bee2596d553cbe69d47a0b786566d0c30666525e74d1
Python
13,757
404
# train.py import pandas as pd import warnings import numpy as np import scipy.sparse as sp import torch import torch.nn as nn import torch.nn.functional as F import dgl import dgl.nn as dglnn import h5py import random import os import matplotlib.pyplot as plt from sklearn.manifold import TSNE from utils import ( ...
a3a31442ded4b3472764b1fc56a2737223aca3da386ef70c49486276d3214607
Python
13,760
357
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 5 18:31:24 2017 @author: ajaver """ import numpy as np import pandas as pd import tables import warnings from scipy.interpolate import interp1d from tierpsy.features.tierpsy_features import SmoothedWorm from tierpsy.features.tierpsy_features.food ...
730842549aafba05baa6d6ce9485bce64832952686f5ef9a84f3c3b81c86860e
Python
13,763
363
# Copyright (C) 2025 Paolo Vincenzo Fioretti, Michela Roccuzzo, Enrico Saccon, # Maria Pennuto, Manuela Basso # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or...
bbcd729e9f60d3bc8663ce9fb07d6f15bb9d2720ad7da68b5f5a39f78bebb691
Python
13,774
388
import numpy as np from nems.distributions import Normal class Parameter: """Stores and manages updates to values for one parameter of one Layer.""" def __init__(self, name, shape=(), prior=None, bounds=None, default_bounds='infinite', zero_to_epsilon=False, initial_value='...
97899393443e7b6fa5757c3cb3003424b6b5e2f58bd606025beb3102bb4a3077
Python
13,780
383
from pathlib import Path import pandas as pd from tqdm import tqdm from transformers import RobertaTokenizer, RobertaModel import torch import numpy as np import os from torch_geometric.data import Data, HeteroData def get_data_dir(server_id): if server_id == "206": return Path("/new_temp/fsb/Twibot22-base...
685943b32791871feb3fd75876b5895656242f32206a81f5b662620cb66744c6
Python
13,781
361
import os import argparse import sys from pathlib import Path import numpy as np import pyvista as pv from PIL import Image REPO_ROOT = Path(__file__).resolve().parents[4] if str(REPO_ROOT) not in sys.path: sys.path.insert(0, str(REPO_ROOT)) from cvdproc.utils.python.visualization.surface_plotting_utils import (...
246ee9b59bf640b91aff9d43cabc49306048485c2c5cfdfa5128c7741b4b739e
Python
13,782
240
""" (C) Copyright 2019 IBM Corp. 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 agreed to in writing, software ...
b6bf553d14f77a352b833612aa07a598a82044cf0bf48f3777dfc985f77b03d6
Python
13,783
383
import numpy as np from physical_objects import Isolated, Stick, Hinge, Complex from tqdm import tqdm import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import warnings warnings.filterwarnings("ignore") class System: def __init__(self, n_isolated, n_stick, n_hinge, n_complex=0, complex_sizes=...
3a5ec1e8939f58e1ccda5c6a79f579fc34207d8db806e3d8ea365d92c42b931f
Python
13,785
312
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import contextlib from functools import partial from pathlib import Path import numpy as np import torch from ultralytics.nn.modules import Detect, Pose, Pose26 from ultralytics.utils import ARM64, AUTOINSTALL, LI...
a237f5e723dcac72a5cf7d940f5344777ea2b1fc33f545d73c1982ee9bd0e452
Python
13,786
440
import celldetection as cd import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import tqdm from torch.cuda.amp import GradScaler, autocast from . import names def compute_precision(true_positives, false_positives): tp = true_positives fp = false_positives try: re...
f0e92eff20b8dbfb4b8eedc574d26154c6df3da7f11a4ef3330d560b395875bf
Python
13,786
281
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import sys import matplotlib.pyplot as plt import matplotlib matplotlib.u...
660d1b97ea52cbafc8aa34f4a6a9013e98e425233a0f2b97d182aff56311a4d0
Python
13,789
389
import os from pathlib import Path import pickle import numpy as np import nibabel as nib from scipy import ndimage import psutil from joblib import Parallel, delayed from scipy.ndimage.morphology import binary_dilation, binary_erosion, binary_closing from sklearn.metrics import confusion_matrix def keep_largest_bl...
cd0b9bdd8cfdbb52e844b848c74e32a373c427ca280f1dcfb12150fc99296f72
Python
13,799
417
from collections.abc import Callable, Sequence from dataclasses import dataclass from difflib import get_close_matches from typing import ( TYPE_CHECKING, Any, Literal, ) import torch from torch import nn from torch.utils.data._utils.collate import default_collate from eir.data_load.data_preparation_modul...
590ed459e04515cc4e048f542333c09291bdf3fb0608e2206d231c1d64a1f103
Python
13,802
324
import sys import importlib import argparse import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.utils.data import DataLoader, Dataset import pyro from pyro.infer.autoguide import AutoDiagonalNormal, AutoNormal from tqdm import tqdm import numpy as np import pandas a...
99bc22a15aa43332ccb94f274420d1b59d77ca4a741cdfc4633c7e5049e05957
Python
13,802
360
""" 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...
e52c6a7680b4bbb84288a620d468c266ffe13bf7a37f290757bfd95ca9e1f995
Python
13,802
363
import math import torch import torch.nn as nn import torch.distributions as D import torch.nn.functional as F # Define two globals bce_fn = nn.BCELoss(reduction='none') mse_fn = nn.MSELoss(reduction='none') Tensor = torch.cuda.FloatTensor def add_coords(x, just_coords=False): ''' This just the Uber CoordCo...
971f3a856a146ed1cbdb86cb8de282540865d9d2e27c8c5b988225ef23dc7e7e
Python
13,804
323
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Manuel Heger, 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 compliance...
8ec980e1cd686452c6ebfd7a78fe429b609df68d8ba9c0e5d8e30861a99e9303
Python
13,805
403
""" Skill inference task. The current version is updated version from the (semi-)final version. Point of update is 'joystick position tracking' for the observer. Previously, the observer agent vanished and could not track. However, it would be nice to see whether physical imitation helps ...
4deeb0af52c8fbaf3edda4a7569728d7c898b4e796ff42658870a1842da04a6d
Python
13,809
277
import numpy as np def concatenate_all_trial_type_within_region(data, cell_index, start_time, end_time, fs_image): """ concatenate the neural activity of active cells across trials Parameter: - data: list of ndarray List of neural activity arrays for each trial type. Each array...
5fb6f4ded62a35fbeaee2689491a03da966c5ae2bd7ff7d81cef04b22c2ed9c7
Python
13,810
277
import numpy as np def concatenate_all_trial_type_within_region(data, cell_index, start_time, end_time, fs_image): """ concatenate the neural activity of active cells across trials Parameter: - data: list of ndarray List of neural activity arrays for each trial type. Each array...
eb0e62ca7eacfbf3a290a54897d09a4f75143afc8a2da4cec1cee8a4c1894f88
Python
13,812
279
from typing import Optional, List, Dict, Union, Callable import tensorflow as tf from tensorflow.keras.layers import Activation import numpy as np from .generic import TransformerLayer, MeshLayer, CompoundTransformerLayer, PermutationLayer from ..meshmodel import RectangularMeshModel, TriangularMeshModel, PermutingRe...
3fedcc19115014b133f06f25159955ebfb7f092a343f4e5ba88d3fab7d0ef513
Python
13,815
385
from __future__ import annotations import ast import io import os import re from ast import literal_eval import pandas as pd import requests import streamlit as st import tabulate import unicodedata def create_article_handle(row): author_snippet = row['author'].replace(",", "").split(" ") if len(author_snip...
93229b4b841373d3817eaa4f286e8aecaeab6cc4ecbe7a261ee15fdcaf7e976e
Python
13,816
357
import argparse import networkx as nx import matplotlib.pyplot as plt import random import numpy as np import math from scipy import stats ''' first version: unweighted, undirected network use edge random walk to generate edge transction matrix based on EM algorithm ''' def parse_args(): ''' Parses the node...
1b3671c43d02bb898c9b30e91b8c66fe41bc232d1eb9a6c58eb29669601f0df0
Python
13,819
317
"""Precursor candidate retrieval. Every test here corresponds to a measured defect in the 3-decimal exact-bucket filter that shipped up to 1.1.1, or to a property of the ppm window that replaced it. These need only numpy/pandas/rdkit -- no torch, no models, no 520k-row reference database -- so they run in seconds and ...
54ba71cb03624f479987cdfda402e474686a5690873b770062504f48ca82dd80
Python
13,822
295
""" PyVISAScope provides an interface to different scopes. Copyright (C) 2016 Ye-Sheng Kuo <yesheng.kuo@gmail.com> Copyright (C) 2019 Julius Zimmermann <julius.zimmermann@uni-rostock.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public...
90522a76302437f8585a51c3606daeeb6622a0e7c236fcf933e3901c0ef408e1
Python
13,828
284
#!/usr/bin/env python # author: Jannes Spangenberg # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import sys import matplotlib.pyplot as plt import matplotlib matplotlib.use('Agg') from os.path import splitext, j...
8e52273591f467ce3c3f34a8848cd8b821412ae2c155be3929351f5c06c27f94
Python
13,833
337
import pandas as pd import numpy as np import sklearn.model_selection import matplotlib.pyplot as plt from sklearn.manifold import TSNE from sklearn.metrics import f1_score import h5py import pyarrow as pa import pyarrow.parquet as pq from xarray import DataArray import math from pandas_plink import read_plink1_bin, wr...
a51a4716ac379ebe3bdeb87c9dbdeaef13c9c00d815aa3a17175a824f02a5f7b
Python
13,833
397
import os # --------------------------------------------------------------------- # IMPORTANT: Set env vars BEFORE importing fury/vtk. # This increases the chance that offscreen rendering works in subprocs. # --------------------------------------------------------------------- os.environ.setdefault("LIBGL_ALWAYS_SOFT...
48a9ac7be54d1ec9124df52c079f8101b46f9c0602c081e41aa7bc002c3abee9
Python
13,840
399
"""MagicSignature objects are an extension to inspect.Signature objects. The basic idea is that there is a tight connection between an individual Parameter in a function signature and an individual magicgui.Widget, and a connection between a full function Signature (a collection of parameters) and a magicgui.Container...
50bf75952aa223ee4f7f0c7205b71c444b69bbbcf6c08038d7149891ac05fce6
Python
13,841
357
"""Read the recording list spreadsheet, mirroring ``pipelineReadCSV.m``.""" from __future__ import annotations import re from dataclasses import dataclass from pathlib import Path import numpy as np import pandas as pd #: The columns ``read_recording_csv`` expects, in order. Only the position #: matters to the rea...
e2e7ec0ce54bf36d5903cb2c74b88b24434c7b4ed912cb899b4809112fec0aaa
Python
13,844
537
# -*- coding: utf-8 -*- # python standard library inputs import os import sys from pathlib import Path # external inputs import numpy as np import nibabel as nb from nibabel.freesurfer.mghformat import MGHHeader from nibabel.freesurfer.io import write_geometry, read_geometry, read_label, \ read_morph_data, write_...
844c624b1d002d0e1443a05fecc7f6afb9f9a9597786941c6faecefcca6fb16e
Python
13,846
308
import torch import torch.nn.functional as F import numpy as np from torch import nn from .utils import gaussian_kernel, circular_kernel, gabor_kernel device = torch.device("cuda" if torch.cuda.is_available() else "cpu") EPSILON = 1e-4 class Identity(nn.Module): def forward(self, x: torch.Tensor, *a...
4832614744f9f80516897e2347d0950f6018203b9cd79b9f486a1257c81257ba
Python
13,849
303
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import copy import torch from torch import nn from .blocks import RoPEAttention class MemoryAttentionLayer(nn.Module): """Implements a memory attention layer with self-attention and cross-attention mechanism...
fd0ae75b2fbc567b6db852bd2445fae42722745c648bef1263edc473677f3425
Python
13,851
440
import argparse import math import random import sys import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from torchvision import transforms from compressai.datasets import ImageFolder from compressai.zoo import models from pytorch_msssim import ms_ssim...
566d5347caa453b8b745eb847eb972a6467a96ffcc5c13bd9c892a4d85f92ec1
Python
13,852
236
from __future__ import print_function import numpy as np import pandas as pd import argparse import sys import itertools def get_segment_range(bin_start, bin_end): return range(int(bin_start), int(bin_end)+1) def get_1D_peak(segment_range, MACS2_peak_ranges_list): for segment in segment_range: if segm...
159788206f5a5e2704c8426963b6c392e04a519a3a67b233d3ff8c6d630d0a9b
Python
13,854
385
import os from time import time import torch from torch import nn from .protein_constants import * from .rigid_utils import Rigid, Rotation, calc_rot_tsl def calc_angls_prot(coords, seq, psi_angle_atoms=psi_angle_atoms, chi_angles_atoms=chi_angles_atoms): """ note: the first three pos in dim2 is invalid """ ...
8bbdc16ed8182013bb15a1b2d797c0650249759eaefe062689e28bdc03f54b49
Python
13,856
391
""" Adapted from: https://github.com/runopti/stg Original authors: Yutaro Yamada https://github.com/runopti License: MIT Summary: This module implements the Stochastic Gates (STG) regression framework for feature selection in neural networks. The code was adapted from the Run Opti 'stg' repository, with mod...
22f4ef4012ae0b12a0260155643acf69a08ca0ef1a19101ddd0ed8901fa3bec4
Python
13,859
318
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from typing import Any import numpy as np import torch import torch.nn.functional as F from ultralytics.models.yolo.detect import DetectionValidator from ultralytics.utils import LOGGER, o...
b130ecc32f763121e1ffb510629071c3b14f44ab0c3248122ce0dc80ff8354df
Python
13,862
327
""" Implementation of Song et al (2020) Blind Source Separation with robust Principal Component Analysis for Myelin Water Imaging from T2* Multi-Echo Gradient-Recalled Echo Data. Written by Vladimir Grouza 2022 Quantitative Microstructure Imaging Lab McConnell Brain Imaging Centre, Montreal Neurological Institute an...
691f71956d80ca38ee558dc20b89e01acc879dc80a91bae8195e3fb6c77db45c
Python
13,863
413
"""Ring-like AnalogSignal/PositionArray subsample, simplify, interpolation, smoothing, asarray, downsample, ... all have to be handled in a special way when we have a ring-like environment. """ import copy import numpy as np from scipy import interpolate from collections import namedtuple from ..core import _analogs...
f452d85f1c20da5a9f70624791f0004313d71d584d1881f6ac68929a12eeb35f
Python
13,863
234
import pygame import time import re import numpy as np ############### # mri ############### def mri_scanning(screen_width, screen_height, window, stimuli_width, stimuli_height, give_a_fixed_time_interval, entry, application_path, time_sleep, making_a_session, from_xy_to_position, from_position_to_xy...
38d6090ae6f09f05f02c9a62400a37c8e42fff8d3f811f4c4fb3898f0674bd0a
Python
13,864
372
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: 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 compliance with the Lice...
f10549bf98ff112f1f7c179aab1ad2f60029da6e1bb1027c7f7f04c32d05318e
Python
13,864
341
"""Test CAT-NAP's node-cartography barrier and its use of the shared 4A figures. Run from the repo root:: uv run python python/test_catnap_cartography.py Two things are checked here. **The barrier.** Node-cartography roles depend on five boundaries in the participation-coefficient / within-module-z-score plane....
640c40e039ddf58d7c72875f3cab241cd145509f6c5da44ddb3d1e26a51e51ec
Python
13,865
426
"""This module is adapted from https://github.com/Open-Catalyst-Project/ocp/tree/master/ocpmodels/models """ import torch import torch.nn as nn from torch_scatter import scatter from torch_geometric.nn.acts import swish from torch_geometric.nn.inits import glorot_orthogonal from torch_geometric.nn.models.dimenet impor...
a05acb0cd3f984a7f71d65ac16c8dc6a6c79bcb20493c2672e3b86a63ac52dd7
Python
13,867
349
r"""This class defines the abstraction for a backend-agnostic graph store. The goal of the graph store is to abstract away all graph edge index memory management so that varying implementations can allow for independent scale-out. This particular graph store abstraction makes a few key assumptions: * The edge indices ...
6b9c216425e2959f1813259d97504c36961f0c578c8180a19ff4ab75d2aa75da
Python
13,869
408
#!/usr/bin/env python3 # Copyright 2019 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.apac...
66d3c5f8fec4cfaeefe99081a6a87196cf07ce1249b2c109f98ec0c9ff477dff
Python
13,871
243
#!/usr/bin/env python3 """Validate public-release metadata, licenses and the exact output allowlist.""" from __future__ import annotations import json import fnmatch import hashlib import re from pathlib import Path import tomli import yaml HERE = Path(__file__).resolve() ROOT = HERE.parents[1] if HERE.parent.name...
964a864df3ca542cf8136e60da084e90de493e494e1104b0757527dc3b48fcd0
Python
13,872
403
import os import time import shutil import numpy as np import pandas as pd from tqdm import tqdm from scipy.stats import chi2 import heig.input.dataset as ds from heig.wgs.gwas import DoGWAS from heig.wgs.null import fit_null_model from heig.wgs.relatedness import LOCOpreds from heig.wgs.utils import read_genotype_data...
d5bad7200eabba5c29894916f9cc5fee49e834ab47239d9e80d08a33c43b5ab3
Python
13,881
403
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import OneHotEncoder from scipy.stats import mannwhitneyu import torch.nn.functional as F import torch from .ism import SeqMatrix, MutGenerator from . import plot_utils from . import data_utils class Motif(...
0c1d2314c54cc7f322035ac442009b4bcbb75127933020a6e86e33f46c3ce458
Python
13,885
417
# These functions were adapted from `deepreg/model/kernel.py` in the 'DeepReg' repository # on GitHub. The original implementation can be found at: # https://github.com/flavell-lab/DeepReg/deepreg/loss # The code is used under the MIT License. from typing import Tuple import numpy as np import tensorflow as tf import b...
06cd6227f8c1e8fc6640803bbf3dc7b8f08311e4392f97d4f6153886ec45e8b9
Python
13,886
283
#!/usr/bin/python #----------------------------------------------------------------------- # File : patred.py # Contents: pattern set reduction functions # Author : Christian Borgelt # History : 2013.01.11 file created from dectred.py # 2013.01.12 flag setting simplified, redfn0 added # 2013.01....
041668950e1836835424b3886ce26a7f6ca727811bc8b7d92433939c95171673
Python
13,893
286
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import json from typing import Any import cv2 import numpy as np from ultralytics.solutions.solutions import BaseSolution, SolutionAnnotator, SolutionResults from ultralytics.utils import LOGGER from ultralytics.u...
bd090a7aaf2c6d8009edbc5941b6ab96bf4962dfdc568e9da6a839543b3bff38
Python
13,895
357
import torch import math import numpy as np import PIL import PIL.Image import os import json import h5py import time from glob import glob from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import scipy.constants as sc import scipy.ndimage as snd import scipy.interp...
29201fb3ef72dc0754b02c5bde9f69ea6a6f9a5d079779d1ae56ac0e126ac677
Python
13,898
419
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 ...
f8da7846ac024479d34ba8624f0afa832e50f651e1191d336b4ed38796b911ee
Python
13,898
287
import numpy as np from sklearn.base import BaseEstimator, MetaEstimatorMixin, clone from sklearn.utils.multiclass import type_of_target from sklearn.linear_model import LassoCV, LogisticRegressionCV from ..utils.general_tools import column_name_type_safe_join # Find internal implementations try: # Version 0.20 - 0.21...
8b1caf086bf4d6639f2b2e22903e1a644a1fce48349934b7f3fac5e7169b94de
Python
13,902
312
import argparse import torch import torch.utils.data from md17.dataset import MD17Dataset from n_body_system.model import GNN, Baseline, Linear, EGNN_vel, Linear_dynamics, RF_vel, GMN import os from torch import nn, optim import json import random import numpy as np parser = argparse.ArgumentParser(description='Graph...
960c5e618c43630d4ee12a1a4d7ceed63de0fe424a7a848bef15263f20b97c1b
Python
13,911
331
############################################################################# # 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...
97848e912ac4e494c79ef552a643feb5b9781edb18d81173dc97bb2ed47e62e1
Python
13,912
489
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from abc import ABC, abstractmethod import json import inspect import tempfile import fnmatch import multiprocessing.pool as mpp import datetime import sys from itertools import repeat from glob import glob import warnings import pandas as pd import numpy as np...
a568d1683013cc68e7d0a31ddf9bc72449caeca861fe8fe78d7e54b5040c082c
Python
13,913
312
from typing import Optional, Union import numpy as np from scipy.spatial import Delaunay from scipy.spatial.distance import pdist from scipy.sparse import csr_matrix from scipy.sparse.csgraph import connected_components from matplotlib import pyplot as plt from matplotlib.collections import LineCollection,PolyCollectio...
281804c28b3bb706daff503f12da25bc69f41814fc37554fd6f1440b61f63ac4
Python
13,914
359
""" 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...
a9c2c546b6e160954333464ff6465fb5e04aed3578189ec60066e963d15b1ecd
Python
13,919
364
#!/usr/bin/env python3 # general imports import numpy as np import sys import matplotlib.pyplot as plt from tqdm import tqdm import time # torch imports import torch import torch.nn as nn # PyTorch TensorBoard support from torch.utils.tensorboard import SummaryWriter from datetime import datetime # utils imports fr...
0a7e0364bf86d8b49c915eb3ebd39708e4374bde7b28507930519b338557291a
Python
13,922
457
# 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, ...
4c3d974ce64d9c0e36d809881d011998b9aaa8b947cce260d2a00b666f441620
Python
13,922
324
""" Methods for Cramer-Rao lower bounds optmization of b-value schemes. """ import numpy as np import numpy.typing as npt from scipy.optimize import minimize, Bounds, curve_fit from ivim.models import sIVIM, diffusive, ballistic, intermediate, sIVIM_jacobian, diffusive_jacobian, ballistic_jacobian, intermediate_jacobi...
dda99c1a4efef08199235545d0834899a66e55508214749f5cd0298b2824061e
Python
13,924
331
import pandas as pd import numpy as np from natsort import natsorted import cv2 from sklearn.preprocessing import minmax_scale from matplotlib import path from typing import List, Union, Generator from pathlib import Path from napari.utils.notifications import show_info from napari_dmc_brainmap.results.results_helpers....
d29c422ee7b88aaa850be939072a807b28369a882d597aa0b6877764e10cab50
Python
13,933
385
import inspect import os import sys import typing import warnings from typing import Any, Dict, List, Optional, Set, Tuple, Union import numpy as np import torch from torch import Tensor WITH_PT20 = int(torch.__version__.split('.')[0]) >= 2 WITH_PT21 = WITH_PT20 and int(torch.__version__.split('.')[1]) >= 1 WITH_PT22...
c8970eb7d7a49c9d97e2772c4d65f6870616f961adbde0ddc02f44f97f5bbb25
Python
13,934
369
""" Fused Attention =============== This is a Triton implementation of the Flash Attention v2 algorithm from Tri Dao (https://tridao.me/publications/flash2/flash2.pdf) Extra Credits: - Original flash attention paper (https://arxiv.org/abs/2205.14135) - Rabe and Staats (https://arxiv.org/pdf/2112.05682v2.pdf) - Adam P...
9ab41423bee401fd0bfa84249f22bc0fcdcc05b9c01b3882b66424099907cfbd
Python
13,937
386
import os import shutil import numpy as np import pandas as pd import hail as hl import heig.input.dataset as ds from heig.wgs.relatedness import LOCOpreds from heig.wgs.null import NullModel from heig.wgs.coding import Coding from heig.wgs.slidingwindow import GeneralAnnotation from heig.wgs.mt import SparseGenotype f...
c8d7779adc7c2963144a2bade1e91256b08d89e818488196bb944ff3dadbabed
Python
13,939
331
import os, re import pandas as pd import random import numpy as np import nrrd def get_all_filenames(folder_path): filenames = [] for filename in os.listdir(folder_path): full_path = os.path.join(folder_path, filename) if os.path.isfile(full_path): filenames.append(filename) re...
c5105d7df5be95113e714f0f551aad18e3e9d420bd91a9abdce32f79b48da339
Python
13,942
395
############################################################################### #################### Boilerplate ######################## ############################################################################### import pandas as pd import matplotlib.pyplot as plt import os import matplotl...
0d4ee6930ccd375b34152bfe1d1d42f4f9ad706d2a7b4c48fbcfb5693f3e1b32
Python
13,944
431
from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import pandas as pd # type: ignore import scanpy as sc # type: ignore from anndata import AnnData # type: ignore from numpy.typing import NDArray from scipy.sparse import issparse # type: ignore from ..logger import logger DESIGN_KEY =...
2815ea0c6747f94ef03cd4cbbdd50e1e642f93f55f1f054f17c90f0fd1e2d5f8
Python
13,944
289
import torch import pandas as pd import os import sys import lightning.pytorch as pl from scipy.stats import pearsonr from datasets import GTExDataset,GTExRefDataset from torch.utils.data import DataLoader from scipy.ndimage import gaussian_filter import numpy as np from eval_enformer_gtex import get_enformer_output_di...
f02b8c9b62c64b34ae649b361b987b9323b03a33ac43264f63db86f273bbed41
Python
13,944
356
# Basic imports import numpy as np import pandas as pd import tqdm import os import glob import datetime # Image processing tools import skimage.io from skimage import (color, feature, filters, measure, morphology, segmentation, util) import skimage.feature import skimage.filters import skimage.filters.rank from ski...
2af00c778b2b57f7e7dc5cc83d83c2fe1de4d81a733896294f94a53262815687
Python
13,945
391
""" Doing motion correction and registering multiple runs across sessions. """ import ants import os import glob import nibabel as nb import numpy as np import subprocess import sys sys.path.append(f'./code/misc') from computeT1w import * subs = ['sub-12', 'sub-15', 'sub-16', 'sub-17', 'sub-18'] # subs = ['sub-07'...
93259dd5a81f10673d5accc9b95c5749b982d81b24ae0e2117cfdbe97769bb9e
Python
13,947
348
"""How far a run has got, and how much longer it has left. A run is a few minutes to a few hours of near-silent work, and the status log answers "is it alive?" without answering "should I go to lunch?". This turns the same work into a fraction and an estimate. **Why weights, and where they come from.** Counting recor...
b9ad933d00cfc62686ac3531b247edb1e92f0e6d37d1eb771ce564ebf52b7716
Python
13,947
334
import jax import jax.numpy as jnp import matplotlib.pyplot as plt import glob import sys import os import re import json from scipy.linalg import toeplitz plt.rcParams["font.sans-serif"] = ["DejaVu Sans"] # Best available plt.rcParams["font.family"] = "sans-serif" plt.rcParams.update({ "font.size": 10, ...
62d7d4e83549ebd0248faf9d5f871b1e449b02f93722b9ecc41e47b0f56b80a9
Python
13,948
380
# 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, ...
25966e843a332aa06fa622c64c0f6f032a19c9edb2b8952f968293c33330d61b
Python
13,950
373
"""Collection of functions to evaluate brain sensitivity selectivity and crossing ToFs """ from dataclasses import dataclass from typing import Optional import numpy as np from scipy.ndimage import gaussian_filter1d from scipy.signal import find_peaks @dataclass class Metric: corr_per_pulse_brain: np.ndarray ...
de790cbfbeed1c72903af4d296056c246e7420f3045a2fe4262eb4c7b939ab36
Python
13,951
370
import sys import yaml import os import numpy as np import re import matplotlib.pyplot as plt from scipy import stats import h5py pathpath,myrun,ncluststr,cmethod,get_rois_bool_str,roi_tag = sys.argv[1:] ''' pathpath = 'PATHS/filepaths_carlen.yml' myrun = 'runCrespZP_brain' get_rois_bool_str = '1' cmethod = 'ward' n...
31fb94612b080c55b5d02c65985e3016b0e7f53535c9a1c5cad53eb59c6371af
Python
13,953
364
import os import shutil import subprocess import tempfile import warnings from abc import ABC, abstractmethod from collections import Counter from datetime import datetime from pathlib import Path from typing import List, Optional, Union from loguru import logger from brainles_preprocessing.brain_extraction.brain_ext...
503edb397ac6b414e0cff915761c81ecd8d4541b28d34b7c424edb02b0c20918
Python
13,959
407
# -*- coding: utf-8 -*- """ File to get Fig. S17 (section 4) """ import scanpy as sc import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import matplotlib as mpl import os import warnings; warnings.simplefilter('ignore') import anndata from scipy.stats import p...
37668e5c11102110ac48592f6df52613148db70a9ceec323c49a7963cbd20268
Python
13,964
413
from collections import OrderedDict from torch import nn import math import torch.nn.functional as F import torch import numpy as np from timm.models.registry import register_model HASH = '5c427c9c' HASH = '1d3f7974' class Flatten(nn.Module): """ Helper module for flattening input tensor to 1-D for the use...
48ff4606a10c8e3b6deade640242efcea63cff3760540daebd33d8616f8a9692
Python
13,966
377
from pathlib import Path import numpy as np import polars as pl from polars.exceptions import SchemaFieldNotFoundError from typing import Literal, Any from neuralib.util.verbose import fprint, print_save from rscvp.util.cli import CodeAlias, HEADER, CELLULAR_IO, CommonOptions from rscvp.util.cli.cli_statistic import ...
4f2082ab52cccce5952bdea2948daa9247e71cf8d23366aee935967c7913a705
Python
13,984
407
import logging import random from collections import defaultdict from collections.abc import Callable, Generator, Sequence from dataclasses import dataclass from pathlib import Path from typing import ( TYPE_CHECKING, Any, ) import numpy as np import pandas as pd import seaborn as sns import torch from captum....
74db09347d12f9acbb92b2cae71d81be3bb09761730f1fabf6242f9da9b59c20
Python
13,984
440
# utils.py import os import torch from monai.transforms import ( LoadImaged, EnsureChannelFirstd, Orientationd, Spacingd, ScaleIntensityRanged, EnsureTyped, RandCropByPosNegLabeld, CastToTypeD, ToTensord, Compose, NormalizeIntensityd, CenterSpatialCropd, RandFlipd, ...
cda54e10bba0e3993faac65d573b3ef6c2cb11b3803f294b1073495d3be47452
Python
13,986
418
from __future__ import annotations from datetime import datetime, timezone from pathlib import Path from typing import TYPE_CHECKING, NamedTuple import numpy as np import pandas as pd from tqdm import tqdm import seisbench from seisbench.data.base import WaveformDataset try: from pyrocko.gui.marker import Phase...
972452f11ea26c16906247be8c14e30f669f0fcf72a0a1d889d76277e34d7e75
Python
13,989
375
import numpy as np from random import shuffle from .data_utils import DataGenerator, _revcomp class SeqMatrix(): '''Parent class for inheriting. Used for making insertions/substitutions \ dynamically ''' pass '''class RandomSeq(SeqMatrix): def __init__(self, p, length): self.p = p ...
23a9ffc43f23a5784e61c002f0fa9606962030281fc0803802e437c9317e891f
Python
13,992
386
"""`guiclass` decorator. 1. Turns a class into a dataclass 2. Uses `psygnal.evented` to make it an [evented dataclass](https://psygnal.readthedocs.io/en/latest/dataclasses/) 2. Adds a `gui` property to the class that will return a `magicgui` widget, bound to the values of the dataclass instance. """ from __future_...
197c9eff43d607b696303c47c11dbb0d7ad172416a949cc499198a140c4f3b03
Python
13,993
359
# 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, ...