sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
d172bcb087f6f798301626b126bfb1f7d5a878422069ed7b4c713948e62677ce
Python
26,828
688
"""Stores class definition of ResearchObject and WritableBagFile.""" import datetime import hashlib import os import shutil import tempfile import urllib import uuid from collections.abc import MutableMapping, MutableSequence from pathlib import Path, PurePosixPath from socket import getfqdn from typing import IO, TYP...
b07ac647d64e6368bcea91c3c1d226c9f8a4f67a99f432c6b523071fde0040fc
Python
26,840
789
########################################################################################### # Elementary Block for Building O(3) Equivariant Higher Order Message Passing Neural Network # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) ################################...
38390942513613c2ab037daaf7ed3579c873573bdc1936e4863d8b6444cfa474
Python
26,851
795
"""Performs 2D non-linear alignment of sections to sections from reference volume using ANTs.""" import glob import json import logging import os import shutil import brainbuilder.utils.ants_nibabel as nib import matplotlib.pyplot as plt import numpy as np import pandas as pd from brainbuilder.qc.validate_section_ali...
8a2203a746716d66a10dfcdbab3a2480e8904e0ea54fb91759a27ddec8665191
Python
26,897
671
#!/usr/bin/env python # # Perform mathematical operations on images # # Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE import sys import pickle import gzip import argparse from typing import Sequence, Union import textwrap import numpy as np import spinalcordtoolbox....
c162a9f4e865ef55ec12fb5f097d10e966e0734db93c52acedad1645edb6b2a1
Python
27,024
683
# Third party inports import tensorflow as tf import tensorflow.keras.backend as K from tensorflow import keras import numpy as np import pdb as gdb import math import neurite as ne import voxelmorph as vxm import scipy.io as sio # batch_sizexheightxwidthxdepthxchan from scipy.signal import convolve2d def diceLoss...
1ce92a615d6eb6ca3e977858bbc513f8d4b4cf80a4829aef403c2de43cb69a0e
Python
27,030
637
from PyQt5.QtWidgets import QMessageBox, QDialog, QVBoxLayout, QLabel, QProgressBar, QApplication, QPushButton, QFileDialog, QHBoxLayout import json def print_error(s, extra_info="", severity=QMessageBox.Critical): dlg = QMessageBox() dlg.setWindowTitle("Error Message") if isinstance(s, tuple)...
d12897a3d8874642675b7eac5fd96b010017ac6e7d327f173ca9e0e794becee8
Python
27,060
569
import logging from typing import Any, DefaultDict, Dict, List, Optional, Set, Tuple, Union from io import StringIO from celery import shared_task from celery.utils.log import get_task_logger import time import csv import traceback from django import forms from django.conf import settings from django.core.exceptions ...
985b71c10d2285d1a2d703082b813c5ea4fe938efce126f416e11c063f706f18
Python
27,074
802
"""Built-in loss functions. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import abc import six from . import backend as K from .utils import losses_utils from .utils.generic_utils import deserialize_keras_object from .utils.generic_utils import seria...
17690918684372a1e0792f0d5bee4e34bbe0fd1dd37acbd414ad61ad784c3a48
Python
27,088
586
import torch import os import numpy as np import dgl import logging import datetime import math import sys import gc import json import time import torch.nn.functional as F import warnings from functools import partial from collections import OrderedDict from torch.utils.data import DataLoader try: from torch.utils...
c0de83f2844a5a42aef3d082ac18e259082afcff6eea88701dbc9b8e1c8b7ace
Python
27,112
751
import argparse import json import os import random import time import h5py as h5 import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.stats import seaborn as sns import torch from torch import nn, optim from torch.utils.tensorboard import SummaryWriter import nearl from nearl.io.datase...
fcf81f1fc19a321593f4aa4da51a2e10a5cf782e3fdf3274e1c69e0cf6d5ad14
Python
27,131
902
"""Utility objects and functions""" from __future__ import annotations from collections.abc import Callable from collections.abc import Mapping as MappingABC import copy import datetime from glob import glob import hashlib import json from json.decoder import JSONDecodeError import logging import os import os.path as...
31bfeb17ebc9a2ae358b89ae974eaba6b011a8e28a4eea264f8fad747fbea5c6
Python
27,174
795
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class BenchmarkTest(MedPerfTest): def generic_setup(self): # setup users bmk_owner = "bmk_owner" prep_mlcube_owner = "prep_mlcube_owner" ref_model_...
867adec38451e13b5e549f79dbe8e5f0b0f0b3e090c2d5c95d6c0ef287020b04
Python
27,196
750
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import (GCNConv, ChebConv, SAGEConv, GraphConv, TAGConv, ARMACo...
33111773c95fa026ec134a3876a42fa46e758198a2e7b1535c23f50fd121aebf
Python
27,202
940
import os import sys import pyabf import paq2py import numpy as np import pandas as pd import seaborn as sns import scipy.interpolate from utilities import * import matplotlib.pyplot as plt from scipy.stats import linregress from scipy.signal import find_peaks from scipy.optimize import curve_fit #~~~~~~~~~~~~~~~~~~~~~...
d09edb8e0aa446ac90296263f5f69f76bc3f424861300ab7bf358ff1c311a8f8
Python
27,205
649
# coding=utf-8 # Copyright 2021 The IDEA Authors. 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 a...
45d3dd005d3605adac7648bcf92cc94cf476fc08eb5c17de4eee2a437ebbcfe3
Python
27,214
481
""" Automation logic for batch processing analyses across multiple sessions. """ import json import os import pandas as pd import numpy as np from .backend import DataInstance from .shuffling import shuffle_cofiring, shuffle_advanced from .exploration_statistics import generate_general_statistics, generate_local_stati...
7e4c1690508fd82a90856558a4c3db1ed04d408a0e988a307f2a22bbccfc2318
Python
27,220
563
# Provided by the FeTS Initiative (www.fets.ai) as part of the FeTS Challenge 2022 # Contributing Authors (alphabetical): # Patrick Foley (Intel), Micah Sheller (Intel) import os import warnings from collections import namedtuple from copy import copy import shutil from logging import getLogger from pathlib import Pa...
1b82dbe1be95efeec23c5a39a5109cef3bce80da9c982f377e8b4df487f50188
Python
27,288
548
# Copyright (c) OpenMMLab. All rights reserved. from mmengine.utils import is_str def cityscapes_classes(): """Cityscapes class names for external use.""" return [ 'road', 'sidewalk', 'building', 'wall', 'fence', 'pole', 'traffic light', 'traffic sign', 'vegetation', 'terrain', 'sky', ...
0e4b73f911e2e4ba724a9121b618cfbc6418c9da07f845bb49ce141b0b57bde0
Python
27,294
730
import torch import torch.nn as nn import torch.optim as optim from torch.optim import Adam,AdamW from torch.optim.lr_scheduler import ExponentialLR, StepLR, LinearLR import torch.nn.functional as F import torch.nn.init as init import matplotlib.pyplot as plt import torchvision from torchvision.transforms import tran...
6042e7ca54b71876ffd9e488d2030aebf8207cc195b55aec3f4ac4fb6e548699
Python
27,308
501
# This file is part of the Firmware project to interface with small Async or Neuromorphic chips # Copyright (C) 2023-2024 Ole Richter - University of Groningen # Copyright (C) 2024 Vincent Jassies - University of Groningen # # This program is free software: you can redistribute it and/or modify # it und...
31365b03dee32ab331975bee3fd54287c66829a53cb1d6bccb91efeb2cb75694
Python
27,316
639
# 3D visualization in MagellanMapper import math from time import time from typing import Any, Callable, List, Optional, Sequence, Tuple, TYPE_CHECKING import numpy as np from skimage import filters, restoration, transform from magmap.cv import colocalizer, segmenter from magmap.io import libmag from magmap.plot imp...
c0a94a662cb77edcfd7c03afc4905ecdfe0b947f5a1f63aa2e42e5e1be431bce
Python
27,350
668
import numpy as np from dataset import * from surrogate_model import * from collections import namedtuple from abc import ABC, abstractmethod from collections import defaultdict import math import random import copy dataset = NasBench('./nasbench_dataset') CONV3X3 = 'conv3x3-bn-relu' CONV1X1 = 'conv1x1-bn-relu' MAXPO...
0db7fcc879e9f0fdc98edb130a13363bb694d75c8dbd59fb838c8894749655c9
Python
27,379
1,022
import subprocess import sys import os from io import StringIO, BytesIO import dnaio import pytest from cutadapt.cli import main from utils import assert_files_equal, datapath, cutpath # pytest.mark.timeout will not fail even if pytest-timeout is not installed try: import pytest_timeout as _unused except ImportE...
99b1ebd8a20777dd54bab572c2ee546ebc868f1d4e5862fa3c742fb075317b1a
Python
27,390
670
import numpy as np def get_uniform_mass_bins(probs, n_bins): assert(probs.size >= n_bins), "Fewer points than bins" probs_sorted = np.sort(probs) # split probabilities into groups of approx equal size groups = np.array_split(probs_sorted, n_bins) bin_edges = list() bin_upper_edges = list(...
04787acf87c73351585a49e591d2ba516fc607484031fa60e5c7d1c73846b52d
Python
27,404
736
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Conv1d, Linear, Module, ModuleList, Sequential from torch_geometric.nn import knn_graph, radius_graph from torch_scatter import scatter_softmax, scatter_sum from models.common import MLP, NONLINEARITIES, GaussianSmearing class No...
6669af750f3f7f3f90d00d8dca911924f09739578bba83c0e2c90d11bc01ed05
Python
27,475
663
"""CLI for the per-source impact report. Invocation: uv run source-impact-report --source EMAPA uv run source-impact-report --source GARD --concord GARD --concord GARD_label The CLI discovers where the source contributes (across one or more pipelines), runs a synthetic re-glom with and without the source for ...
8b90189b32bcb75b805a3d0b41e3db90107bf9819b473a7eae5e709fc408101c
Python
27,501
705
# -*- coding: utf-8 -*- from datetime import timedelta, datetime from dateutil import parser as dateparser import io import logging import numpy as np import pytz from typing import Any, Dict, List, Tuple from django.db import connection from django.http import HttpRequest, HttpResponse, JsonResponse from django.shor...
2723a08208ef451e8ea573fe8959a4082dab2cc2b6485aec016bba2c5167c9dc
Python
27,514
640
# coding=utf-8 # Copyright (c) 2019, NVIDIA CORPORATION. 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 re...
d0016c7dc11db849e6c65924a40af38887f021e04a57638755923d4137110ecd
Python
27,556
660
# coding=utf-8 # Copyright 2021 The IDEA Authors. 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 a...
130314a3c61bbace90bfbaa26c2ee49369113d2930993a1ca0dad8bc6e0d1cc9
Python
27,570
646
import torch import torch.nn as nn import torch.nn.functional as F import math import torch_geometric import copy from .activation import ( ScaledSiLU, ScaledSwiGLU, SwiGLU, ScaledSmoothLeakyReLU, SmoothLeakyReLU, GateActivation, SeparableS2Activation, S2Activation ) from .layer_n...
fc48971c2edcf2dd6c7030f29cebb525ad7d84b1c9fcb342dd9d84c86b86f036
Python
27,576
587
#!/usr/bin/env python # Functions for ICA-AROMA v0.3 beta from __future__ import division from __future__ import print_function from future import standard_library standard_library.install_aliases() from builtins import str from builtins import range from past.utils import old_div import numpy as np def runICA(fslD...
1d34b0375ba905da339543a11f49bb46c6c1885fff32b14f6e8dc866e3df7190
Python
27,586
611
from PyQt5 import QtGui, QtWidgets, QtCore import pyqtgraph as pg import numpy as np from copy import deepcopy from scipy.signal import savgol_filter from scipy.optimize import curve_fit from util.conf import sd_params, bd_params from util.functions import movingAverage, func_exp from features.Feature import Feature ...
5f74e27ef948b37441010cede4e7a6d40aa801a8cd4c4c21dfd3c2116592fa31
Python
27,640
619
import numpy as np from copy import deepcopy import torch from torch.backends import cudnn from torch.cuda.amp import GradScaler, autocast from torch.nn import Identity from nnunet_mednext.network_architecture.generic_UNet import Upsample from nnunet_mednext.network_architecture.generic_modular_UNet import PlainConvUN...
3dc421573f38bc0b20740aabaed1a493889671ab249f5b968c746c72891e03a8
Python
27,678
933
# tests/test_resilience.py """Red-phase tests for JobManager resilience features. These tests verify the planned resilience behaviors: - Fatal errors (404 / PermissionError) trigger immediate exit - Transient errors (ConnectError) are tolerated up to max_unreachable_seconds - disconnect() is idempotent, thread-safe, a...
ac0f3416ca1038f2a5a46bff59955763cb5c52623266a9e60875369ae269fe58
Python
27,682
790
# -*- coding: utf-8 -*- # encodermap/__init__.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encodermap is free s...
2ae11b5a1206a39c5abf585c34aa7f2e41ca7e185b5a18335bdd9ca14afcb796
Python
27,739
655
#%% import numpy as np import os # import nibabel as nib import pandas as pd import joblib import time from sklearn.preprocessing import StandardScaler from sklearn.svm import LinearSVR, LinearSVC from sklearn.model_selection import (train_test_split, cross_val_score, KFold) from scipy.optimize import linear_sum_as...
ea2b5fce3109ff01b7ad9013e00b677e34c56b81d89b6d31aba03a329d6e9538
Python
27,760
597
"""Shared parsers for Babel SLURM run artifacts. Three kinds of artifact are produced by a Snakemake-on-SLURM run and copied into a run-analysis directory such as ``data/babel-1.17/``: - ``benchmarks/<rule>.tsv`` — Snakemake ``benchmark:`` output (actual usage). - ``reports/slurm/slurm_efficiency_reports/`` — the...
81582943b47e7598c851943c676e5fc2d81ec4066e627be3643936dfb7db2b01
Python
27,772
850
""" 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. --- This code borrows heavily from the DimeNet implementation as part of pytorch-geometric: https://github.com/rusty1s/pytorch_geometric. Licens...
3d230e728974334ab622ef2534f19401e77e41a6d4a570639c09630fa1c1e6de
Python
27,784
729
from collections import namedtuple import torch from Utils.models import * import numpy as np import datetime import pandas as pd import xlsxwriter from sklearn import metrics import time import shutil import os import wandb from Utils.dataloader_RSNA_BONE import * from Utils.config import loaderConfig from torch_lr_fi...
240c1f223d28afddabffbfdd6b101576de2264588b8f753336ff44be0911cefa
Python
27,832
744
import copy import psutil from itertools import combinations from numpy import linalg as LA from IPython import embed from abc import ABCMeta, abstractmethod from pathlib import Path from collections import deque from typing import Dict, List, Callable import math import time import mcmc from ray_model import MuscleNN,...
2d33c66b5dc5770998708f0ce7009fbd6168dbe9e4cd2cd2acc67dc01de3a253
Python
27,919
661
from __future__ import print_function from future import standard_library standard_library.install_aliases() #from builtins import str from quantities.quantity import Quantity import sciunit from sciunit import Test,Score try: from sciunit import ObservationError except: from sciunit.errors import ObservationEr...
d587137e0cae96ab6977c989155975cdfaf061b630b5ebe1505e1c38f60727e0
Python
27,919
928
import re import yaml import h5py import numpy as np import pathlib as pl from datetime import date from types import SimpleNamespace from scipy.interpolate import interp1d as interp from myphdlib.interface.ephys import Population class SessionBase(): """ """ def __init__(self, home, eye='left', loadEphys...
b2a526b9f98a051b6bbc84dd1a40510c187c7dd28243492a8ba7ab6c601eb6db
Python
27,927
943
# Config file for shared settings # Author: David Young, 2017, 2020 """Configuration storage module. This module allows customization of settings for various imaging systems, such as grouped settings for particular microscopes. Additional parameters such as command-line flag settings and databases can also be stored...
88f74748615d58f43ac6177ebd8f7d3f78b3fd3200ca411d3543fcdab12fddba
Python
27,959
795
"""Validate interpolation error by comparing original autoradiographs to 2D and 3D interpolated autoradiographs.""" import os import brainbuilder.utils.ants_nibabel as nib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from brainbuilder.utils.utils import shell from joblib...
3d40e2eabb9cdb7b164e89678b7e7be455819b7a5816a6cb721859060fd111e0
Python
27,972
656
# -*- coding: utf-8 -*- # encodermap/callbacks/callbacks.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encoderma...
b02e5d1ab8b6ee1126050e8102e37b8c8bdc4e54f5d7f101b7efd15478e25476
Python
28,011
684
from collections import namedtuple import torch from Utils.models import * import numpy as np import datetime import pandas as pd import xlsxwriter from sklearn import metrics import time import shutil import os from Utils.dataloader_BrainTumorMRI import * from Utils.config import LoaderConfig, ModelConfig from torch_l...
28660f96ce6206b4a01f4dd41c19c9a83760c119c4eee7393a27cc028b881ddd
Python
28,030
634
#!/usr/bin/env python # # Perform operations on images # # Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE import os import sys from typing import Sequence import textwrap import numpy as np from spinalcordtoolbox.scripts import sct_apply_transfo, sct_resample from sp...
ccb6acb60e1067139978f1345f275096577aae982b26784e7e6ab25faf933ff7
Python
28,064
693
import numpy as np from torch_geometric.data import Data import math def PublicPST_GNN(env, *args): ''' The state function for the GNN model. It returns the state of the environment in a format that can be used by the GNN model. ''' PublicPST_GNN.node_sizes = {'ev': 6, 'cs': 4, 'tr': 2, 'env...
bb1ac2e9c89bbf8ee197ed7bafb9c00368e797d3fddd1c1b7068ac95cbbb7ca8
Python
28,102
1,240
import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('Datasets/url dataset/phishing_site_urls.csv') print("Unique values in 'Label' column:", df['Label'].unique()) df['new_label'] = df['Label'].apply(lambda x: 'Non-Phishing' if x == 'good' else 'Phishing') original_counts = df['new_label'].value_c...
3bc227d33ef79e51ce8c840abb63a010a8d9403474b78eb84196286c516da66d
Python
28,125
663
#%% import scipy.io as sio import numpy as np from custom_functions import dat_prep_4d_section,dist_theta_kfold,circ_dist,circ_mean from scipy.ndimage import gaussian_filter1d import matplotlib.pyplot as plt import pickle import seaborn as sns import pandas as pd import os import mat73 import matplotlib as mpl dat...
d082cdebde4e0472cca053550e85698842cd7a84bafda72c6f97ad5b9c17fde5
Python
28,137
820
import os, shutil, subprocess, importlib, re, pickle, math, array, fcntl, time, random, math, time import numpy as np import matplotlib.pyplot as plt import urllib.request from glob import iglob from glob import glob from pathlib import Path def objtoarr(path, symbol="v"): dicts={"v": "Vertices", "s": ...
5718c5c177d6f1a7d5f44e319bf7cbdd449bfbde5ea1d8e8cdb4ac68e937207a
Python
28,244
836
# This file is part of the Firmware project to interface with small Async or Neuromorphic chips # Copyright (C) 2022-2023 Ole Richter - University of Groningen # Copyright (C) 2024 Vincent Jassies - University of Groningen # # This program is free software: you can redistribute it and/or modify # it und...
1167f5a27a30c1b7b9ed417e4309ea4093e72733b29cb7e72ef82feed8ab978c
Python
28,254
645
''' Trains CFRNet model. Causal modelling approach. Similar to VGAE + MLP join training in train_jointly.py, but uses two MLP heads, for predicting each treatment condition separately. Authors: Hanna M. Tolle Date: 2025-04-16 License: BSD 3-Clause ''' import sys sys.path.append('graphTRIP/') from sacred import Exper...
993e205ce43319a5c8ae53bfdd5897ca8f586c19e730469d8372c0b1b00bddb1
Python
28,301
793
from enum import Enum import os import pandas as pd import numpy as np import collections.abc from typing import Dict, Union, List, Tuple, Optional, cast import math import re import torch from torch.utils.data import Dataset from torch_geometric.utils.smiles import from_smiles from torch_geometric.data import Data fr...
939dfa8a97878f17a3bf16d250c15799831f4c52a6238ea40706f54390dc4723
Python
28,315
744
""" KGX Validator class """ import re from typing import List, Optional, Dict, Set, Callable import click import validators from bmt import Toolkit from kgx.error_detection import ErrorType, MessageLevel, ErrorDetecting from kgx.config import get_jsonld_context, get_logger from kgx.graph.base_graph import BaseGraph f...
14a3d2882db357ad3271e6eababf5c0671cf8797af30c3bb96ea3deac0f2a534
Python
28,317
955
"""Integration tests for the ZnDraw Python client. These tests verify client functionality against a running server. The ZnDraw client works with ase.Atoms objects as frames. """ import uuid import ase import httpx import pytest from zndraw import ZnDraw def make_atoms(positions: list[list[float]], symbols: str =...
d82151b649300e8df5bf331666a2aad7b3ad47c6820676827f228a2ad3eaec6d
Python
28,346
763
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN, build_dropout from mmengine.model import BaseModule from mmengine.utils import to_2tuple from mmseg.registry import MODEL...
c815e7c8a01e2f10c72a29862074cc4173f07d7f37b6b880dcdf283abed64859
Python
28,404
696
''' BrainGraphDataset class for loading and processing brain graph data. License: BSD 3-Clause Date: 2024-10-30 Author: Hanna M. Tolle ''' import sys import os import numpy as np import pandas as pd from tqdm import tqdm import torch from torch_geometric.data import InMemoryDataset, Data from torch_geometric.utils i...
148e9f8101462e683a242098b578e1b680e1fb337bb2c45edcd5339a55705892
Python
28,417
830
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # pyre-strict # pyre-ignore-all-errors[2,56] import logging import typing import unittest import warnings from collections import Counter from typing import Any, Dict, List import torch import torch.nn as nn from fvcore.nn.flop_count import FlopC...
41cc9e15f4c296f4d17412e3c2167b827fa4f34b92cca1d75692c315c5de0a6c
Python
28,453
841
import h5py import numpy as np from matplotlib import pyplot as plt from scipy.signal import find_peaks as findPeaks from matplotlib.colors import LinearSegmentedColormap from myphdlib.general.toolkit import psth2 from myphdlib.figures.modulation import BasicSaccadicModulationAnalysis from myphdlib.figures.analysis imp...
682abf2fbb46891e7df23b034aa8f9d00ad493fb1cfa7b441c24b5a0fd961ac9
Python
28,459
860
# dicom operations from __future__ import annotations from collections.abc import Callable import datetime import logging import os import os.path as op from pathlib import Path import sys import tarfile from typing import ( TYPE_CHECKING, Any, Dict, Hashable, List, NamedTuple, Optional, ...
e2edf59c5276517bcb7f76a47c8942bd18b47d98590087794d2a0b2eeb6fa614
Python
28,462
670
import json import logging import shutil from collections.abc import Callable from pathlib import Path import holoviews as hv # noqa: F401 import numpy as np import panel as pn from guppy.extractors import ( CsvRecordingExtractor, DandiNwbRecordingExtractor, DoricRecordingExtractor, NpmRecordingExtra...
d7517cf3d34be1e85da9eb8e8ab3e402522d11c42056fb55ca809ba84c0b8627
Python
28,515
750
# Main script for MEA analysis # Takes pre-processed HDF5 files and exports Matlab files for further processing. # Last modified : 2022.02.22 (Run selection shortcut = Ctrl + Shift + E) ## ------------------------ # Import packages # ------------------------- import numpy as np import scipy.io import scipy.signal as...
e74b0b261ac00fdb9f84f2806690dc7707da862e90c0020a7d6ea1fe7f33f886
Python
28,565
693
from typing import Any, Dict, List import hydra import numpy as np import omegaconf import pandas as pd import torch import pytorch_lightning as pl import torch.nn as nn from pymatgen.core import Structure from torch.nn import functional as F from torch_scatter import scatter from tqdm import tqdm ...
732572d07420084737a68f6d5907f630714d6940243f5bb4916875a7eadf32e6
Python
28,587
725
""" Author : Alexis Lebrun (PhD student) School : Université Laval (Qc, Canada) This module provides funtions to generate new spectra by adding different variations to existing spectra. """ import numpy as np from sklearn.utils import shuffle def _range_converter(param_range, multiplier_cond=False): """ Ret...
520d4833281115edc57dd36b1dc7e0a9c840b210e23131f8e3ca582efd9e8e81
Python
28,609
742
import json import logging import os from collections import namedtuple from io import StringIO from uuid import uuid4 from prov.constants import PROV_ATTRIBUTES, PROV_MENTION, PROV_BUNDLE, PROV_LABEL, PROV_TYPE from prov.model import ProvDocument, ProvEntity, ProvBundle, ProvRecord, ProvElement, ProvRelation, Qualifi...
1157e3a46cb602124f34c2ade67d16b6f77b12a9a8bcc6e88f431878f3b62298
Python
28,648
873
import os from typing import List from pprint import pprint import pytest from kgx.utils.kgx_utils import GraphEntityType from kgx.transformer import Transformer from tests import RESOURCE_DIR, TARGET_DIR from tests.integration import ( DEFAULT_NEO4J_URL, DEFAULT_NEO4J_USERNAME, DEFAULT_NEO4J_PASSWORD, ) ...
0e69bbcc3f98a43bebe7a43aff690cbde80aa7641d89d94ae8d366f39aaa4ed3
Python
28,649
748
import os import pdb as gdb import nibabel as nib import numpy as np import freesurfer as fs import tensorflow as tf from tensorflow.python.eager.context import context, EAGER_MODE, GRAPH_MODE from tensorflow.keras.callbacks import Callback from shutil import copyfile def switch_to_eager(): switch_execution_mode(...
6ffdcdd818cdaa0780aa804d10ef8613fd5436573e1575321599fdc56a3c6671
Python
28,693
678
# coding=utf-8 # Copyright 2021 The IDEA Authors. 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 a...
cff9b4faf9ac8ce92c351731f73f546312bbcf9aeb80ab6652e02f4155646849
Python
28,723
717
import multiprocessing import pickle import csv import os import sys import numpy as np import sklearn.model_selection as ms import torch import time from torch.utils.data import TensorDataset from tqdm import tqdm from transformers import AutoTokenizer, AutoModel from layers.embedder import PackedBert from argparse i...
51ce92c7593bcf68099e4b865b22e210883046208a827e86a4d77e6395a5d278
Python
28,745
758
from collections import namedtuple import torch from Utils.models import * import numpy as np import datetime import pandas as pd import xlsxwriter from sklearn import metrics import time import shutil import os import wandb from torch_lr_finder import LRFinder METRICS_LOSS_NDX = 0 METRICS_TP_NDX = 1 METRICS_FN_NDX =...
6caaa5ecf33e40db7ad237c3bd7db416d2e0243dd4cf3871da788c592257801d
Python
28,770
878
"""Tests for Trajectory REST API endpoints (download/upload + download tokens).""" import io from typing import Any import ase import ase.io import numpy as np import pytest from asebytes import decode, encode from helpers import auth_header, create_test_room, create_test_user_in_db from httpx import AsyncClient from...
6cfcd32eedb83e268cb6104abea795020d58cf41a02674619f8e0b828fe10add
Python
28,780
728
import copy import math from typing import List import torch import torch.nn as nn import torch_geometric from .activation import ( GateActivation, S2Activation, SeparableS2Activation, SmoothLeakyReLU, ) from .drop import EquivariantDropoutArraySphericalHarmonics, GraphDropPath from .layer_norm import...
c128f8a1e015acdffe7a29e21ee015b032d6ded56b4287a652ed9eba61b8c4b8
Python
28,783
768
import pandas as pd import numpy as np import os from tqdm import tqdm from scipy.stats import pearsonr import matplotlib.pyplot as plt import seaborn as sns import sys import warnings import textwrap def load_phenom(y_group="_miller_mh_v1", BASE_FOLDER='/Users/karinsaltoun/Documents/UKBB_files'): ...
9302d7c7b5f972b833dbe96f29e596bc91ce5a5941430aef9f283133ba2b3005
Python
28,861
734
from collections import namedtuple import torch from Utils.models import * import numpy as np import datetime import pandas as pd import xlsxwriter from sklearn import metrics import time import shutil import os import wandb from Utils.dataloader_COVID import * from Utils.config import loaderConfig from torch_lr_finder...
ddc266ef5f998d7d3b4f957ddf9f853184c1ffb4fbad29e6c0036c0a0fcc63e1
Python
28,863
783
import copy from typing import Tuple, Optional, Dict, List, Any, Set, Union import networkx as nx from ordered_set import OrderedSet from kgx.config import get_logger from kgx.graph.base_graph import BaseGraph from kgx.utils.kgx_utils import ( get_prefix_prioritization_map, get_biolink_element, get_biolin...
e6acd2ea78e07706f6e2c0a0576fa8494bebac9bb10e5f96269fa56a18a7d567
Python
28,916
687
import json from pathlib import Path import holoviews as hv import numpy as np import panel as pn import pytest from guppy.analysis.io_utils import fetchCoords from guppy.frontend.artifact_removal import load_pair_traces from guppy.frontend.artifact_windows_page import ( CONTROL_TRACE, FIT_TRACE, MARK_MOD...
a006bd595cfc78e9e9dc4d8a89c7888a11f5e5455f0591d2d628d0a4c5b215e0
Python
28,947
682
#!/usr/bin/env python # # Parser for PropSeg binary. # # Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: remove temp files in case rescaled is not "1" import os import pathlib import sys import logging from typing import Sequence import textwrap import numpy a...
8cf070fd0cf71fb283cec5dc3f3a5dc10452f378a397b50f7ae13f4565afd40c
Python
28,984
899
import os import matplotlib.pyplot as plt import nibabel as nib import numpy as np import pandas as pd import seaborn as sns from joblib import Parallel, delayed from scipy.ndimage import gaussian_filter from skimage.transform import resize from brainbuilder.utils.utils import get_logger logger = get_logger(__name__...
1a2d9485ec263163da69a3214400eb53eaa056bb433735def69c98d9022c536c
Python
28,990
688
# Copyright (c) OpenMMLab. All rights reserved. from typing import Any, Dict, List, Optional, Tuple import numpy as np import torch from mmengine.runner.checkpoint import load_checkpoint # yapf: disable from sam.utils import (MaskData, area_from_rle, batch_iterator, batched_mask_to_box, box_xyxy...
b403ce4c51987af8f2e7bdbcf8bf3b9bdda3b6d362eb12b719c92c3282b29664
Python
29,026
740
from collections import namedtuple import torch from Utils.models import * import numpy as np import datetime import pandas as pd import xlsxwriter from sklearn import metrics import time import shutil import os import wandb from Utils.dataloader_GRAZPEDWRI import * from Utils.config import loaderConfig from torch_lr_f...
682ec1cf3915ae8491d8fcfa5dfe879f5ee5b9c6c456419d5a54160bee681fcc
Python
29,031
937
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # pyre-strict # pyre-ignore-all-errors[2,3,14,53] import typing import unittest from collections import Counter, defaultdict from typing import Any, Dict, Tuple import torch import torch.nn as nn from fvcore.nn.flop_count import _DEFAULT_SUPPORTE...
c9a1b95fa60a6938aa28fc6892673dc20fd31941036e430a8c1af63398e13e6d
Python
29,076
675
import logging import math import os import shutil from pathlib import Path from typing import Any import numpy as np import pandas as pd from numpy import float32, float64, int32, int64, uint16 from guppy.extractors import BaseRecordingExtractor from guppy.utils._hdf5_io import write_hdf5 logger = logging.getLogger...
708334ed2ba44b2f116274382d3d865321a9dff9201fa80be39b95a396cd259a
Python
29,079
672
from ray.tune.utils import validate_save_restore from itertools import combinations import importlib from IPython import embed import mcmc import argparse import numpy as np import json import pickle import os from pathlib import Path from typing import List, Tuple, Dict from ray_model import SimulationNN_Ray, load_fro...
d7bdf29558fb7c3e6503607b3279a0dc4c811ac130e99417831537e0e5e63e33
Python
29,089
618
"""Tests for the release-note drafting script (``releases/scripts/draft_release_notes.py``). Covers the two parts that are easy to get quietly wrong: which PRs are folded away as routine, and the number formatting in the `Summary of changes` table (a dropped `\\-` escape or a mis-shaped from-zero row is invisible unti...
9be479cc97d00a7d6b3c5a67aef180b81e698e96f4df2a12f40d18e4d860b50a
Python
29,096
799
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 2 16:32:14 2023 @author: george """ from .io import FileSelector_overlay from .helperFunctions import * from pyqtgraph import HistogramLUTWidget from qtpy.QtCore import * from qtpy.QtGui import * from qtpy.QtWidgets import * import numpy as np imp...
e0edcfda7cc394a91303e60a48a12acc093042643ddf12dc8a9a831ec8ceac6d
Python
29,154
688
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 4 12:18:02 2023 @author: schwab """ from Bio.PDB import PDBParser, MMCIFParser import numpy as np import torch from .utils_new import* import mrcfile #from emda import emda_methods def pdb2graphs(name): O_e = 8 N_e = 7 C_e = 6 ...
f79dba1aa7032893a14b5e18113a863fa631c9bb569d3599070c6de6d11e8630
Python
29,186
762
""" Esophageal Peristalsis Model ============================ Python translation of EsophagusModel.nb (Mathematica 13.3) Model description ----------------- Simulates esophageal peristalsis using three coupled variables per spatial lattice point: u : ENS (Enteric Nervous System) neural activity v : ENS recovery v...
b20ef0b6d058f9c1f50ff60fa7f2cfd33e33496aa79b3391809f040ee848d8f1
Python
29,264
637
""" Functions dealing with metrics aggregation (mean, std, etc.) across slices and/or vertebral levels Copyright (c) 2019 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ # TODO: when mask is empty, raise specific message instead of throwing "Weight sum to zero..." import os import num...
b93cf13a5955df047ad6ac90bfd041ed8d21c3f283c5ee01f7d8d8174bbce69d
Python
29,308
721
# -*- coding: utf-8 -*- import torch import numpy as np import torch.nn.functional as F import math import torch.nn as nn import torchvision import kornia.filters as KF # from loss_ssim import ssim shape = (256, 256) import torch import torch.nn.functional as F from torch.autograd import Variable import ...
37490f8c942f9f8e08b2f700ad8a09f32c2d90c383c2597c9ec2b971ef41fb21
Python
29,353
861
# src/zndraw_joblib/client.py """Client SDK for ZnDraw JobLib workers.""" import json import logging import random import signal import threading import time import traceback from abc import ABC, abstractmethod from collections.abc import Callable, Iterator from dataclasses import dataclass from enum import StrEnum fr...
bf6a5165c218e8141f572c8b45d80c60cf4d8120d6939db1d4dae0fa66fa9b5a
Python
29,356
868
import sys import os import numpy import pdb from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation, Flatten #from keras.layers import Input, merge, LSTM from keras.layers.normalization import BatchNormalization from keras.layers.advanced_activations import PReLU from keras.utils i...
91863d0a6cce3e476515d896fbdba4825c645ade025737c018c6d4951cb32a25
Python
29,401
815
# Copyright (c) 2021 EleutherAI # This file is based on code by the authors denoted below and has been modified from its original version. # # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
273265c8c664c877250e3d52f4bdd093d2f3d40ab74682e33ef697a3ae8a0392
Python
29,405
735
import os import sys # sys.path.insert(0, f'{PROJECT_DIR}/guided-diffusion') # 加在前面,不再读取库文件的东西。 import subprocess import io import torch.nn as nn from torch.nn import functional as F import torch import torchvision.transforms.functional as TF import torchvision.transforms as T import math import requests import cv2 f...
48490397526374c58c1e0e023036cbee5b7aab165ef2260b85ae0f3b29798778
Python
29,487
894
"""Create GM volume from segmented images.""" import json import os import re import shutil from glob import glob import ants import imageio.v3 as iio import numpy as np import pandas as pd import SimpleITK as sitk import torch from joblib import Parallel, delayed from skimage.filters import ( threshold_li, th...
7b102589748fcb289919e2fec7154e899e9e4e22f83375efdb8f852390ab5c71
Python
29,514
1,160
""" MetaWIBELE: utilities module Utilities relating to third party software, file permissions, and file formats Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal ...
2aabfe798bcfca30425b5fdb97a8ac803db56a00c9a57d47d843fd33c3acab87
Python
29,523
695
"""Command line builder.""" import copy import logging import math from collections.abc import Callable, MutableMapping, MutableSequence from decimal import Decimal from typing import IO, TYPE_CHECKING, Any, Optional, cast from cwl_utils import expression from cwl_utils.file_formats import check_format from cwl_utils...
6fe8f21d6176c3da270e7f7ae265aa8acb300dafc2dc7d6b04bd2c7536614a53
Python
29,561
1,774
# Part of the following data is extracted from https://periodictable.com/ # Frames per slice that the CUDA kernels can aggregate. Mirrors MAX_FRAME_NUMBER # in src/constants.h. Frames map to blockIdx.y, so this is the CUDA grid limit # rather than a buffer size; beyond it the kernels raise instead of truncating. MAX_F...
9b0da21d343776935e3c689c2a6a5ab6cdca2ba454768e521bb5df51659af141
Python
29,584
892
# Copyright (c) ByteDance, Inc. and its 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. """ Mostly copy-paste from torchvision references or other public repos like DETR: https://github.com/facebookresearch/de...
f05acaf9e6b49da6f3e206b9a630e6ef7955ebfe2e4fdc01e96b630c90676397
Python
29,677
611
""" This scripts performs all post-hoc interpretability analyses. Dependencies: - experiments/outputs/graphtrip/weights/seed_*/ - experiments/outputs/graphtrip/grail/seed_*/ - experiments/outputs/graphtrip/regional_attributions/seed_*/ - same for medusa model Outputs: - experiments/outputs/grail/posthoc_analysis/ - e...