sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
a83072793490e7aa55ad73934c4d5c643b058cb4e74abc9dca05d7d5cc5df401
Python
11,609
180
from brainvoice.configuration.configuration import Configuration from brainvoice.configuration.utils import extract_modify_dict from brainvoice.configuration.configuration_linker import ConfigurationLinker from brainvoice.configuration.static_configuration_parser import StaticConfigurationParser import argparse ...
e6d235db391065fcf6ec5f847b3407e367616c938a09df3b0434355aa0082e2c
Python
11,609
347
import os import pandas as pd import numpy as np import math from numpy.linalg import norm import MDAnalysis as mda from scipy.stats import pearsonr def angle(x1, y1, x2, y2, x3, y3): # Calculate vectors BA and BC BA_x = x1 - x2 BA_y = y1 - y2 BC_x = x3 - x2 BC_y = y3 - y2 # Calculate do...
4e0c7f46067422919dae835defae664479fcd2e736ee4eaa7d2fdb810192ea1a
Python
11,619
266
import argparse import logging import sys import os import sys from pathlib import Path import h5py import torch import torch.nn as nn import torch.nn.functional as F from torch import optim from torch.utils.data import DataLoader, random_split from tqdm import tqdm import torch.utils.data as Data from utils.data_loadi...
51030aabecc2e7da1db5d414f0d9df291dca6207ce925e064f27c6bd0eef821b
Python
11,622
324
# 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...
a9e12b9ab557a7b0d7fc0304b8f13c747dd4e47263e682b38fe5f222980c9315
Python
11,623
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...
9822010a983c4a5bc712e853423a1241ad68958bb29d4d817a8acaa61391ee2c
Python
11,625
278
"""The viewer's controls describe the run, not the viewer. Opening a bundle used to show a generic control set: every default read off a fresh ``NetworkStyle``. That was wrong as *display* — the panel claimed a node-size scale of 1.0 for a CAT-NAP run drawn on ``"auto"`` — and worse as *behaviour*, because the page se...
cb89b2bf5a2922b58a71c073b45d3d6ef0005da6d457fe60d256e9e873668bf4
Python
11,625
429
# -*- coding: utf-8 -*- import ast from colorama import Fore, Style from importlib.resources import files import itertools import logging import multiprocessing import pathlib import re import subprocess from tqdm import tqdm import nltk from nltk.stem import PorterStemmer from scilpy import SCILPY_HOME SPACING_LEN ...
aee5863ff2c6008cda5e09c361b818ee8e08dd0ab315a096500a638a22b6b4e4
Python
11,629
338
from __future__ import annotations import collections from typing import NamedTuple, Literal import numpy as np from matplotlib.axes import Axes from scipy.interpolate import interp1d from typing_extensions import Self from argclz import argument, float_tuple_type from neuralib.persistence import * from neuralib.plo...
8a051e2fd6bba95f513d513d4436cb5eb5e14aedb50e72896e68bad9945080b5
Python
11,630
355
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): """ ...
017d6914659fbd131da9e480415cd6b24c431b91bf15897523ffdd5f2593b19a
Python
11,631
322
from typing import NamedTuple, Literal, ClassVar, cast import attrs import numpy as np import scipy from typing_extensions import Self from neuralib.locomotion import CircularPosition from neuralib.typing import PathLike from neuralib.util.interp import interp_timestamp from neuralib.util.verbose import fprint from r...
f0c03df10a18b7799b32b1c12b6c671c3f367f7777fed3d56a3804726199a57e
Python
11,631
373
import numpy as np from sklearn.metrics import r2_score from .. import compute, utils from ..base import BasePLS, gen_splits from ..structures import _pls_input_docs class BehavioralPLS(BasePLS): def __init__( self, X, Y, *, groups=None, n_cond=1, n_perm=50...
1e6d04bd1310a3815a0c9ab0013c1881521034a797b7eae5a485215a61d7f542
Python
11,635
340
"""Functions to calculate static properties of time series data.""" import logging from typing import Callable, List, Optional, Union import numpy as np from sklearn.covariance import LedoitWolf from pqdm.threads import pqdm from threadpoolctl import threadpool_limits from tqdm.auto import trange from osl_dynamics.a...
b55699485b990636d2d60f2bdb0623f45e02a9f47f81450fcb7ba2a4c8f5c0f4
Python
11,636
303
"""Scrolling past a settings field must not retune it. Run from the repo root:: uv run python python/test_gui_wheel_guard.py A spin box or combo box takes the wheel whenever the pointer is over it, so rolling down a tab of settings used to change whichever fields the pointer crossed. The page scrolled either way...
ca663c3078e176e80c8e88779addf127563a5805d55c6ba77e892616dbba5170
Python
11,637
374
import itertools import random import logging from collections import defaultdict from enum import Enum from pathlib import Path from typing import List from flair.data import Dictionary, Sentence from functools import reduce from sklearn.metrics import mean_squared_error, mean_absolute_error from scipy.stats import pe...
c6828856aa6399718e02c0a70efe98baab266df2849f3ddc674e32bb8cfbef03
Python
11,639
253
import json import os from mako.template import Template from sympy.parsing.sympy_parser import parse_expr from sympy.parsing.latex import parse_latex from sympy.printing import cxxcode def remove_parentheses(expr): if '(' in expr and ')' in expr: return expr[:expr.index('(')] else: return exp...
df78acd7bf722b93f56072700ced2707e7db29ce6aedb60357f716e7da9ac72d
Python
11,645
341
# Crosscheck folder names and geometry.in data import os import glob import collections import numpy.typing as npt from modules.tools.strings import get_clus_and_mol, get_atoms_and_amount from modules.tools.error import display_traceback from modules.tools.xyz_tools import convert_geometry_in_to_xyz, generate_xyz #...
97fa56079a5f51e1e2202ef6ca1ea7b68f80eb2bc6c5116a62ff56cdc037112b
Python
11,647
321
import numpy as np from matplotlib import pyplot as plt from dipy.core.ndindex import ndindex from dipy.core.geometry import cart2sphere from dipy.core.gradients import gradient_table from dipy.reconst.dki import _positive_evals from dipy.reconst.vec_val_sum import vec_val_vect from dipy.reconst.dti import (design_ma...
f1cf57a89de9c56e5367f45a1001d999b3ba234be3b1bf51921a5710591dc3dd
Python
11,647
287
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT6: from PyQt6.uic import * elif PYQT5: from PyQt5.uic import * else: __all__ = ["loadUi", "loadUiType"] # In PySide, loadUi does not exist, so we define it using QUiLoader, and # then make sure we expose that function. This is adapted from qt-h...
6e79202d565106e9a625d3700dcdb036b5a8d4dc65e32bac945ff2fa5bb558cb
Python
11,653
296
import json import numpy as np import pandas as pd import pytest from metaprivBIDS.corelogic import ( add_gaussian_noise, add_laplacian_noise, bin_numeric_values, calculate_k_combined, calculate_k_global, calculate_l_diversity, calculate_mad_outliers, calculate_privacy_metrics, com...
70a0bd4687f0d897485584a4314c6c254dd1d721228002d2c458131d66e5aedd
Python
11,655
295
"""ADMET-AI class to contain ADMET model and prediction function.""" from pathlib import Path import numpy as np import pandas as pd import torch from chemprop.data import ( MoleculeDatapoint, MoleculeDataset, ) from chemprop.models import load_model from chemprop.data.dataloader import build_dataloader from ...
6b4efdcefbd18fbd9b1ffa709aa8a2133bab385b52108d298708a628747ca591
Python
11,661
287
# train.py import argparse import os import torch import torch.optim as optim import numpy as np import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel as DDP from monai.losses import DiceCELoss from monai.inferers import sliding_window_inference from monai.data import DataLoader from tq...
404ba8112000e3085c17f4251f4171efa487461be7902e1963acbdc0d0b21d4f
Python
11,663
302
# -*- coding: utf-8 -*- # fashion_mnist_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 # =====...
6129a69fa1e79a3bde75c562fbe42a9c29138e2eeca657c7b3c82da7a6a3fe6f
Python
11,664
333
#! /usr/bin/env python3 """ Implements function find_roi and corresponding nipype interface FindRoi and command line interface. """ import sys import os from scipy.optimize import bisect, brentq from nipype.interfaces.workbench import MetricResample from nipype.interfaces.base import ( BaseInterfaceInputSpec, ...
d5bbd05dbcf111a94bf35601e7352ba1f38660db731b91dc2cdf1062873718c0
Python
11,664
295
import numpy as np import polars as pl import scipy.ndimage import scipy.stats from functools import cached_property from joblib import Parallel, delayed from matplotlib.axes import Axes from scipy.ndimage import gaussian_filter1d from tqdm import tqdm import stimpyp from argclz import AbstractParser, argument from ne...
0ccfaf3d21ebd3ba64fd49fd5a13da69117834f481acc3438ec058031ab85a36
Python
11,665
358
#!/usr/bin/env python3 """ Fig4Sup2_CompetitionTitrations.py Plots overlayed EC50 dose-response curves for GABA in competition with various decoy ligands (1 mM fixed decoy concentration). Usage: python Fig4Sup2_CompetitionTitrations.py # Process all CSV/XLS files python Fig4Sup2_Competition...
0eb0e7f36fc460faee57e2cbeddb61cef52f83e8a3321a18e2547571ce54faff
Python
11,669
360
from __future__ import annotations import json import pytest # Skip the whole module when the optional 'academy' extra is absent. # Even though this file only touches the pure-stdlib parts of # chemgraph.academy, the import guard is applied uniformly across the # academy test suite so pytest collection stays clean o...
5bee74bff890025b51b63720cf391700a83edb5fa93fbb797116a0e6e17700e9
Python
11,669
275
# 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 pre-computed position tables""" import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import progressb...
85528f73bd2a796d781f9fffcb663c82bc5cbb021731ad3efa688f415a2c5a5a
Python
11,674
259
import scipy.sparse, numpy as np, joblib, random, linecache, gzip, torch from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import roc_curve, auc, average_precision_score, mean_squared_error, jaccard_score # Given a set of files containing input feature data, determine which lines to read to defi...
f71a39b0ea313058fbb5a1f0caf8691fefd78367abbcf8af873f7ee1d82f33af
Python
11,676
379
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import io import json import mimetypes import os import shutil from collections.abc import Sequence from enum import Enum from pathlib import Path from typing import TYPE_CHECKING, Any from PIL import Image from ...
0fb5e550d709a32e67ec125c9e435b2556229bfa278fbb9cb54626a43473c195
Python
11,686
255
"""(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 d...
404f6e018f76c6c1097d0c76b09a433eed9ee0790a36c76486bf438599aa320e
Python
11,687
249
import argparse from os.path import join, isfile import pickle import keras from keras.optimizers import Adam from keras.callbacks import EarlyStopping, ReduceLROnPlateau import utils import h5py from model_zoo import lentiMPRA import plotting import pandas as pd import wandb from wandb.integration.keras import WandbMe...
8ea5dcfcf6deade98647a1db68a1012dc35e5d74df72d405280071b603946137
Python
11,687
341
# !/usr/bin/env python # coding: utf-8 # @Time : 2022/9/23 13:25 # @Author : Z.-H. G. # @Email_0 : guozhenhao17@mails.ucas.ac.cn # @Email_1 : guozhenhao@tongji.edu.cn # @File : preprocess_untils.py # @IDE : PyCharm import numpy as np import pandas as pd import scanpy as sc import os import logging from typi...
e89adcb0dc2843601cc692a3eace2065b1d30e7f99070dff7903f4f86b8b7759
Python
11,689
302
""" Tests for `bx.align.maf`. """ from io import StringIO from bx import align from bx.align import maf # A simple MAF from the rat paper days test_maf = """##maf version=1 scoring=humor.v4 # humor.v4 R=30 M=10 /cluster/data/hg15/bed/blastz.mm3/axtNet300/chr1.maf # /cluster/data/hg15/bed/blastz.rn3/axtNet300/chr1.ma...
683a6e2bec4e9e193f1f34f35b2498444bdaa949f179cf971d987ac56961cba3
Python
11,699
311
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...
7ec1f814c3dd3ab310ed478e77abbccead645c277cce98d7c003a549fbc139e9
Python
11,699
320
from sklearn.model_selection import GridSearchCV from sklearn.impute import SimpleImputer from sklearn.preprocessing import LabelEncoder, LabelBinarizer from sklearn.metrics import accuracy_score, f1_score, roc_auc_score, confusion_matrix from sklearn.svm import SVC from sklearn.neighbors import KNeighborsClassifier fr...
459c41ba1bef5781774007e1c02a3dc4d7803b110809c894d429a2d3ed121692
Python
11,700
348
# -*- coding: utf-8 -*- """ Implementation of various volumetric filter kernels .. _FilterTypes: Filter Type ----------- Filter types defined by the ``ftype`` key include: =============== ===================================== Type Descrition =============== ===================================== ``mean`...
5cb0637b2d980698707e9c336413bf4576dbfa4461f66b001da03d8a22cead48
Python
11,700
317
# -*- coding: utf-8 -*- """ This module defines the NormalizedWorm class """ import numpy as np import pandas as pd from collections import OrderedDict import matplotlib.pylab as plt from matplotlib import animation, patches from .helper import DataPartition, nanunwrap # i am including an excess of subdivisions wit...
b365b391c91df87e2b7bde2eed7501e76bbb17e468f49cc4665b3a411da32f22
Python
11,704
308
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import os import json import cv2 import seaborn as sns from matplotlib.colors import ListedColormap from PIL import Image import openslide from typing import Tuple import staintools # Tensorflow Dependencies import tensorflow as tf from tensorf...
e8c0f43c33a975f8595ddc3c603d07deeffe92b9182686384440e9698f9ae810
Python
11,705
374
from __future__ import annotations import os import sys import types import warnings from collections.abc import Callable from collections.abc import Iterator from pathlib import Path from typing import cast import pytest from loguru import logger from PySide6 import QtCore from labelme.__main__ import _LOGGER_LEVEL...
0299c299833e92c21d664c803ec5178f8b0e2e6403b2172a84e3492249f89c20
Python
11,708
303
from collections import defaultdict import numpy as np import pandas as pd import anndata from scipy import sparse def binning(adata, bin_size=100, dim='3d', use_value='sum', celltype=None): obs = adata.obs.copy() obs['x_bin'] = (obs.x / bin_size).astype(int) obs['y_bin'] = (obs.y / bin_size).astype(int) ...
395eb18a1cc03754d00dcde45d8b1af829eaf79933769c23df3c5220843523dc
Python
11,715
333
import numpy as np import polars as pl from matplotlib import pyplot as plt from matplotlib.axes import Axes from typing import Literal, cast, get_args from argclz import argument, AbstractParser from neuralib.io import csv_header from neuralib.plot import plot_figure from neuralib.plot.colormap import get_customized_...
38de1a9d45b291321aff01466126f01c6bce6674d84311a4d284a79b820d54f4
Python
11,720
378
# 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. """ Wrapper around various loggers and progress bars (e.g., tqdm). """ import atexit import json import loggin...
56670cfc828c8b4ae0ceeb01b7c7b0673f4b0c54543c74fe72cb4fa1a38e2401
Python
11,722
370
import nibabel as nb import numpy as np import os import glob from nilearn import signal import pandas as pd import seaborn as sns import matplotlib.pyplot as plt ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives' # Set subjects to work on subs = ['sub-05', 'sub-06', 'sub-07', 'sub-09', 'sub-10', 'su...
fa2e285fde8d0a21ade21b4efb79d3d5a869eab2da99d988af5daaf8d2ff899d
Python
11,723
253
from ._extraction import * from bread.data import Features, Segmentation, Lineage import torch if __name__ == '__main__': import argparse from pathlib import Path from typing import List from glob import glob parser = argparse.ArgumentParser('bread.algo.lineage.nn.preprocess', description='extract training data ...
61ec39239c20558f721b2df713980cf5ed88ccb46f14e60d74d7f491d1922959
Python
11,724
211
import numpy as np from src import utils, trnvaltst_sigmoid_oned, plot_figures import tensorflow as tf class EarlyStopping: """Early stops the training if validation loss doesn't improve after a given patience.""" def __init__(self, patience=7, verbose=False): """ Args: patience (i...
e273aacfb7ce8a190056402121a1d97bdc8a9fcf82e4396630768ed468fe28f7
Python
11,727
388
# # Copyright © 2009- The Spyder Development Team # Copyright © 2014-2015 Colin Duquesnoy # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ **QtPy** is a shim over the various Python Qt bindings. It is used to write Qt binding independent libraries or applications. If one of the APIs...
fe97a7976aa40cc795b65c063eb97b52ecb1061e882ed7622c79ab50d4079187
Python
11,731
322
import warnings from contextlib import nullcontext from typing import Any, Dict, List, Optional import torch from torch import Tensor try: from transformers.tokenization_utils_base import BatchEncoding except ImportError: BatchEncoding = Dict BOS = '<s>[INST]' EOS_USER = '[/INST]' EOS = '[/s]' IGNORE_INDEX =...
36d21a48d497c48d926f4f07ba454c97c77bbb4f4e8f2a38f32121ba27b389be
Python
11,732
350
from __future__ import annotations import math import pytest from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets from PySide6.QtCore import QPointF from pytestqt.qtbot import QtBot from labelme._utils._qt import _TintedSvgIconEngine from labelme._utils._qt import direction_angle from l...
e4a08a6c005b836e4630897b5301684977b2a2fec010aa1aea2b1ed44236cb2a
Python
11,732
367
import torch.nn as nn from .common import LayerNorm2d, UpSampleLayer, OpSequential __all__ = ['rep_vit_m1', 'rep_vit_m2', 'rep_vit_m3', 'RepViT'] m1_cfgs = [ # k, t, c, SE, HS, s [3, 2, 48, 1, 0, 1], [3, 2, 48, 0, 0, 1], [3, 2, 48, 0, 0, 1], [3, 2, 96, 0, 0, 2], [3, 2, 96, 1, 0, 1], [3, 2,...
985052e46ef83b3f67e28d01aaec2b85691dd07941a07f163d0763378993a1e3
Python
11,740
332
# 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, ...
bb1a4029a2e77ff8a38934570dea744e2265b063b8a412149b7d577c97f46821
Python
11,740
389
import re import io import sys import time import zlib import json import shutil import typing import struct import pickle import pathlib import argparse import threading import traceback import itertools import contextlib import subprocess import collections from multiprocessing.pool import ThreadPool import yaml imp...
5c3a4abdebe8d365c9ef5789d1edff3e6d4630771cbfd87466cc639f3fad9066
Python
11,741
330
# custom_pinn_utils.py import numpy as np import tensorflow as tf from deepxde import optimizers, config from deepxde.nn import activations, initializers, regularizers from deepxde.display import TrainingDisplay from deepxde import Model, config, optimizers from deepxde.nn import regularizers, activations, initializer...
a0f38253f2ea845d12affb849c39be0c92e63f34b2d505ac106f9c9e10af2f83
Python
11,741
246
#!/usr/bin/env python3 """Create, inspect, upload and publish a checked Zenodo software release. Uses Zenodo's current InvenioRDM API. Credentials are read from a mode-0600 file and are never printed. Destructive publication is a separate subcommand that revalidates the draft, archive checksum, record ID and reserved ...
09af0c9f4ee028f3b46de7f5b1864a42405e7dcc58d54b1cc39d0325caca3546
Python
11,743
234
#!/usr/bin/env python # This is a pipeline doing resting-state fMRI preprocessing as done in the PAINTeR study # https://github.com/spisakt/PAINTeR # # The pipeline performs: # - a standard anatomical image processing (AnatProc) with: # - brain extraction with FSL bet # - FSL FAST tissue segmentation # - ANTs-bas...
d7cd3efd1098dd934c509ffd8e35da7e7d9f4937cb4dead4d46c0f748077430d
Python
11,743
197
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'film.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_GroupBox(object): def setupUi(self, GroupBox): GroupBox.setObject...
1904fb72e5d7035450a8c5afbdc249ad057a24b3e4d363d0d48677568b4b5a2e
Python
11,745
349
"""residual attention network in pytorch [1] Fei Wang, Mengqing Jiang, Chen Qian, Shuo Yang, Cheng Li, Honggang Zhang, Xiaogang Wang, Xiaoou Tang Residual Attention Network for Image Classification https://arxiv.org/abs/1704.06904 """ import torch.nn as nn import torch.nn.functional as F #"""The Attentio...
056c391a02bb282ed33a134ad9c509e58a06cbfd03bfa0c2fcdbb04126a756b7
Python
11,749
250
# Loss functions import torch import torch.nn as nn from utils.general import bbox_iou from utils.torch_utils import is_parallel def smooth_BCE(eps=0.1): # https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441 # return positive, negative label smoothing BCE targets return 1.0 - 0.5 * eps,...
9ea1882e5dcc44a8ba43484291c442554c157b0f7243838d5d034cc95712244f
Python
11,752
249
import torch import numpy as np from torch.nn import functional as F class ResNet2D_block(torch.nn.Module): def __init__(self, channels=128, rate=1): super(ResNet2D_block, self).__init__() self.inorm1 = torch.nn.InstanceNorm2d(num_features=channels, eps=1e-6, affine=True) self.inorm2 = torc...
15f254108896a10fc65e46debfb361613ae7df6058aec531f9c83b4cd090926a
Python
11,753
245
############################################################################# # 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...
8fea771926f5dec0ac76d6919149d261c0b16ba62bf520d7d1241ffb02ef9fa6
Python
11,755
267
import warnings from collections.abc import Callable from typing import Any, cast import torch from eir.train_utils.ignite_port.engine import Engine from eir.train_utils.ignite_port.events import Events from eir.train_utils.ignite_port.metrics.metric import ( Metric, MetricUsage, RunningBatchWise, Sin...
cce8954c0b53c9c3aa3fdc56a667910a9c0179d2d1d6f292abe4cde8d99d599b
Python
11,757
334
# -*- coding: utf-8 -*- # # LightGBM documentation build configuration file, created by # sphinx-quickstart on Thu May 4 14:30:58 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
70967f040256b5864c360f4c5e18c35e8b4eb7428281bd3e06bf2462c0360922
Python
11,758
401
#!/usr/bin/env python #import sys import numpy as np #from scipy import optimize import matplotlib import matplotlib.pyplot as plt import os import argparse from datetime import datetime import csv import glob import itertools from matplotlib import ticker import sys matplotlib.use('agg') # Gets rid of GUI dependenc...
8eb29034cabf8bebe356ec040446cf6d09efcd323c4bf13848b218e49f68adff
Python
11,759
293
import os import glob import tqdm import json import numpy as np import matplotlib.pyplot as plt from collections import Counter ############################################################################################################################################ DATA_DIR = r"D:\Askivit Daten\ASKIVIT_...
cee071068924d962c6442c02668eb34b1490c6ac7598a5c2b433810c1001a71b
Python
11,760
289
# Kai Sandbrink # 2023-02-14 # This script analyzes the mistrained model # %% LIBRARY IMPORTS import torch import numpy as np import os, copy import pickle import matplotlib.pyplot as plt from utils import Config, plot_learning_curve, get_timestamp from ObserveBetEfficacyTask import ObserveBetEfficacyTask from PeekTa...
e744cd2028c39f2f5db000b27719e7feb61df3d41c03ef900c42c8332a931545
Python
11,764
281
from collections import defaultdict from typing import Set, Tuple, List import networkx as nx from networkx import DiGraph from zigzag.classes.hardware.architecture.memory_instance import MemoryInstance from zigzag.classes.hardware.architecture.memory_level import MemoryLevel from zigzag.classes.hardware.architecture....
0d6679450fe1d82ed9d7eb0814ff593bc7d74620637e570e32d67bd943992bfe
Python
11,769
270
'''Tests for Attributors.''' from functools import partial from itertools import product import pytest import torch from zennit.attribution import Gradient, IntegratedGradients, SmoothGrad, Occlusion, occlude_independent class IdentityLogger(torch.nn.Module): '''Helper-Module to log input tensors.''' def __...
afe7960359a251d0efd9b1c91791cca2f92ffd04ce1ea51ae3d271df07280f5c
Python
11,770
270
import torch import torch.nn as nn import spikingjelly.activation_based.layer as layer from copy import deepcopy from spikingjelly.activation_based import neuron, surrogate import torch.cuda.nvtx as nvtx def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution with padding""" retu...
ea726c5ea73830e52fc4f0ed14c1238b1b82ea4bfe0e3e0258f90be803fffab8
Python
11,770
304
""" HMM: Plotting MEG Networks ========================== In this tutorial we will plot networks from an HMM trained on source reconstructed MEG data. This tutorial covers: 1. Load multitaper spectra 2. PSDs 3. Power maps 4. Coherence networks 5. Coherence maps 6. Coherence vs Power """ #%% # Download post-hoc spect...
ca72341e1d574bd73edcc2f62b8dd261b305d2bdb89ece483217b9f74c45ca13
Python
11,773
315
import torch import torch.nn as nn import torch.nn.functional as F from torch_scatter import scatter from torch_geometric.nn import InstanceNorm class EGNNLayer(nn.Module): """ EGNN layer with optional feed forward network and batch normalization. Args: input_nf: Number of input node features ...
7fe450960c409f90f2bd1327214eab4730bff3a5d640b871a6c02d079b8dd887
Python
11,774
327
from __future__ import annotations from collections.abc import Iterator from typing import Final from typing import NamedTuple from typing import cast from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets from PySide6.QtCore import Qt from PySide6.QtWidgets import QStyle from .._shape im...
369fa88d129c506a4e55bccd8d322d1266b250a47bbb2668d5879928ecab7f2c
Python
11,775
275
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import math from collections.abc import Generator from itertools import product from typing import Any import numpy as np import torch def is_box_near_crop_edge( boxes: torch.Tensor, crop_box: list[int], orig...
f10816c6dbbf2ed613e8f678ee0420f381c89094b16fa88ce6ae920aa11e9116
Python
11,779
325
# type: ignore # This file is adapted from external source and kept untyped """ Adapted from: https://github.com/Blealtan/efficient-kan/blob/master/src/efficient_kan/kan.py Original Author: Blealtan and akaashdash (Efficient KAN repository) Notes: This version may include modifications. KANs require flattened input sh...
3b2ffadb8f29eb2adff2a926104a9b8205995e1e364b4350ccb743e16aefcc12
Python
11,783
350
from __future__ import annotations import asyncio import dataclasses import json from pathlib import Path from typing import Any import pytest # Skip when the optional 'academy' extra is absent. pytest.importorskip("academy") from chemgraph.academy.core import agent as agent_module from chemgraph.academy.core impor...
bf136583d938ccf2f6eab349b7ccafd5222767520264150eb65e1bcb7155b9ef
Python
11,785
369
from collections.abc import Generator, Sequence from dataclasses import asdict, dataclass, fields from pathlib import Path from typing import Optional import numpy as np import torch from PIL import Image from timm.models._registry import _model_pretrained_cfgs from torchvision import transforms from torchvision.trans...
782005e9948bb63bb8daf825073ddb493f4fb6a2b8905d030bfa68159639c3d0
Python
11,786
232
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/model_manager_dialog.ui' # # Created by: PyQt5 UI code generator 5.15.10 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not ed...
8ae6ed0517f3d6daf596b3d078a5299faa791c49525ec3c2b7cd988220275c1b
Python
11,790
250
''' embeddings::glove.py Wrapper functions to transform, load and sample GloVe. Available as embeddings.glove.* ''' from .internal import * import os import numpy as np from sklearn.decomposition import PCA from gensim.models.keyedvectors import KeyedVectors from gensim.scripts.glove2word2vec import glove...
fb427c5281a1204ef9d9a0220dc09a08d6362fcb93862fc4798cd87d1aececc2
Python
11,793
303
import torch from torch import nn from torch.nn import functional as F from torch.nn import init from .pooling import build_pooling_layer class SeparableConv2d(nn.Module): def __init__(self,in_channels,out_channels,kernel_size=1,stride=1,padding=0,groups =1, dilation=1,bias=False): super(SeparableConv2d,se...
d5beb053ee984ee2ec5a7e69f1ce4b5d09b62ae8040157046092996d64c3be04
Python
11,796
315
import copy from typing import Any, List, Optional, Union import numpy as np import torch from torch import Tensor import torch_geometric.typing from torch_geometric.typing import Adj class InvertibleFunction(torch.autograd.Function): r"""An invertible autograd function. This allows for automatic backpropag...
8f5780e101fc5d08b8c21b058bb8bb6477232a050d735dd1ca04c7a76b5e8ce6
Python
11,801
325
import numpy as np import torch from torch import Tensor from typing import Tuple, List, Dict __all__ = [ 'rel_location2abs_location', 'filter_contours_by_stitching_rule', 'fouriers2contours', 'get_scale', 'scale_fourier', 'scale_contours', 'batched_box_nms', 'batched_box_nmsi', 'order_weighting', 'remove_bord...
cd53cd4303f34849758ce76bca6c3b1914679cffaac5d81dc9fd80c597316d4e
Python
11,804
160
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/remote_sam_dialog.ui' # # Created by: PyQt5 UI code generator 5.15.10 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit ...
f27bf6268ca0e0a2b002bd1e464cedf5548275bc967808df19e09568fee75175
Python
11,805
217
#!/usr/bin/env python3 # Copyright (c) 2022, Hyewon Jeong, Kwanhyung Lee. All rights reserved. # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distr...
a8b89212678f4780d7d1bd202589e37260ac302eb4781b9b60a0f2fd49ddf54b
Python
11,806
281
# -*- coding: utf-8 -*- """ Created on Wed Mar 10 15:01:03 2021 @author: mtodorov, adapted by Julian McGinnis """ import numpy as np import csv import nibabel as nib from tqdm import tqdm import pandas as pd import datetime import argparse from xml.etree import ElementTree as ET import io parser = arg...
453b5e4d8c8e43e08136645b524d42544393e1e419bcf04f233ac4f3bb7bda0d
Python
11,807
264
""" Decompose graph generation and embedding generation Embedding generation is gpu bounded while graph generation is cpu bounded Improve the edge distance computation via torch.cdist """ import os, random, re, sys sys.path.append('..') from pathlib import Path import math import warnings warnings.filterwarnings("ignor...
d28e0974ebd0c74ccf717c031ac5c50d0f6131b6cf53a634d1048d8d3ec466d6
Python
11,808
315
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 30 20:56:17 2016 @author: ajaver """ import json import numpy as np import pandas as pd import tables from scipy.interpolate import interp1d from scipy.ndimage.filters import median_filter from scipy.signal import savgol_filter from tierpsy.analys...
a7894e609a1f2662bb4c2eceae1adfd992b483613056176a28f19577cbef0a1e
Python
11,813
337
"""Simplified preprocessor and Dataset for SOTA datasets.""" import os from typing import Any import numpy as np import pandas as pd import torch from torch.utils.data import Dataset from mcmlnet.experiments.data_loaders.simulation import ManojlovicSimulationLoader from mcmlnet.utils.env import require_env from mcml...
8c913f67bea2cfb11c0e3c028c2377b9a72a2ffb2a124c67426abc8f723568db
Python
11,814
344
#!/usr/bin/env python import numpy as np from vtk.util import numpy_support from xml.etree.ElementTree import ElementTree from collections import namedtuple class vtuWriter: """ USAGE: vtk_writer = vtuWriter() vtk_writer.writeVTU("filename.vtu", pts, all other optional arguments...) vtk_writer.wr...
3f10ab5708819636c96dc55d79e1b3403d5818e2e4c90c0462044398e1807e50
Python
11,816
299
import os import glob import torch import torch.optim as optim import matplotlib import matplotlib.pyplot as plt import numpy as np import torch as tc import nibabel as nib from model import ModelWrapper import random import math import monai from monai.data import DataLoader from monai.transforms import Compose, Load...
79cecf156c9e3c0a8885ea8b1431e59d965146c4413499b13eafd768ff14b355
Python
11,817
296
"""Tests for hypnogram upsampling: hypno_fit_to_data and Hypnogram.upsample_to_data. Covers all combinations of: - data type : NumPy array | MNE Raw without meas_date | MNE Raw with meas_date - Hypnogram : no start | naive start | tz-aware start (via tz=) | tz-aware datetime Default behaviour (meas_date_is_local=...
89f98458e4a5c1f6c81b26ed3678ce60a7b56df4736f669ae118c333506a3ad1
Python
11,820
292
# Imports import sys import os import pandas as pd import numpy as np import random from scipy.integrate import odeint, solve_ivp from lmfit import minimize, Parameter, Parameters, report_fit from model_functions_loco_Rew1 import * import matplotlib.pyplot as plt from pathlib import Path ########## DATA LOAD ########...
4b2aa453c55977b01a26eb12a5f87deea02493506438f7ee965bc58956a1d35d
Python
11,831
351
""" Pipeline for VTK filters. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from .decorators import wrap_input from .wrappers.algorithm import BSAlgorithm from .wrappers.data_object import BSDataObject # From https://vtk.org/Wiki/VTK/Tutorials/New_Pipeline # Outputs are referred...
c1260e9f61d3f1b682dcae8f7ca3a9f6f30214782fb6e2e956c0c24778bf3965
Python
11,832
416
from unittest.mock import MagicMock import pytest import torch from torch import nn from eir.train_utils.optim import _get_all_params_to_optimize, get_optimizer @pytest.fixture def create_test_model(): class TestModel(nn.Module): def __init__(self): super().__init__() self.fc1 = ...
e3500ee22e56f0e508357d1008852549d0222f3fdd1197a0e551cb7e5a181141
Python
11,833
438
from __future__ import print_function import argparse import os import sys import subprocess import pandas import gzip import glob import re PIPELINE_PATH = os.path.join( os.path.abspath(os.path.dirname(__file__)), ) chr_pattern = re.compile(r'chr(\w+)\..+') # def filetype(arg): # if os.path.isfile(arg): # ...
4144f6e09a3152be6f20c5a4bce6b3359279d8af21341b456f09d5381973a8d6
Python
11,836
331
import gc import os import pickle import numpy as np import pandas as pd import torch from scipy.stats import spearmanr from sklearn.metrics import r2_score from SWOW_prediction.data_preprocessing import construct_property_dataset from SWOW_prediction.loss import get_l1_regularization, get_likelihood_loss from SWOW_p...
e2d6e733d64ea41e50618e333cac6a976352f852dda155137b6dff410a58eebe
Python
11,840
303
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # MRC CBU PYTHON SCANNING SYNC # # This library is intended to allow for easy communication between Python # experiments and the MEG and MRI scanners at the MRC Cognition and Brain # Sciences Unit (CBU). The implementation is intended for the CBU setup only, # and interf...
28094c10dac371b89149f93cce477d0cb7f850cdbd566a4a4e04fa9dd8f33449
Python
11,841
330
from Bio.PDB import PDBParser, MMCIFParser, NeighborSearch, Selection import subprocess from pathlib import Path import sys MODULE_DIR = str( Path( Path(__file__).parent.resolve() ) ) sys.path.append(MODULE_DIR) AA3to1_DICT = {'ALA': 'A', 'CYS': 'C', 'ASP': 'D', 'GLU': 'E', 'PHE': 'F', 'GLY': 'G', 'HIS': 'H', 'ILE': '...
9421760a05514d1800f5eb1604d5827943558ab42e9b6fde457e24c0380b7bd3
Python
11,841
346
"""Provider-independent discovery, native tool execution, and turn isolation.""" import json import sys from types import ModuleType import pytest from langchain_core.messages import AIMessage, HumanMessage from langchain_core.tools import tool from langchain_core.utils.function_calling import convert_to_openai_tool ...
e5c430db7af53255cdf8e9cc2ce3e045d808aa92152413b46dbb7d051f2b88f1
Python
11,845
352
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved """ COCO prediction dumper for distributed training. Handles collection and dumping of COCO-format predictions from models. Supports distributed processing with multiple GPUs/processes. """ import copy import gc import heapq import json import ...
11e52cddf32be47cdf1d148934de083c248b1c5b9e4cc9b068df53ba00e4d4ad
Python
11,846
291
# flake8: noqa import os import numpy as np from scipy.optimize import linear_sum_assignment from .. import _timing from ._base_metric import _BaseMetric class HOTA(_BaseMetric): """Class which implements the HOTA metrics. See: https://link.springer.com/article/10.1007/s11263-020-01375-2 """ def _...
8a029448bdb553ca5a3a6c2f1a77d44e401554b6205a3077e52403e249bd7f70
Python
11,846
270
# 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...
f8bd377ead1506f06c14e9b1ebe1fa60033a05ab6db5bfd972a44f4378fec038
Python
11,848
338
import logging from typing import List, OrderedDict import numpy as np import torch from scvi import _CONSTANTS from scvi._compat import Literal from scvi.distributions import NegativeBinomial from scvi.module import MRDeconv from scvi.module.base import BaseModuleClass, LossRecorder, auto_move_data from scvi.nn impor...