sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
872a54b297cdfd91a4e18b11c7764be6b77e3a8deb5cfc5113bcd739e21bc513 | Python | 22,383 | 432 | #!/usr/bin/env python
"""
Reads and plots active (i.e. non-zero) signals from SIEMENS advanced physiological log / DICOM files
This function expects to find either a combination of individual logfiles (*_ECG.log, *_RESP.log,
*_PULS.log, *_EXT.log, *_Info.log) generated by >=R013 sequences, or a single encoded "_PHYSIO... |
349207d57fe92b188048c2e0bddcb338ba1591b326b93280565cd3caef69eebe | Python | 22,396 | 577 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import functools
import random
import torch_geometric.transforms as T
import torch.nn.functional as F
import yaml
import optuna
import gc
import time
import logging
from math import ceil
from torch_geometric.data import InMemoryDataset, Da... |
ca1141396e9be15f0664856cc3e104b9c0fe66c671a9c559ab37b58f9f6de49b | Python | 22,419 | 570 | #!/usr/bin/env python3
"""
Regenerate motion annotation images for a BehaveAI project.
Usage:
python regenerate_motion_dataset.py <path/to/BehaveAI_settings.ini>
or:
python regenerate_motion_dataset.py # will prompt for INI via file dialog
This script:
- reads the settings INI (and resolves relative paths relativ... |
02552b06357ef2d362c5d6653f2883c043fb81fa9593269669c04efd08a77873 | Python | 22,420 | 546 | # Required libraries
import matplotlib
matplotlib.use('Agg') # Set globally for all matplotlib usage
import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:100"
os.environ['KMP_DUPLICATE_LIB_OK']="True"
os.environ['CUDA_LAUNCH_BLOCKING']="1"
import random
import glob
import matplotlib.pyplot as plt
from... |
ebc8b6337f4636c1457473c079d007693b3d8766c4891e2b5dd521c22c2e5527 | Python | 22,422 | 538 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from collections import abc
from itertools import repeat
from numbers import Number
import cv2
import numpy as np
from .ops import ltwh2xywh, ltwh2xyxy, resample_segments, xywh2ltwh, xywh2xyxy, xyxy2ltwh, xyxy2xyw... |
6b43764a4ffe8f09090dea6ed97eca9739a4a36d767df8127eb8feb0235b1571 | Python | 22,429 | 718 | import os
import sys
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torch.utils.checkpoint import checkpoint
from unicore.modules import LayerNorm, softmax_dropout
from unicore.utils import get_activation_fn, permute_final_dims
class Dropo... |
7866388cf1efec46287ec1c58b9265e572948cd63f8ded13b47a128fbd43e8d2 | Python | 22,439 | 539 | # Required libraries
import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:100"
os.environ['KMP_DUPLICATE_LIB_OK']="True"
os.environ['CUDA_LAUNCH_BLOCKING']="1"
import random
import glob
import matplotlib.pyplot as plt
from dataset_patches import MyDataset
from dataset_patches import Custom3DAugmentation... |
2da859d7e2874f38503dc775d6b879fdc11ad15c6b058eec716dcdfb998b93ea | Python | 22,454 | 461 | # coding: utf-8
# reference: https://github.com/tctianchi/pyvenn/blob/master/venn.py
from itertools import chain
try:
# since python 3.10
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplo... |
87e04e154c89293a4b3806aca2a7951d2a2ba50546aae60efac42fd2992777b2 | Python | 22,457 | 531 | """
This file was written to provide an easy way to load an existing CLAPP trained model.
It is based on codebase of CLAPP as modified by Ariane Delrocq.
Import the function load_model from this file. Check its docstring (with help(load_model)) to know how to use.
Note that due to CLAPP training requirements, CLAPP mod... |
ae9b455e944a1f1217532f97b748fadd959dc5ed4354fa51414e0abfc6cede55 | Python | 22,472 | 657 | #Lucas Sancéré
import math
import os
import matplotlib.pyplot as plt
import numpy as np
import xgboost
import yaml
from attrdictionary import AttrDict as attributedict
from sklearn.metrics import RocCurveDisplay, auc, balanced_accuracy_score, roc_curve
from sklearn.model_selection import StratifiedKFold
from histo_... |
e8795e160e4e20f2e64458e012f555273e9f9b05d51c547ab54ca9e25d078f00 | Python | 22,474 | 543 | # Kai Sandbrink
# 2023-08-14
# This script groups utility functions that are used for transdiagnostic analyses
# %% LIBRARY IMPORTS
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
from human_utils_behavioral_analysis import get_mask_behav
from human_utils_project import get_clean_dat... |
e8cda392a58c64d738aca4fdb4c883269750999403cfe2485ae458b223f8d0af | Python | 22,477 | 368 | """Make sure that
- pipeline's src/ directory is added to PYTHONPATH.
- pipeline's conda environment is activated.
Or run this in pipeline's docker container.
This module does not cover all functions defined in encode_lib_genomic.
It only covers the following newly added functions.
- bed_clip()
... |
0f666afd679489d9fe12ba4f7ef144028b963f8a180fcaad0cfb190fa7f80417 | Python | 22,479 | 579 | def maker(name,fullseq,amplifier,pause,choose,polyAT,polyCG,BlastProbes,db,dropout,show,report,maxprobe,numbr):
from Bio.Seq import Seq
from Bio.Blast.Applications import NcbiblastnCommandline as bn
import io
import numpy as np
import pandas as pd
pd.set_option('display.max_columns', 500)... |
af7a158d84f3538997b0f49760ac95b402f7307271e3246ce4d67ff956c96e5b | Python | 22,492 | 574 | from dataclasses import dataclass, field
from typing import Any, Literal, Protocol, Union, cast
from torch import nn
from eir.models.fusion import fusion
from eir.models.input.array.array_models import CNNModelConfig
from eir.models.input.image.image_models import get_image_model_class
from eir.models.input.sequence.... |
9b6cc5a32a3633b4df242af4c23b623b34c2cc3fae39b4bee120a86803a97d3a | Python | 22,511 | 436 | import argparse
import json
import os
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import tqdm
from models.experimental import attempt_load
from utils.datasets import create_dataloader
from utils.general import coco80_to_coco91_class, check_dataset, check... |
067ab892907d5a17a82aebc33e9d4105507a5fc0815c44487eaa25a64d4947a8 | Python | 22,547 | 532 |
"""
This module is used to define the class containing the entire Bayesian Network,
and the corresponding attributes/methods to train the model, set algorithmic options, calculate lower bound, etc.
"""
from __future__ import division
from time import time
import os
import scipy as s
import pandas as pd
import sys
imp... |
cb56e9f9a7e40b3c34c41be1fc674c6ea79b795aa395eea217effb5503dc3758 | Python | 22,555 | 501 | """
Tests for fused generic label grid sampler (2D and 3D).
Baseline: convert label map to one-hot, bilinear interpolate via fused_grid_sampler,
then argmax over channels for labels and use the interpolated value at the winning
channel as the weight. Forward checks labels and weights; backward uses sum(weights)
as los... |
29a66e36b1d28fedff6987ef72ef6184f010766f460e43ff606f5d94f4140759 | Python | 22,572 | 782 | import math
from pathlib import Path
from typing import Optional, Tuple, Sequence
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
sys.path.insert(0, str(Path(__file__).parent.parent))
from strutils.utils_3d.primitives import Linear, LayerNorm
from strutils.uti... |
ca78330ec02243d631901146c7d55ab1c1d8e573a2d5348d132cf4f4c1e13413 | Python | 22,574 | 579 | #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 wait_for, w... |
e988713776ac56f084432dc9eeefccd920903a6e926cf1922277d1c6b7ec8058 | Python | 22,575 | 834 | from collections.abc import Callable
from pathlib import Path
from textwrap import wrap
from typing import (
TYPE_CHECKING,
Literal,
Protocol,
)
import matplotlib
import numpy as np
import pandas as pd
from sklearn.metrics import (
auc,
average_precision_score,
confusion_matrix,
precision_r... |
2fbc281b2ff03d968002e5ed05e513f344e17da04df4aa3d9aacedf6f49ad78d | Python | 22,579 | 607 | """
Top-level module for calculating spectra using GPUMCML.
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 permitted provided that the
following conditions are met:... |
af3d645c290c28b3850de80e8e68ec9a2fdb047e1d018e480f4a1ecd1b2f7e1b | Python | 22,584 | 498 | # tract_calculation.py as a class
from natsort import natsorted
import json
import numpy as np
import pandas as pd
import distinctipy
import matplotlib.axes as mpl_axes
import matplotlib.pyplot as plt
from skspatial.objects import Line, Points
from typing import List, Tuple
from pathlib import Path
from napari.utils.n... |
d06ed1836cc1c209dda1a3b85f80e14a4bfbda5c747ffc377c1bc6b16aa2e36c | Python | 22,593 | 572 | #!/usr/bin/env python
import os
import sys
import shutil
import re
import json
import glob
from pathlib import Path
def setup_refinement_folders(identified_dir):
refine_root = os.path.join(identified_dir, "Rietveld_Refinement")
cnn_folder = os.path.join(refine_root, "CNN_ML_refinement")
os.makedirs(... |
4fb4c08f057821e56dd44751194c6738833b44634243196a9ea1a62fff864d2a | Python | 22,594 | 593 | """
Stack correction module for image warping and projection.
This module provides the StackCorrector class which performs:
1. Loading and preprocessing of image stack data
2. Direct extraction of skeleton coordinates from band position annotations
3. Image warping based on band alignment
4. Projection creation from w... |
4d6dc4a211963bfdd3319d9336b7c7ae88daf8449d26209cdc2b2440baa5d24d | Python | 22,609 | 572 | #!/usr/bin/env python
import os
import sys
import shutil
import re
import json
import glob
from pathlib import Path
def setup_refinement_folders(identified_dir):
refine_root = os.path.join(identified_dir, "Rietveld_Refinement")
cnn_folder = os.path.join(refine_root, "CNN_ML_refinement")
os.makedirs(... |
85fd00d4dc3ccb35e872c46565687d79076f06fc528a0295335c66816935d36b | Python | 22,617 | 630 | import pytest
from pathlib import Path
from typing import Dict, Tuple
import json
import tempfile
import os
from stack_corr.definitions import StackProperties
class TestStackProperties:
"""Test the StackProperties dataclass."""
def test_stack_properties_creation_basic(self):
"""Test creating StackPr... |
9c09bf0c95d483059cac67e31f73f2a38b9845d64e2c8d827013b915a253a2bf | Python | 22,628 | 671 | from __future__ import annotations
import asyncio
import random
import string
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from functools import partial
from itertools import groupby
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Iterable, Literal... |
2f2dfd8233d8823ff16875e734d70a5c5feb0223a48726e2b480a6cbb563eac8 | Python | 22,642 | 391 | import os
import optuna
import torch
import torch.distributed as dist
import argparse
import pytorch_lightning as pl
from training_functions import train_model, test_model, seed_everything, save_study, load_study
from ecg_utils import get_dataloaders, load_label_mappings
from backbones import (
resnet1d18, resn... |
a62317c3f26d74074341f6b55ba431b2ced2663ae867d4d435a228bdb31e8055 | Python | 22,667 | 665 | #!/usr/bin/python
#
## @file
#
# Z calibration functions.
#
# Hazen 07/14
#
import math
import numpy
import numpy.lib.recfunctions
import os
import re
import scipy
import scipy.optimize
import struct
#
# different power z calibration functions
#
## zcalib0
#
# Z calibration fitting function with no additional parame... |
f27e82504a8dd2622949e63dd6a15bd6d6cfef9e364663e7524e582cdcf4bfa3 | Python | 22,675 | 587 | #!/usr/bin/env python3
"""
Muscle Artifact Detector using Deep Lightweight CNN (DLCNN)
Binary classifier for detecting muscle artifacts (EMG, chewing, shivering) in EEG data.
Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zhaohui Geng
Year: 2025
License: MIT
"""
import os
import json
import ra... |
c903ccf054beca91ac0f1e73dbfdc8582d76fcb2405714642ec00ec30ddb6236 | Python | 22,691 | 474 | """Test the cell-type-aware plotting added to CAT-NAP.
Run from the repo root::
uv run python python/test_catnap_cell_type_plots.py
Three features, none with a MATLAB counterpart to compare against (MATLAB draws
cell-type rings but all solid white, and has no by-cell-type activity
comparison at all), so these ar... |
a5c8227d072bfc58c44b227ae3976b50d322f13715be071a9fb665aaff06e0f5 | Python | 22,706 | 667 | import copy
import csv
import math
import os
from importlib import resources
import anndata
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
import scipy
import sparselinear as sl
import torch
from scipy.stats import gamma, norm
from torch import nn
from torch.utils.data impor... |
6f7aad9d37bf0a387cc9cbfe3a6f522d19aa6836fc068a2ff921e92e86f31c61 | Python | 22,747 | 522 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""Transformer decoder for SAM3 with iterative box refinement and an optional presence token."""
from __future__ import annotations
import numpy as np
import torch
from torch i... |
08918d858ccda77a28b5a46db15f4aaafecbab63a2d2b5eec6663675f79b23fa | Python | 22,772 | 331 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'launcher.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from .pyqt_utils import *
cl... |
76794ac3da84a04ba874247e0cfdb4182d1bb5a448110118bd356573be142548 | Python | 22,777 | 614 | # -*- coding: utf-8 -*-
"""
Globe Shape Analysis Plotting Pipeline
A modular, open-access tool for plotting eyeball shape projections
from globe shape analysis results.
Features:
- 2D contour plotting for polar/orthogonal projections
- Support for mean and variance analysis
- Cross-platform path handling
- Co... |
92105c6f4fa98c79c82679bd52112528cab517a934a2576e3e24bd15a24ed66a | Python | 22,791 | 530 | import torch
torch.multiprocessing.set_sharing_strategy('file_system')
import matplotlib
matplotlib.use('Agg')
import os
import os.path as osp
from torch.utils.data import DataLoader
import sys
os.chdir('/project/roysam/rwmills/repos/cluster-contrast-reid/')
print(os.getcwd())
# print(os.listdir())
import os #RWM
prin... |
b79d9c3687433e90c019179a8d881a3b73fd1a56459aa3c3077b3509585132f3 | Python | 22,814 | 444 | import argparse
import json
import os
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import tqdm
from models.experimental import attempt_load
from utils.datasets_Npoint import create_dataloader
from utils.general import coco80_to_coco91_class, check_dataset... |
d8ae4410f1df7be8f4837926b775a7f93dd1cbcca21a7fad4b6ce434a6319cbc | Python | 22,816 | 764 | import sys
import os
import re
import logging
import pandas as pd
import numpy as np
from scipy.sparse import csc_matrix
from heig import utils
class Dataset:
def __init__(self, dir, all_num_cols=False):
"""
Read a dataset and do preprocessing
Parameters:
------------
dir:... |
5d456a04185b4422a66006ff7336083ce7bf6f273cb37fe6ac7e05382ffb7863 | Python | 22,834 | 708 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
sns.set()
from matplotlib.colors import rgb2hex
from utils.data_handler import get_pop_superpop_list, get_superpop_pop_dict
import matplotlib.animation as animation
import gc
#################################... |
82e78b9753826331680a0d52ae79e162fb4bf8d89396a3d3a81118caeb862346 | Python | 22,842 | 745 | from . import data_handling as dh
import numpy as np
import matplotlib.pyplot as plt
import h5py
import yaml
import io
import os
def get_paths(exptype,pathdict,key_pref='code_dataaccess',key_default='code'):
mykey = key_pref if key_pref in pathdict else key_default
cfgpath = os.path.join(pathdict[mykey], 'config/r... |
376e454ef9c7c4f05bfe1211ae76534b938f8b5a334bb3918924f3b735da4e70 | Python | 22,844 | 606 | from pathlib import Path
from typing import Literal, Iterable
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import numpy as np
import polars as pl
import seaborn as sns
from matplotlib.axes import Axes
from scipy.stats import wilcoxon
from argclz import AbstractParser, argument, as_argument, str... |
3240eb24883a7c50db8038b889b055c96e773181f77fcac4b57d709a6404a65b | Python | 22,863 | 531 | from typing import Optional
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn import Parameter, ReLU
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.dense.linear import Linear
from torch_geometric.nn.inits import glorot, ones, zeros
from torch_geometric.typ... |
7144c306c105b332c3dae26d48a030b8406e134ff99a5d4ba6509dfff9454498 | Python | 22,864 | 527 | import numpy as np
from scipy.io import loadmat
import nibabel as nib
import json
import argparse
import os
from utilities.data_simulation.Download_data import download_data
import pathlib
##########
# code written by Oliver J Gurney-Champion
# code adapted from MAtlab code by Eric Schrauben: https://github.com/schrau... |
68f074c0b6a1bcb21dd88b2f81b6b27ec5069af1094a095d28ff09a4eb16a040 | Python | 22,875 | 650 | import time
import logging
import numpy as np
import pandas as pd
import hail as hl
from tqdm import tqdm
from scipy.sparse import csr_matrix
import heig.input.dataset as ds
from heig.wgs.null import NullModel
from heig.wgs.relatedness import LOCOpreds
from heig.wgs.vsettest import VariantSetTest
from heig.wgs.mt impor... |
ee2f02822c497709f5d3d5159aa08ab25db5e4a42cd77987e139ae9f43257496 | Python | 22,885 | 583 | import sys
import math
pace_pdb = open(sys.argv[1],'r') ### pace.pdb
cg_pdb = open(sys.argv[2],'r') ### cg.pdb
index = open(sys.argv[3],'r') ### pace_residue.txt
pace_itp = sys.argv[4] ### pace.itp
cg_itp = sys.argv[5] ### cg.itp
def readPDB(pdb):
dataPDB=[]
for rl... |
206aba759f652674903a7d9b778899ae130cfbf99940d912bb2e3796ec1b3fbc | Python | 22,888 | 607 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import logging
import random
from collections import defaultdict
from typing import List, Optional, Union
import torch
from sam3.train.data.sam3_image_dataset import Datapoint, FindQuery, Object
class FilterDataPointQueries:
find_ids_to_... |
22a8f161f412ef907e1de5f4684201d6bd7b5c8c1c86d7a652aac71d87363c02 | Python | 22,895 | 741 | # -*- coding: utf-8 -*-
"""Filter scalar values on surface mesh."""
import datetime
import functools
import os
import shutil as sh
import subprocess
import warnings
from abc import ABC, abstractmethod
from shutil import copyfile
import numpy as np
from scipy.sparse.linalg import expm, expm_multiply
from scipy.stats i... |
51d1826cafc8a3feafc2822f65cddd45dfe77260f0ba72fdd3f40e5811d60a69 | Python | 22,898 | 627 | import mmcv
import torch
import numpy as np
import os.path as osp
from depth.ops import resize
from ..builder import PIPELINES
from numpy.core.fromnumeric import shape
from mmcv.utils import deprecated_api_warning
@PIPELINES.register_module()
class Normalize(object):
"""Normalize the image.
Added key is "img... |
6e28f0026ddfd355316766b8dd9f94b173a1734f3095d74ab07219a61dc3afea | Python | 22,900 | 710 | #!/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
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of old atrial coordinates")
# Add the arguments
my_parser.add_argum... |
46319120c4a31daacde2cb1368674d4cd99bff7701f12edf34a6939279f3a82c | Python | 22,901 | 546 | from pathlib import Path
import os
import re
import csv
from typing import Callable
from tqdm import tqdm
import matplotlib.pyplot as plt
import time
import tifffile
import tensorflow as tf
import numpy as np
from benedict import benedict
import deep_events.lstm_models
from deep_events.database.convenience import get_... |
e4321953f9ca2d6ee67b504f6510243a8d7362087ff060921a348a59b939b6b4 | Python | 22,904 | 620 | # 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, ... |
4c5ef5faaf14d98eb3c7116ccbe699fa408be57298e7aaa7fd5c69c7c4c537e1 | Python | 22,907 | 452 | # ==============================================================================
# Binaries and/or source for the following packages or projects are presented under one or more of the following open
# source licenses:
# eval_3D_lane.py The OpenLane Dataset Authors Apache License, Version 2.0
#
# Contact si... |
912022c12b985f33d6146e35f4486d5849d8b4a1f5ff301502c73b98388d8cb5 | Python | 22,925 | 620 | # 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, ... |
7f7baad9c21879c7cbae7531ffc0980df7cc4d44ae91e973e29a97ca81c9a99c | Python | 22,928 | 409 | import numpy as np
from tqdm import tqdm
import os
import glob
import pandas as pd
import pickle
import pathlib
def load_beta_estimates(sub_name, contrast_name, mask_name, file_type, stimulus_category='all', postprocessed_data_path='postprocessed_data', root_stimuli_path='../../Aligned-CommonVoice-Dataset',
... |
b596c1982f67ea79d614669b1cbf930943df9e8ecc43b376062be3e96f5d9b7f | Python | 22,930 | 485 | """CAT-NAP runs that analyse several measures of activity at once.
Run from the repo root::
uv run python python/test_catnap_multi_activity.py
``Params.twop_activities`` lets one run build the network from detected calcium
events *and* from the denoised trace (and from raw fluorescence, and from
suite2p's spike ... |
41b118f74dfe724612cb0af638024d8931c5aaf5730887fb4c68ed5248941bad | Python | 22,935 | 481 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import json
import re
import types
from functools import lru_cache
from pathlib import Path
import cv2
import numpy as np
import torch
from ultralytics.utils import ASSETS, IS_JETSON, LOGGER, TORCH_VERSION, Thread... |
05d0c94711e6552e057b1b1123ffa67b6427f0c693849b5f96aab9b0e81d0233 | Python | 22,940 | 645 | # -*- coding: utf-8 -*-
import numpy as np
from numba_kdtree import KDTree
from numba import njit
from scilpy.tracking.fibertube_utils import (streamlines_to_segments,
point_in_cylinder,
sphere_cylinder_intersection)
from scilpy.... |
a9f365a5a9050da0e18d9a683e6eda923b2fdb9eb74a602219d40020c1a24b88 | Python | 22,945 | 507 | # tract_calculation.py as a class
from natsort import natsorted
import json
import numpy as np
import pandas as pd
import distinctipy
import matplotlib.axes as mpl_axes
import matplotlib.pyplot as plt
from skspatial.objects import Line, Points
from typing import List, Tuple
from pathlib import Path
from napari.utils.n... |
d9a618113ad0c083c98d23ef459b28af07993a7ef53be4ae51931d6270f99c83 | Python | 22,948 | 535 | '''
This script performs a subject-level encoding analysis of the
full between-item representational similarity of decoded percepts
during our learning task.
In brief, unlike our main approach where we model within-item
similarity (because it allows us to make relatively few hard
mathematical commitments while being h... |
e52c66d6190fdeb47f1b2a7b749d0c8fb95e034020afdfeebf178f162720bc5f | Python | 22,949 | 486 | # run_cv.py
import os
import json
import logging
import random
import copy
import torch
import numpy as np
import pandas as pd
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from sklearn.model_selection import LeaveOneGroupOut, StratifiedKFold, KFold, train_test_split
from sklearn.metrics i... |
b3cbfd1f02d0ece6d33d29b2fe8e6ad0b5707bef0b47fe334472cdce734e60ee | Python | 22,951 | 663 | # 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, ... |
1b869f96bcfbaf0a7ab4d96d7a66ccc71e26f899523f23f6f8878513fb6b8cd8 | Python | 22,961 | 373 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'elastix_plugin.ui'
#
# Created by: PyQt5 UI code generator 5.7.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_elastixMain(object):
def setupUi(self, elastixMain):
... |
12b5a7b206181e5420cf0760d1e525811e9f6ae58f76775d4bb5c1e638b73959 | Python | 22,974 | 557 | import copy
import warnings
from typing import Any, Dict, List, Optional, Union
import torch
from torch import Tensor
from torch.nn import Module, Parameter
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.dense import Linear
from torch_geometric.nn.fx import Transformer
from torch_geometric... |
81d122338f5cf5fb646b78b421f74f641b24eecb742e2dc5392fa7a3b9e4b99a | Python | 22,976 | 614 | import numpy as np
from nems.registry import layer
from nems.distributions import Normal, HalfNormal
from .base import Layer, Phi, Parameter
from .tools import require_shape, pop_shape
from .weight_channels import WeightChannels
class SwapDims(Layer):
"""Swap two dimensions of an input array.
See also
--... |
5df5f412ba5e96a545efbe4875605a138803b9f6abd6714c15ea4b9747426e85 | Python | 22,982 | 497 | """Does a metric differ by age or by genotype? — the port of ``doStats.m``.
MATLAB fits, per metric, a linear mixed-effects model with a random intercept
per recording, a one-way repeated-measures ANOVA for the age effect within each
group, and pairwise t-tests between ages and between groups, and pours every
p-value ... |
e566ab1b9ded2ee460aef5368eea5e60cae1af99898108d21642c18cbc2d958b | Python | 22,988 | 587 | import numpy as np
import matplotlib.transforms as transforms
import matplotlib as mpl
from . import data_handling as dh
import os
art_colors = {'art':'firebrick','buff':'darkorange','free0':'skyblue','free':'navy'}
def get_datalim(datalist,tvec,tlim,ampfrac=0.05):
datasnip = np.hstack([data[(tvec>=tlim[0]) & (tvec... |
9508d1f3b36d594c16ba5409ab1d64416b1a66275a91cb5a1ad7b74e8a79f041 | Python | 22,990 | 543 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import functools
import random
import yaml
import torch_geometric.transforms as T
import torch.nn.functional as F
from math import ceil
from torch_geometric.data import InMemoryDataset, Data
from torch_geometric.loader import DenseDataLoad... |
55372dd71cb35ec2b41996a1055f7e9e8be20b38d1b5e02c28c1bb560279da7d | Python | 22,998 | 660 | import io
import warnings
from abc import ABC, abstractmethod
from dataclasses import dataclass
from functools import cached_property
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
import torch
from torch import Tensor
from tqdm import tqdm
from torch_geometric import EdgeIndex, Index
from torch... |
1ea0561ce733bce996b03d634c5a7fb03571c49677b3e97413f1350f5a44a1d3 | Python | 23,008 | 499 | # -*- coding: utf-8 -*-
import os
import re
import sys
def find_reference_pcr_file(ref_pcr_name, root_dir):
ref_path = os.path.join(root_dir, 'dat_vestacif_files', 'reference_pcr_format', ref_pcr_name)
if os.path.exists(ref_path):
print("Found reference PCR in reference_pcr_format folder: {}".format(... |
53bf8563ebc18b4de65e54659674dac37241c0452bff32ae220db3d6df1804a0 | Python | 23,014 | 604 | """
Surface plotting functions.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import os
import warnings
from itertools import product as iter_prod
import matplotlib.pyplot as plt
import numpy as np
from .base import Plotter
from .colormaps import colormaps
from . import defaults... |
af034ce33d010add8818893291a1c0dd0a94106c18b3ad6ced4b6868caa46a78 | Python | 23,019 | 428 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import torch
from typing import Callable, List, Optional
# this import is for backward comp... |
3c517f4ab98ba33c7748e70f3474d41c90d2ec32dcf0b402d6aaaef41b26898a | Python | 23,038 | 433 | import os
import datetime
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim as optim
from torch.utils.data import DataLoader
from nets.deeplabv3_plus import DeepLab
from nets.deeplabv3_training import (get_lr_scheduler, set_optimizer_lr, weights_in... |
839f1759d8fbe0240fb46aa2231c26a55a6552a35c289924b5ec0a2c4c06a5cb | Python | 23,041 | 601 | import mayavi
import abagen
import neuromaps
import fcn_megfmri
import numpy as np
import pandas as pd
import seaborn as sns
import sklearn.metrics
import scipy.stats as stats
import matplotlib.pyplot as plt
from statsmodels.stats import multitest
from neuromaps.parcellate import Parcellater
from sklearn.preprocessing ... |
a2458779e651e958110fe374938650d342cc9c1681b2b6dc8100fdfa12f0a2e9 | Python | 23,043 | 568 | import torch.multiprocessing as multiprocessing
import concurrent.futures
import os
import shutil
import time
import numpy as np
import pandas as pd
import torch
import yaml
# Ignite requires version 0.4.12 or 0.4.13 to allow for "save_as_state_dict" option.
from ignite.contrib.metrics.regression import MeanError, Ma... |
b30d4bc32dcf792076310fc9cd832f50df8ad9f399383587619d7a3ac2e7b9e7 | Python | 23,081 | 648 | import json
from typing import Any
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from packaging import version
import seisbench.util as sbu
from .base import Conv1dSame, WaveformModel, _cache_migration_v0_v3
class PhaseNet(WaveformModel):
"""
.. document_args:: seisb... |
c4bc602ca664528074e04e292ffb3102afec46548bc5685e0bcf8fe16c00009d | Python | 23,088 | 648 | from pathlib import Path
import numpy as np
import nibabel as nib
from dipy.core.gradients import gradient_table
from dipy.core.sphere import disperse_charges, HemiSphere
from dipy.io import read_bvals_bvecs
from dipy.reconst.dti import (TensorModel, fractional_anisotropy,
mean_diffusivity... |
5e0bff8215a4a38b4bfd8f518bcc797b39e3f254db23d547d2bec7b7ecbac917 | Python | 23,098 | 610 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Henrik Zunker
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
f4971b2d198b62ca887cb194669e9999fe1c8a9883a38bfd0e094ea2003f0aaa | Python | 23,110 | 610 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Henrik Zunker
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
48b63d7b63e615f242487a1f31f46cc1651e089ee51bd854fd5c05500e0d9906 | Python | 23,127 | 499 | # -*- coding: utf-8 -*-
import os
import re
import sys
def find_reference_pcr_file(ref_pcr_name, root_dir):
ref_path = os.path.join(root_dir, 'dat_vestacif_files', 'reference_pcr_format', ref_pcr_name)
if os.path.exists(ref_path):
print("Found reference PCR in reference_pcr_format folder: {}".format(... |
a2d58676815a9608d4a1b1c23c810bf67a9ced4fd348c57f92665792a82a9a87 | Python | 23,134 | 573 | import pandas as pd
import numpy as np
import shap
import os
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from scipy.stats import pearsonr
from sklearn.model_selection import KFold, StratifiedKFold
from typing import List
from retinad.dataload i... |
63b182a23cf883f1b46270e15192f678513cc146d08dabffc5c80f8eea77eb30 | Python | 23,136 | 530 | import numpy as np
import pandas as pd
from pathlib import Path
import json
import cv2
from typing import List, Tuple, Union
from concurrent.futures import ProcessPoolExecutor, as_completed
from aicsimageio import AICSImage
from skimage.morphology import remove_small_objects
from skimage.measure import label, regionpro... |
630b284a0f49bf9c5c90874e2d06ecf679049298c1ce51a28549150d8ffa174d | Python | 23,141 | 482 | """ Schemas specific to platinum mice. Not the cleanest design/code"""
import datajoint as dj
import numpy as np
from scipy import ndimage
from . import meso, stack
schema = dj.schema('pipeline_fastmeso', locals(), create_tables=True)
@schema
class SegmentationFromStack(dj.Computed):
definition = """ # find th... |
780faf06bb53308611c10b32c089f9441873543e30b58a7d94bb5340fbd8cd8d | Python | 23,146 | 519 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Convex Optimization Modeling for Microstructure Informed Tractography (COMMIT)
estimates, globally, how a given tractogram explains the DWI in terms of signal
fit, assuming a certain forward microstructure model. It assigns a weight to
each streamline, which represents... |
0c97bf6acb8c2c268353397f60a5b6132768986b84fdb8aa5f5ead25895b8858 | Python | 23,147 | 481 | import datajoint as dj
import torch
import numpy as np
from scipy import ndimage
from staticnet_analyses import base
from staticnet_experiments import models as static_models
from staticnet_experiments import configs
from neuro_data.static_images import data_schemas
stimulus = dj.create_virtual_module('stimulus', 'pi... |
5492ec7a58196f42baf506dd70cfd042d38bacdd710d04941185a6d9516179f0 | Python | 23,157 | 597 | #Lucas Sancéré
import os
script_dir = os.path.dirname(os.path.abspath(__file__))
import math
from collections import Counter, defaultdict
import lightgbm
import numpy as np
import xgboost
import yaml
from attrdictionary import AttrDict as attributedict
from sklearn.metrics import balanced_accuracy_score
from sklea... |
9f8f413c470dcd6c8d5f8e79987e8146c40b169464a07648289794968c109ff1 | Python | 23,186 | 594 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
# Based on https://github.com/IDEA-Research/GroundingDINO
from typing import Any, Dict, List, Optional, Tuple
import torch
from torch import nn, Tensor
from .act_ckpt_utils import activation_ckpt_wrapper
from .model_misc import get_activation_f... |
abc1f2e0d3e81cca13408f4ddc2e60e4d9d5a67b9cb7f1cb48d521b0f2c91972 | Python | 23,196 | 696 | # 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, ... |
8143cf39a40cd7e587a32db2398ced17fb4ee607598fc283181294970954384d | Python | 23,197 | 697 | # 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, ... |
01de00c0e3c7bf81df49387cccfb2b6fa78c370ea216459e5118b433a4534fec | Python | 23,203 | 626 | import numpy as np
from numba import objmode
from math import sqrt, acos
from numba import njit
from numba_kdtree import KDTree as nbKDTree
from scipy.spatial import KDTree
from scipy.spatial.transform import Rotation
from scilpy.tracking.fibertube_utils import (streamlines_to_segments,
... |
c94e6f55cce80f993912e6b8e97a62f0542263e039af28b0fd6e2d2c7dfdb42d | Python | 23,211 | 543 | """The ``.meanap`` run bundle — one shareable file per analysis run.
A full run's output folder is mostly pictures: 92 MB and 603 PNGs for one
recording of the CAT-NAP example dataset, against roughly 1 MB of the data
those pictures were drawn from. Every network figure is a pure function of that
data, so carrying the... |
37259f1e5b67890166d4ef1cef3ab53909b964d2a6876e962da9617292f464cb | Python | 23,216 | 521 | from attorch.layers import (SpatialXFeatureLinear, elu1,
SpatialTransformerPooled2d, SpatialTransformerPyramid2d)
from attorch.module import ModuleDict
import numpy as np
from scipy.stats import ortho_group
import torch
from torch import nn as nn
from torch.nn import Parameter
from torch.nn... |
fb7767b544ecad37737b60946f4370b44f2a6b133cff7c872b72a8df3b51028c | Python | 23,236 | 418 | """A module containing utility classes and functions for CoRelAy. This includes as an enhanced :py:func:`zip` function, which ensures that the
sequences being zipped are of equal length. Furthermore, this module contains functions for getting the representations of runtime objects like
functions, methods, classes, and ... |
8f8a4a5b2712e4f3c706e251c827090e4d4c2784a7aef434575371aa4c66f28d | Python | 23,238 | 633 | import h5py
import logging
import numpy as np
import hail as hl
import heig.input.dataset as ds
from concurrent.futures import ThreadPoolExecutor
from heig.wgs.relatedness import LOCOpreds
from heig.wgs.null import NullModel
from heig.wgs.utils import *
from heig.wgs.mt import SparseGenotype
from heig.utils import log_... |
871a4988072a85a6c38477464d2351fe0898be604bd19c0f8f47cd58fec8ded2 | Python | 23,248 | 639 | """Benchmark runner for ChemGraph multi-model evaluation.
Iterates over ``(model, workflow, query)`` combinations, collects
tool-call outputs, and scores them against ground truth using an
LLM-as-judge approach.
"""
import datetime
import inspect
import json
import os
import traceback
from typing import Any, Dict, Li... |
d907855dc88f8e3bde8c12eb4997a543528d3e4c8e02af00c2f956fb72c48ecc | Python | 23,252 | 697 | import numpy as np
import time
import torch
import torch.nn as nn
# from flair.parser.modules.dropout import SharedDropout
from torch.nn.modules.rnn import apply_permutation
from torch.nn.utils.rnn import PackedSequence
from torch.nn.utils.rnn import (pack_padded_sequence, pad_packed_sequence,
pad_sequence)
i... |
ef5a8edafb1076e36e34c5b8786727c797d13778dde7400a867700e57579c743 | Python | 23,293 | 525 | import collections.abc as container_abcs
import torch
from torch import nn
from torch.nn import functional as F
from torch_scatter import scatter_add, scatter_mean, scatter_max, scatter_min
from torchdrug import layers, utils, models
from torchdrug.layers import functional
from torchdrug.core import Registry as R
f... |
5b4f8502e71ab25bc8050e2cec2cd529dbe2e15f4cfa0aee83058719b69f4c8d | Python | 23,312 | 601 | # -*- coding: utf-8 -*-
# genbed: A Python toolbox for generative embedding based classification
# Copyright 2019 Sam Harrison
# Translational Neuromodeling Unit, University of Zurich & ETH Zurich
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... |
bd8fc1cb968890c9f1cdca10542cbd7b5663e4b0d4cbcbffecb3c84232774629 | Python | 23,320 | 585 | import math
from pathlib import Path
import numpy as np
from meanap.pipeline.figure_output import savefig
from meanap.pipeline.rng import derive_seed_int
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import seaborn as sns
from meanap.pipeline.channel_layout import get_coords_fr... |
fb74d0cbe82d98fca06d676a043caaf1ac1539fe06eee010e92a8bf172907b81 | Python | 23,322 | 608 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import itertools
import math
from abc import ABCMeta, abstractmethod
from bisect import bisect
from collections.abc import Iterable, Sequence
from io import BytesIO
import av
import av.audio
import av.audio.frame
... |
de9199ab4dc4f5fb79eaa94cb1ce18ec3d4db9fe9111af041738e78cb7d2d64b | Python | 23,330 | 583 | #pylint: skip-file
#type: ignore
"""
Implementation of the simple task
"""
import time
import math
import enum
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 impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.