sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
98f4d30035a9e6e8234655645a0509e127793fb68247d6e427e09bdef15a8239 | Python | 15,625 | 493 | from math import isclose
from typing import TYPE_CHECKING
from unittest.mock import patch
import pytest
import torch
from torch.optim import SGD, Adam
from torch.optim.lr_scheduler import ReduceLROnPlateau
from eir.train_utils import lr_scheduling
from eir.train_utils.ignite_port.contrib_handlers.param_scheduler impo... |
1fa403e0cc382993b3cd41b029d2feb2fa98eeda86dea589fd3db730fc9319e5 | Python | 15,629 | 374 | import numpy as np
import pandas as pd
import scanpy as sc
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import cm
import seaborn as sns
from joblib import Parallel, delayed
from numpy.random import default_rng
from numpy import random
import scipy
from scipy.stats import pearsonr, ttest_ind, mod... |
530b04d77b78e511d224ee7b2f6bd8b0d579606af816f6ce784c4dfae0723532 | Python | 15,637 | 346 | #!/usr/bin/env python
# author: Jannes Spangenberg
# e-mail: jannes.spangenberg@uni-jena.de
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import read5_ont
import pysam
import seaborn as sns
import sys
from argparse imp... |
ad0a02748c142a0d0903989d3e5905732ed4a19d57cdb7a8c597081aa03dc490 | Python | 15,641 | 443 | """
This script contains code for computing the "attention", which is the same as
P(gaze) reported in the paper.
"""
import sys
import os
import numpy as np
import pandas as pd
import json
from copy import deepcopy
from utils.LoadSession import findrootdir
def find_closest_indices(t_box, t):
"""
For each ti... |
5740b6d9892fded01cd03c92599516fb16697c0b56c9443ca856f1464c9f863f | Python | 15,646 | 391 | import glob
import os
import sys
from argparse import ArgumentParser
import numpy as np
import torch
import torch.utils.data as Data
from Functions import generate_grid, Dataset_epoch, transform_unit_flow_to_flow_cuda, \
generate_grid_unit
from miccai2020_model_stage import Miccai2020_LDR_laplacian_unit_disp_add_... |
d8f3a3b06c3bea80db89f0aaf21807e7bbee256fcfb839e6098967e7f0f4e494 | Python | 15,650 | 381 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import re
import subprocess
import sys
import types
from pathlib import Path
from shutil import which
import numpy as np
import torch
from ultralytics.nn.modules import Detect, Pose, Segment
from ultralytics.utils... |
781117c7186551f2082d3f851cc3a7c67d36f04e7131b8ef06ecf8b15af6b51c | Python | 15,651 | 433 | """
Defining ROI masks for all digits. This is done in several steps:
- Select voxels from activation map based on threshold. Here, we chose half the
maximum z-score as cut-off
- Propagate active voxels across cortical depth using LayNii's UVD filter
- Remove floating bits that might occur in the process
- Combine ROI... |
fa4ac1239a1238cc4fa1a1404d4295ceea3a133fd27460ce3c8f7d81e26329c2 | Python | 15,651 | 339 | import h5py
import numpy as np
import os
import re
SOURCE_TAGS = ['CE', 'CD']
SOURCE_TAG_TO_ONEHOT = {
tag: np.eye(len(SOURCE_TAGS), dtype=np.int8)[i]
for i, tag in enumerate(SOURCE_TAGS)
}
def extract_suffix(group_name):
""" Extract the last part of the group name after the last ':' """
return group_... |
bfedf3f3c2857ed30654362e4814ad4a3cef1475a8f99f5b3f73e889c657d7dd | Python | 15,652 | 301 | # This is the garching script merges raw results and delay/z results from many batches into one file
# padded with -1 for jagged arrays. Run in serial (do not parallelize due to need to open same files simultaneously)
# --
import argparse
import numpy as np
import h5py
import pathlib
from time import perf_counter
# Pa... |
4660434cf42beda93632bc8cf3d061b5ec33c2113ce9a0adbf7ae6bff729f5c0 | Python | 15,660 | 372 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Maximilian Betz
#
# 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 Li... |
e9c116151e564fe7644215168e8bc86d4f7cab65847f3c457d9638bf8c085045 | Python | 15,668 | 270 | from train_AE import init_from_config
from train_voice_identity_clf_from_brainvoice_z import fit_clf
from brainvoice.models.utils import load_model_checkpoint
from brainvoice.data.estimates_loader_utils import load_beta_estimates, load_estimate_labels
import pandas as pd
from tqdm import tqdm
import torch
impo... |
04651fd201df769eb266faffb2a1a8b24c02c81ebd0f6cbec7a67917b6a8f245 | Python | 15,675 | 545 | import numpy as np
import time
from langchain_core.tools import tool
from chemgraph.models.atomsdata import AtomsData
from chemgraph.models.ase_input import (
ASEInputSchema,
ASEOutputSchema,
)
def create_ase_atoms(atomic_numbers, positions, cell=None, pbc=None):
"""Create ASE Atoms object from atomic num... |
16f321dad2892cd2ad2165994a0ec2661b9f51bda6236bfb6b10683abd51d446 | Python | 15,677 | 409 | # process tiff and nd2 data for fosb analysis
# uses fixed thresholds from previous optimization
import os
import json
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from nd2reader import ND2Reader
from skimage import measure
from skimage.segmentation import clear_border
from skimage.morphology... |
ede1bff4f3b63bd24984a294e2209059fe41146d33abceed44fe8e0d36a03ca3 | Python | 15,678 | 327 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import dtiplayground.dmri.preprocessing as prep
from dtiplayground.dmri.common import measure_time
from dtiplayground.dmri.common.dwi import DWI
from pathlib import Path
import subprocess
import shutil
import numpy as np
import nibabel as nib
import dipy.reconst.dti as d... |
ff64a3f5c0a80a82f121631345377a7ec4b7ca96b00f593a565ba3369961162c | Python | 15,681 | 415 | """Reader for Axion Biosystems ``.raw`` recordings.
Lets the pipeline run on Axion Maestro files directly, instead of first running
``Functions/convertRawToMat/rawConvertFunc.m`` to split a plate into one ``.mat``
per well. This is a port of the read path of Axion's bundled MATLAB toolbox
(``Functions/AxionFileLoader/... |
b4763f09f2f7243d1b08d8e032722900bf40a3de30913f8450ff45dc0e5d6059 | Python | 15,684 | 449 | import copy
from collections import defaultdict
import numpy as np
from sklearn.model_selection import train_test_split
from ..core import SpikeTrainArray
from ..hmmutils import PoissonHMM
from .ergodic import steady_state
class HMMSurrogate:
def __init__(
self,
*,
kind,
st,
... |
c3958ddc660bacd821f2fcda26e95ddc05d9e25544e64cad1f1495f12c142879 | Python | 15,685 | 432 | from collections import Counter
import argparse
import os
import json
import numpy as np
from pathlib import Path
from tqdm import tqdm
from p_tqdm import p_map
from scipy.stats import wasserstein_distance
import pandas as pd
from pymatgen.core.structure import Structure
from pymatgen.core.composition import Composi... |
be35192b8ecdc97182d0def8cc39b357eb1639caa97663babdddab3d7ab4b94d | Python | 15,686 | 465 | #!/usr/bin/python3
#
import os
import sys
import argparse
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac import utils
import uac.vars as var
# remove inner circle for lspv, rspv. Removed ripv completely
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of ne... |
36fa3a81b45977d805d286f26b27788ad3ae68cf48a35c68e93d6bca7b87ea93 | Python | 15,689 | 427 | import logging
import os
import sqlite3
import torch
from . import common_functions as c_f
# You can write your own hooks for logging.
# But if you'd like something that just works, then use this HookContainer.
# You'll need to install record-keeper and tensorboard.
# pip install record-keeper tensorboard
class Ho... |
a11f53396529d62daee22aeeaec0eea50f12e364cbecd5c2c4dc7fc1afa50260 | Python | 15,689 | 380 | import torch
import os
import argparse
import datetime
import numpy as np
import random
from torch.utils.data import DataLoader
from tqdm import tqdm
import pandas as pd
from random import randint
from torchsummary import summary
from monai.transforms import (
Compose,
ToTensord,
RandAffined,
ScaleInte... |
9857d4112f035fc0ca288df1b80ec15016a4af3c8ccb31f95261faedead2269e | Python | 15,690 | 467 | """
Hybrid Fourier Neural Operator (H-FNO) Models
This module implements the H-FNO architecture for multi-physics sensor response prediction.
Architecture:
Input a(x) → Lifting → [H-FNO Layers] × L → Projection → Output u(x)
Each H-FNO layer combines:
1. Global spectral convolution (FFT → R → iFFT)
2. Lo... |
06508390b8f6c8d069c46a761e288667957ccb054bb41271600727d50eb5d222 | Python | 15,694 | 263 | from brainvoice.configuration.configuration import Configuration
from brainvoice.models.utils import load_model_checkpoint
import torch
import argparse
import pandas as pd
import os
from tqdm import tqdm
from sklearn.metrics import f1_score, balanced_accuracy_score
import numpy as np
import pathlib
def get_client_id... |
2c1844c1d93e1b391986470d673f940564b1c4c23d51e46888f9b7949a2bd61e | Python | 15,696 | 268 | """A module that contains the :py:class:`~corelay.tracker.Tracker`, which is used to track :py:class:`~corelay.plugboard.Slot` definitions in classes
that inherit from :py:class:`~corelay.plugboard.Plugboard`.
"""
import collections
import typing
from abc import ABCMeta
from warnings import warn
class MetaTracker(AB... |
4d7c3aa5ee516c204595d3a49427663a645c62a5c340706bba4e579fa8b56fcb | Python | 15,702 | 382 | import os, sys, gzip, argparse, subprocess, random, yaml, re
import pandas as pd
from os.path import join
from collections import defaultdict
import itertools
import glob
import datetime
import logging
from collections import OrderedDict
#===============================================================================... |
a649d89ad7f7b978256ebdb0a06ca52e673993ddf24bf68c75baf3406d529374 | Python | 15,702 | 363 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from abc import abstractmethod
from pathlib import Path
import torch
from PIL import Image
from torch import nn
from ultralytics.utils import WEIGHTS_DIR, checks
from ultralytics.utils.torch_utils import smart_inf... |
8240d538dbedb8e4738e33e2f36ec0db77fc0f4fff486a7ba56dc469782583a7 | Python | 15,703 | 361 | # # predict something from one multi-modal nifti images
# Tested with Python 3.7, Tensorflow 2.7
# @author : Philippe Boutinaud - Fealinx
# modified by Youjie Wang, 2025-01-09
import os
import nibabel as nib
import numpy as np
import gc
import time
from pathlib import Path
#import tensorflow as tf
from skimage import... |
0890b13a9f8a4276d45a3212da438a1d2a393ded6d7482f0327fd38031a286a4 | Python | 15,705 | 350 | # Fix for visualization/visualize.py
import os
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
def visualize_results(log_dir, results_dir, epoch=None):
"""
Create visualization plots for training results with standardized plot ranges.
Parameters:
- ... |
2eae0c1c9ce327b10f51b3874207d23247189b10937e60d2adb8b5f80dd139b8 | Python | 15,713 | 384 | import os
import sys
import yaml
import h5py
import csv
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.decomposition import PCA
pathpath,myrun,ncluststr,cmethod = sys.argv[1:]
'''
pathpath = 'PATHS/filepaths_carlen.yml'
myrun = 'runC00dMP3_brain'
nclust... |
36109d4d62055309e302ce8b7671ab1d6a7216a3f4a7726e9881947626e652b7 | Python | 15,714 | 439 | # Kai Sandbrink
# 2023-04-27
# This script analyzes Prolific Participants with different efficacy
# %% LIBRARY IMPORTS
import numpy as np
import pandas as pd
import os, ast, glob
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
from utils import format_axis, get_timestamp
from human_uti... |
a547614823e4416a1d135477ddf28966512f4b1eb2fb85abb76d1f409557ca8a | Python | 15,727 | 442 | #!/usr/bin/env python
from __future__ import annotations
from functools import lru_cache
from typing import Any, Dict, List, Optional, Tuple
import dask.array as da
import jpype
import numpy as np
import scyjava
import xarray as xr
from aicsimageio import dimensions, exceptions, transforms
from aicsimageio.readers.re... |
a64eb976f809167adef51cfe90e032e9d0d99be9695a34732de9504034b3ab3c | Python | 15,729 | 501 | import math
from pathlib import Path
import torch
from torch import nn, einsum
import torch.nn.functional as F
import torch.distributed as dist
from torch.utils.checkpoint import checkpoint_sequential
from einops import rearrange, reduce
from einops.layers.torch import Rearrange
from enformer_pytorch.data import str... |
b910402e5114b97115f70a2b85ad4a1dba6d552b514b688c71c4b93fcf6b5c3c | Python | 15,730 | 372 | # -*- coding: utf-8 -*-
"""
Full cortex reconstruction
The purpose of the following script is to compute the segmentation for hires
MP2RAGE data and bring the resulting surface data of the cortical boundaries
into a regular grid representation. The script is divided into five parts.
Single steps of each part are state... |
03368d00116656fc991bd6754cfd5ef78a745050db0007b04be4258e5eb20dbb | Python | 15,739 | 483 | #!/usr/bin/env python
# coding: utf-8
# # Classification of pH range using machine learning
# In[1]:
#libs
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn import linear_model
import pandas as pd
import numpy as np
import scikitplot as skplt
import m... |
c3c0f1ee31e76f5482fec94676b4049a9a227ce5edc6f0dc9bb3cd21d0201921 | Python | 15,739 | 306 | """
(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
... |
91f433c72e0477c98bf8dcbe644a5fbf9fcb9f64ce4261059329b6e117bd4322 | Python | 15,746 | 420 | """This is a script to compute equivalent time-of-flight (ToF) values where
TD brain sensitivities match CW brain sensitivities for different acquisition frequencies.
Output sare saved to PARQUET_FILEPATH.
"""
import os
import pathlib
import pickle
import numpy as np
import pandas as pd
from mc_analysis.fitting.l... |
fef8cadcca4c1c6a79edf16ec9ae8d2cd18f3a3afae2353f48b3a86b0f271ac4 | Python | 15,748 | 374 | #!/usr/bin/env python
#
# =====================================================================================
# MERGED SCRIPT: predict.py
#
# This script combines the functionality of prepare_IEFFEUM.py and run_IEFFEUM.py.
#
# It provides an end-to-end workflow:
# 1. Input: Takes a single FASTA file OR a directory of... |
8e2275be8c7acbfa288d297fadc275362be18f4c3707f198007dfa7dbd21b648 | Python | 15,754 | 434 | from typing import List, Final, Optional, Dict, Any, Union
import torch
from mlcg.data import AtomicData
from mlcg.data._keys import ENERGY_KEY
from .base import RANGE
from ..blocks import (
RANGEInteractionBlock,
AggregationBlock,
BroadcastBlock,
MACEBlock,
)
from ..system import System
from ...util... |
49fbb2729a5946ce3ec538fedf7f8838b0a7224b79d209a8e992e58dbb3b8d0e | Python | 15,758 | 432 | from __future__ import annotations
from typing import Final
import numpy as np
import pytest
from PySide6.QtCore import Qt
from labelme._shape import Shape
from labelme._widgets._canvas_interaction import CursorRole
from labelme._widgets._canvas_interaction import HitKind
from labelme._widgets._canvas_interaction im... |
82c83b18c26e226d0fa23f75b962ce5d8b2a7dd87130412d6b8eec6ff037e71c | Python | 15,760 | 417 | """
This module contains the functions to adapt the simulated reflectance spectra
to the TIVITA camera wavelengths.
Copyright (c) 2016-2023 German Cancer Research Center,
Division of Intelligent Medical Systems
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are p... |
aca2c44ef7ffa85290b6216fcc8645c9f02dcfc535d760c9b00f65270a08e44b | Python | 15,760 | 316 | """Content revisions for the stored-activation cache key.
``ActivationsExtractorHelper._from_paths_stored`` is decorated with
``@store_xarray``, which builds its cache key from the call arguments —
principally ``identifier`` (the model) and ``stimuli_identifier``. Neither of
those changes when the *contents* behind th... |
3166ee2049c64b61e05d80ac3e92d45534663523bab674cc7fe0d8202cb1b16b | Python | 15,762 | 394 | import mne
import os
import glob
import numpy as np
import pandas as pd
from scipy.io import savemat
import matplotlib.pyplot as plt
import pickle
import sys
sys.path.append('../utils')
from pp_utils import *
#======================================================================================
# ... |
4d6456b3e548c530b7597a3011908db89e450962988c13e3645e186b380afc97 | Python | 15,765 | 379 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
import numpy as np
from typing import Dict, List, Optional, Tuple
import torch
from torch import nn
from detectron2.config import configurable
from detectron2.data.detection_utils import convert_image_to_rgb
from detectron2.layers import move_device_lik... |
509ee487291647bb50cd0ca45a43bb08850fd709bb0dceb3df0e0ae26e83315f | Python | 15,769 | 417 | """Tests for the OCSR tool layer.
Hermetic: no model is loaded and no network is touched. The backends are stubbed, so
these cover what this layer owns, namely model resolution, the failure paths, and the
shape of the result contract. Whether a model reads an image correctly is the models'
business and is checked by `... |
09408273db996d617ed5c91baa46b2fa978092c9d10e2b9f3a5611051294235c | Python | 15,773 | 430 | import numpy as np
import ot
from scipy.spatial import distance
from .helper import kl_divergence, intersect, to_dense_array, extract_data_matrix, generalized_kl_divergence, \
high_umi_gene_distance, pca_distance, glmpca_distance
def gwloss_partial(C1, C2, T, loss_fun='square_loss'):
g = gwgrad_partial(C1, C... |
d3079c6ae07cab98850da2ef9f2d63bdff20d8b74a5eb30269c7a6b448cce3fe | Python | 15,778 | 336 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
a3061942d7985e4fb4f9e97e7720d4513631dd8a620389661a5c84716f27829b | Python | 15,780 | 385 | import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import init
from .pooling import build_pooling_layer
print('>>>>>>>>>>>>>>>>>>>>using Unet3<<<<<<<<<<<<<<<<<<<<<<<<<')
class SeparableConv2d(nn.Module):
def __init__(self,in_channels,out_channels,kernel_size=1,stride=1,padding=0,... |
e4482a5afce2c68027cd8e0aed0a62b177b371fd021af3260971c13cc50a00cd | Python | 15,787 | 320 | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
import json
import numpy as np
import os, cv2, glob, json, gc
import pandas as pd
import itertools
from itertools import chain
from moviepy.editor import VideoFileClip
import skvideo.io
from tqdm import tqdm
import circsta... |
f0753118dda372e41462d09c79f0ff52015915b336b0297a8dc2d1d1c9593ee8 | Python | 15,788 | 356 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from typing import Any
import numpy as np
from ..utils.ops import xyxy2ltwh
from .basetrack import TrackState
from .byte_tracker import BYTETracker, STrack
from .utils import matching
from .utils.stracks import pa... |
f15e9dac11e93f3a0915f82a52e6ad0a5e9e3c616875949e4a9d191e72eb500f | Python | 15,788 | 331 | # SynthStrip brain extraction: FreeSurfer's mri_synthstrip when it is installed, otherwise the SynthStrip network run
# in Python (torch) with the preprocessing of mri_synthstrip reimplemented with numpy/scipy/nibabel.
#
# SynthStrip: Skull-Stripping for Any Brain Image. A Hoopes, JS Mora, AV Dalca, B Fischl, M H... |
4d79d00b6a7edd0f03a58f7c84fbf21af89b8f5713a2b04bf95c203a99bc2417 | Python | 15,790 | 368 | import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.metrics import roc_curve, auc, precision_recall_curve
from .constants import BASE_DIR
from .loading import load_data_split
from ..antigen.antigen import AntigenChain
from .metrics import find_optimal_threshold, calculate_node_metrics
def evalua... |
5efd5df9f5861fe220d940c34d1295534e71e38ba4e1b47c96f3e045f82d254d | Python | 15,795 | 454 | import torch
from torch import nn, einsum, broadcast_tensors
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helper functions
def exists(val):
return val is not None
def safe_div(num, den, eps = 1e-8):
res = num.div(den.clamp(min = eps))
r... |
6522eec6f0b776d64faa9b3ff57d2cc0d652962978e0f7e317bd5dfef12a0db8 | Python | 15,800 | 397 | import sys
import os
from pathlib import Path
sys.path.append(str(Path(os.path.abspath(__file__)).parents[3]))
os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "2" # export MKL_NUM_THREADS=1
os.envir... |
05008fe18deb9de6eccfd76df6b54443eaeda385e7ffa01ace3c01b621be90c9 | Python | 15,822 | 240 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 28 15:01:34 2020
@author: jacobb
"""
import numpy as np
import torch
import pdb
import copy
# Track prediction accuracy over walk, and calculate fraction of locations visited and actions taken to assess performance
def performance(forward, model, e... |
fd5e5fe4225839d1bb3f30e0eb203080be68c85f4ce1f3686d9b237eafbb2151 | Python | 15,832 | 388 | from torchvision.models.convnext import CNBlockConfig
from torchvision.models import convnext as cnx
from typing import List, Optional, Callable, Sequence
import torch
from torch import Tensor, nn
import torch.nn.functional as F
from functools import partial
from torchvision.ops import misc, Permute
from torchvision.op... |
43327fa1c5a5251c6f4b4328b23e6c7aa6bdccf5c3b7f020bb33541249e40ac2 | Python | 15,833 | 446 | # -----------------------------------------------------------------------------
# Copyright © 2014-2015 Colin Duquesnoy
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# ----------------------------------------------------------------------... |
92d7e63ef02fa5051f2207e926ab2eb390e68d4735119e159045ec5e0bf238bf | Python | 15,833 | 327 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import copy
import io
import json
import logging
import math
import os
import pickle
import random
import sys
from typing import Any, Dict, List, Optional, Set, Tuple, Union
import torch
import torchvision
# from decord import cpu, VideoReader... |
3ba2412fcf6ce0b0801e878c0ea2acb6d5988f6a4e606dd87a7c43a2959dc1d0 | Python | 15,835 | 458 | # Original source: github.com/dipy/dipy
# Copyright (c) 2008-2025, dipy developers.
# Licensed under the 3-clause BSD license
# Modified by John Kruper for numba MSMT testing
# Will ultimately be moved upstream to DIPY
import warnings
import numpy as np
import numpy.testing as npt
from dipy.core.gradients import Grad... |
6bdfe3119d679e7d79abba0764b38aeb99db18f7f8447b900a1bcdb682f62122 | Python | 15,841 | 488 | from __future__ import annotations
import dataclasses
import json
import pathlib
from collections.abc import Mapping
from typing import Any
from chemgraph.academy.campaigns import resolve_campaign
from pydantic import BaseModel, ConfigDict, Field, field_validator
_REMOVED_CAMPAIGN_FIELDS = frozenset(
{
... |
add94b5562efc3cf3e5db149828f600a250e17c6f1046cd5e63d1f2e7f089c43 | Python | 15,847 | 526 | from __future__ import annotations
import os
import struct
import zlib
from collections.abc import Callable
from pathlib import Path
from typing import cast
import numpy as np
import pytest
from loguru import logger
from PySide6 import QtCore
from PySide6 import QtGui
from labelme import __appname__
from labelme imp... |
0575778f9edd38e7ffd40d184c8b2c4c5b899a3401b1f04b76541b92e2f5e8c4 | Python | 15,849 | 366 | #
# Reference : https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3864968/
#
# Written by SK Park , NIRAL, UNC
# 2021-04-18
import dtiplayground.dmri.preprocessing as prep
import numpy as np
import time,traceback ,yaml
from pathlib import Path
import os
import markdown
# import INTERLACE_Check.computations as computati... |
25812224f8bf17f5fa5500bc489a22a95682573f13d2b578dd6d0233ca60cf7c | Python | 15,849 | 484 | import attrs
import numpy as np
from matplotlib.axes import Axes
from scipy.interpolate import interp1d
from scipy.stats import pearsonr
from sklearn.linear_model import PoissonRegressor
from tqdm import tqdm
from typing import NamedTuple
from typing import Union
from typing_extensions import Self
from argclz import A... |
b48a9ea6fc027210081b6fe649f1656bae12d60f4aba6f97bfcdaafb2be96eff | Python | 15,857 | 341 | #!/usr/bin/python
"""
Base classes and module for USB Joystick control.
Hazen 09/12
Jeff 09/12
"""
from PyQt5 import QtCore
import storm_control.sc_library.parameters as params
import storm_control.hal4000.film.filmRequest as filmRequest
import storm_control.hal4000.halLib.halMessage as halMessage
impor... |
1d68c7ce86f6cd63da70828b5668fca8e8a662794d16129305c0814d21690a2b | Python | 15,861 | 463 | """
Common place to define analytical baselines for the supersampling problem.
This module provides building blocks and complete analytical models for
computing optical reflectance spectra from physical parameters.
Sources:
- https://arxiv.org/pdf/2312.12935.pdf
- https://omlc.org/news/may99/rd/index.html
More Inter... |
50b78d75c2879f3d929c80ffa44c3efe202c802422f5805259bd0544e3e10cef | Python | 15,868 | 423 | """ Optimizer Factory w/ Custom Weight Decay
Hacked together by / Copyright 2021 Ross Wightman
"""
import logging
from itertools import islice
from typing import Optional, Callable, Tuple
import torch
import torch.nn as nn
import torch.optim as optim
from timm.models import group_parameters
from .adabelief import Ad... |
52003c490b78ef78ea31f52ef82d13744911e99712ee7dbcacaff3e2788b5998 | Python | 15,868 | 495 | from typing import Tuple, Type
from scilpy.ml.utils import IMPORT_ERROR_MSG
from scilpy.ml.bundleparc.encodings import PositionalEncodingPermute3D
from dipy.utils.optpkg import optional_package
torch, have_torch, _ = optional_package('torch', trip_msg=IMPORT_ERROR_MSG)
class MLPBlock3D(torch.nn.Module):
def __i... |
5edc2dcf45b6317d6b7af6da3b702c035af5a4be3c704e94644eb74b549ab0d5 | Python | 15,881 | 530 | """Generate predictions for preprocessed image folders."""
from __future__ import annotations
import argparse
import logging
import os
import re
import pandas as pd
logger = logging.getLogger(__name__)
_DEFAULT_TARGETS = [
'age',
'sex',
'handedness',
'bmi',
'fluid_intelligence',
'neuroticis... |
fe8574d70349949dbeb58655e4bebb2490bf5066d030a895c644c7b668fdd8c3 | Python | 15,890 | 367 | # Import Packages, Libraries and Files
from psychopy import visual, core, event, __version__, data, gui, logging, monitors,constants
from psychopy.hardware import keyboard
from psychopy.hardware.emulator import launchScan
import os
import numpy as np
import random
import show_movie
"""
The active condition consisted ... |
4aa77eb9d68d90a438690b333bd6b1a0695c77f59345f2b5dc0508bc6ee98a71 | Python | 15,909 | 328 | import os
import os.path as osp
import torch
import random
import numpy as np
from tqdm import tqdm
import pandas as pd
from glob import glob
from torch_geometric.data import (Data, InMemoryDataset, download_url,
extract_gz, extract_tar, extract_zip)
from torch_geometric.data.makedirs... |
dac0127f3ee4dda432f5469a9028a2cd19bbb8d1b7401a4113ff36d31bb5147f | Python | 15,922 | 400 | # 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, ... |
6292c620ebb60bb180032901ce698fac35a86f6b9cb2a5636e6a8d31199311d3 | Python | 15,923 | 410 | import logging
import pandas as pd
from kipoiseq.dataclasses import Interval, Variant
from kipoi.data import Dataset
from kipoiseq.extractors import VariantSeqExtractor
from mmsplice.utils import encodeDNA, region_annotate
logger = logging.getLogger('mmsplice')
class ExonVariantSeqExtrator:
"""
Extracts sequ... |
63d3a990c4af3ee9647f5883f5c79b59cb2ab16805747f3ca5850e5281fdb018 | Python | 15,923 | 468 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import math
import torch
import triton
import triton.language as tl
@triton.jit
def _any_combine(a, b):
return a | b
@triton.jit
def tl_any(a, dim=0):
return tl.reduce(a, dim, _any_combine)
# ========================================... |
0a9ee88f9fd0eddfade00cda3ef27e5a38641024e9196584e14c05be0ef7661c | Python | 15,929 | 480 | """
Generate synthetic datasets for use in training with known ground truth data
"""
import numpy as np
import scanpy as sc
import pandas as pd
import random
import nest
from anndata import AnnData
from typing import Optional, Tuple
from numpy.typing import ArrayLike
from scipy.sparse import coo_matrix, csr_matrix
... |
7d43e8c4906c64e2a546e0471040814c3e90d7c189921709568914f29bbcc2cf | Python | 15,933 | 431 | """
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... |
6056b8e46a0617d6d75cee852235fc0f54169d0c3b8c51ec631ecd5afa830ac6 | Python | 15,936 | 357 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script loads pre-calculated source time courses (STCs) for different
experimental conditions, extracts data from specified regions of interest (ROIs),
and plots the average time course. It calculates and displays within-subject
error bars.
For time windows with s... |
0e07cbc835c964d58efdaabee6965b7b89eccdd404bd7a88ac09a036f8422efb | Python | 15,953 | 293 | #ARGS are optional, see ignore = for how they are used
#if using ARGS, from within python, type
#ARGS="--sex M --age 21"
#execfile ('GrpAvgPopSpike.py')
#from outside python, type
#python GrpAvgPopSpike.py -s M -p 21
import numpy as np
import sys
from pprint import pprint as pp
import glob
import pickle
... |
d81790631ac119dc5df329d65578d7773bb9b229aecfdbbf662baa0acdc12326 | Python | 15,953 | 470 | from __future__ import annotations
import dataclasses
import typing
from typing import Final
from typing import Literal
import numpy as np
import numpy.typing as npt
import skimage.measure
from PySide6 import QtCore
from PySide6 import QtGui
from .. import _utils
from .._shape import CIRCLE_POINT_COUNT
from .._shape... |
5b1d3e7add1523dd3c77120bbffdb6251339d899a254a29557ee2d5e0a63402d | Python | 15,954 | 560 | import os
import sys
import time
import random
import io
import contextlib
import glob
import argparse
# import spectral
import numpy as np
from typing import List, Optional
import torch
import torch.nn as nn
from torchvision.transforms import v2 #v2 is libary of torchvision transformations
from torchsu... |
6c8fcb6aef46edad0e696910f1a7fc8014650b5ddfbcdd2bef06d80aa726db75 | Python | 15,955 | 403 | import numpy as np
from tqdm.auto import tqdm
from numba import njit
class NestedSpectralPartition():
"""
Implementation of the Nested Spectral Partition (NSP) method as implemented in Wang et al. (2021).
References
----------
Wang, R. et al. (2021). Segregation, integration, and balance of large-... |
d197df38dc43b80a3453635b3ffc49a58c52b99dcb338d3ef4d276969d01d2d2 | Python | 15,956 | 502 | import numpy as np
import torch
import time
from types import SimpleNamespace
import os
import json
import pickle
from optparse import OptionParser
import copy
def compare_opt(log_path1, log_path2):
opt1 = load_training_opt(log_path1)
if log_path2 == "pseudodata":
opt2 = config_pseudodata()
else:
... |
dc56e56aaa20bc20490d26d5ce494261398e55385a477e176301ef0a74e8f286 | Python | 15,967 | 432 | #Lucas Sancéré -
import os
import sys
script_dir = os.path.dirname(os.path.abspath(__file__))
import glob
from itertools import product
import numpy as np
import sklearn.metrics
import yaml
from attrdictionary import AttrDict as attributedict
from tqdm import tqdm
from histo_miner.evaluations import get_fast_pq, p... |
cf39213b20067b05d0b1abc105614d43c33c0273a8cd578cb72b21231b3770cc | Python | 15,968 | 416 | """
Implementation of the Gaussian delayed saccade task
"""
import time
import typing
import numbers
import logging
from datetime import timedelta
import random
import numpy as np # import Numpy to draw Gaussian
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util impor... |
095605a65115f0b253ecebb54e2d32768d522b13d690ec3eba0789e24e572d14 | Python | 15,971 | 442 | from __future__ import annotations
import json
import threading
from collections.abc import Iterator
from pathlib import Path
import numpy as np
import pytest
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from pytestqt.qtbot import QtBot
import labelme._app
import labelme._save_w... |
d19c5836f3707de26544ebfb05b54dd53f474ee2ca4c0dfbbef2a2a5a9b951a8 | Python | 15,977 | 433 | import os
import h5py
import unittest
import logging
import pandas as pd
import numpy as np
from pandas.testing import assert_index_equal
from numpy.testing import assert_array_equal
from heig.image import get_image_list, NIFTIReader, ImageManager, merge_images
MAIN_DIR = os.getcwd()
log = logging.getLogger()
log.setL... |
f5f297c5bb3f5b719fb935098c52aee6fda6309b7fd2af869e36d109b3a5b8f2 | Python | 15,986 | 398 | import operator
import numpy as np
from ..neurosim.simulation.threshold_factor_simulation import ThresholdFactorSimulation
from neuron import h
from ..spherical_cartesian_conversion import cartesian_to_spherical
class TestSimulation:
def test_attach(self, neuron_simulation: ThresholdFactorSimulation):
as... |
3452d8870778512a5a83f48625adb3e582ae7df2959b8a40b3a9f472beb2ec52 | Python | 15,988 | 464 | import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from mcmlnet.experiments.plotting import (
add_theoretical_bounds,
plot_scaling_fit,
setup_plot_style,
)
from mcmlnet.experiments.utils import (
compute_mae_ci,
compute_reordering_array,
neural_scalin... |
edad263c3a843c47acd4bfbab5ce7b6e583e4523e81ed49086b266628c68b7c4 | Python | 15,991 | 405 | # 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, ... |
3439aa1de60ecc2ce5300f5ec5288aae92886ad1cc7e58841b59474757b8ab71 | Python | 15,994 | 412 | import os
import subprocess
import nibabel as nib
import numpy as np
import csv
import os as _os_image_calc
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, traits
from traits.api import Bool, Int, Str, List, Float, Undefined, Either
from cvdproc.utils.python.basic_image_pr... |
aa6d81333952281ef60584df2fa4d06177ebbe94c212ac50a1b091394f366ea7 | Python | 15,995 | 432 | import geopandas
import logging
import shapely
import shapely.vectorized
import numpy as np
from scipy.interpolate import RegularGridInterpolator
from shapely.geometry import LineString
from typing import Tuple, Optional
from neuron_morphology.layered_point_depths.__main__ import setup_interpolator
from tqdm import tqd... |
e4f47b95f47e4480fd9d5e6f3a70883e2e2aa94f96ef81b9ee0a817c738801cd | Python | 15,998 | 405 | # 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, ... |
69e7dfcc97a81837759a1c89d819ad3bcf77d44977d387fef133eafe2a82ffbe | Python | 16,004 | 352 | # 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, ... |
ebbf67e6ce3e5061a097ca9393b580ea25e4887f88b8478a945ddaf76e429514 | Python | 16,005 | 320 | """
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... |
3d10fbbe22515fcd98576b9c610727635ce199c32acefc1d41019f626359e5a3 | Python | 16,011 | 302 | import json
import sys
from pathlib import Path
import torch
import yaml
from tqdm import tqdm
sys.path.append(str(Path(__file__).parent.parent.parent)) # add utils/ to path
from utils.datasets import LoadImagesAndLabels
from utils.datasets import img2label_paths
from utils.general import colorstr, xywh2xyxy, check_... |
f1c0882d122760523ebaefe6351303f79c62f69f6062dcebe2b19f3bac7db042 | Python | 16,013 | 423 | ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the gradunwarp package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
import numpy as np
import sys
import pdb
import ma... |
cc6547953036af945cefd817c3ef9a41d1c2aa5b3a222616b122625695aeea4e | Python | 16,016 | 420 | """Sign flipping.
Source reconstruction leaves the sign of each channel (parcel) arbitrary, so the
same parcel can have opposite polarity across sessions. Before pooling sessions
we align these signs: for each session we search for the ``+1``/``-1`` per-channel
vector whose (time-delay embedded, standardized) covarian... |
6397fe7e383d7e0377258eddcef7b13312a6bb657add52f093fe40a97b4b0bdb | Python | 16,022 | 427 | #pylint: skip-file
#type: ignore
"""
Implementation of the simple task
"""
import time
import math
import typing
import asyncio
import logging
import datetime
import numpy as np
import os
import stl
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import create_tas... |
67b38fea8c9c8afad0780df295532781d991814e2c88707fbd7e56f8d1207e51 | Python | 16,022 | 304 | import os
import subprocess
import shutil
import nibabel as nib
import time
import numpy as np
import pandas as pd
from nipype import Node, Workflow
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Direc... |
46b91aab3ddf872109dd52f98a4490385dccc7a41554eeb55afc8f6a1d132647 | Python | 16,023 | 416 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 23 00:44:19 2024
@author: costantino_ai
"""
import itertools
import numpy as np
from sklearn.metrics import confusion_matrix
from scipy.stats import pearsonr
from brainscore_core.metrics import Metric, Score
from brainscore_core.supported_data_stand... |
1ec50c62b5964cd5f6ae70ebc670c160b9aeeb384f786369f5c02d2153360d7c | Python | 16,026 | 421 | """
Configuration handling for the Batch Alignment CLI.
Loads and validates YAML configuration files.
"""
import yaml
import logging
from pathlib import Path
from typing import Dict, List, Any, Optional
import flowkit as fk
logger = logging.getLogger(__name__)
def load_config(config_path: Path) -> Dict[str, Any]:
... |
0b70dd43b466c7771338258ba742760ef5f2d6c46d28fc87b0df63c807bc9764 | Python | 16,027 | 500 | # Copyright 2017 Calico 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, sof... |
c4c860cfdd1c2ccf79491c58e9a419d0ac08185b06dbb5d12c4a69e5fc3a9c0d | Python | 16,027 | 449 | import hail as hl
import numpy as np
from heig.wgs.wgs2 import RVsumstats, get_interval, extract_chr_interval
from heig.wgs.vsettest import VariantSetTest
from heig.wgs.utils import *
from heig.wgs.utils import PermDistribution
from heig.utils import find_loc
class GeneralAnnotation:
"""
Rare variant analysis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.