sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
f55a57a1cf440fd322252860f3d2495e5a680e39e4bd6f73f2799d50ac8575bd | Python | 20,940 | 654 | #!/usr/bin/env python
# encoding: utf-8
"""
Interface to NRRD volumetric image data files.
The interface is based on nrrd.py, an all-python (and numpy)
implementation for reading and writing nrrd files.
See http://teem.sourceforge.net/nrrd/format.html for the specification.
Example:
>>> import os, numpy
>>> ... |
b3750e96d75a66da9b0d858ccc887bca1e935d007716a8238ecf77a35a4eec35 | Python | 20,978 | 683 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
from copy import deepcopy
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
from sklearn.neighbors import NearestNeighbors
from uac.element import Element
from uac import utils
import uac.vars as var
# Create the parse... |
9971a34294dee3a7360efa72f493d2929af1b643e92cc12a3e31c770be3c309b | Python | 20,994 | 515 | # coding: utf-8
"""Callbacks library."""
from collections import OrderedDict
from dataclasses import dataclass
from functools import partial
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
from .basic import (
Booster,
EvalResult,
_ConfigAliases,
_log_info,
_log... |
227265f6d295a2c8a30e621149e781d0d2db4bdfa102c0d2903e08cd9d1a6aab | Python | 21,011 | 540 | import io
import os
import os.path
import sys
import runpy
import subprocess
import re
import sysconfig
import platform
from skbuild import cmaker, setup
def main():
os.chdir(os.path.dirname(os.path.abspath(__file__)))
CI_BUILD = os.environ.get("CI_BUILD", "False")
is_CI_build = True if CI_BUILD == "1" e... |
de937e2c671567540404cd5d42cda75d99fd045894394b7105c09e9193f61b1c | Python | 21,012 | 574 | import numbers
import warnings
import weakref
from collections.abc import Callable, Iterable, Iterator, Sequence
from enum import Enum
from types import DynamicClassAttribute
from typing import (
TYPE_CHECKING,
Any,
Union,
)
from torch.utils.data import DataLoader
from eir.train_utils.ignite_port.utils im... |
d9983c603b8d4ee31e7e7e6212e52a1f35390de19c9be2847500926eabbed564 | Python | 21,032 | 574 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create a json file from a BIDS dataset detailling all info
needed for tractoflow
- DWI/rev_DWI
- T1
- fmap/sbref (based on IntendedFor entity)
- Freesurfer (optional - could be one per participant
or one per participant/session)
The BIDS dataset MUST be... |
bce750036024934e0cdd501994188bda5afe351c60a2694d1d0d2197b7d806a2 | Python | 21,033 | 474 | import json
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
from typing import Dict, List, Optional, Tuple, Union
from pathlib import Path
from magicgui.widgets import FunctionGui
import matplotlib.pyplot as p... |
ef0f66f5a2f2e902f5c4e9550bcc5c78959286b5e4c10f37879254a52e1bf19a | Python | 21,033 | 335 | import numpy as np
import sys
import os
from scipy.stats import pearsonr, false_discovery_control
from sklearn.metrics import r2_score
import matplotlib.pyplot as plt
import pandas as pd
import sys
from ism_performer import *
import argparse
#import warning that will happen if model predicts same value for every perso... |
15512a0b19bb9b3686a0f3789648d6a7a36f4a21967eb60d9bd70a410197bb30 | Python | 21,037 | 459 | '''
This script performs subject-level reconstruction of gammatones from
the corresponding EEG data.
In brief, we collect audio and EEG data for morphs (during learning
task) and clear words (during listening task). We then build reconstruction
models that map EEG data back to gammatones (using temporal response
funct... |
fa54718f57ea4ae2c43180b5561b29d067474111daebd50cb2376afd91aa5f8b | Python | 21,058 | 562 | # -*- coding: utf-8 -*-
import heapq
import logging
import time
from dipy.tracking.metrics import length
from nibabel.streamlines.array_sequence import ArraySequence
import numpy as np
from sklearn.preprocessing import MinMaxScaler
import scipy.ndimage as ndi
from scipy.spatial import KDTree
from scipy.spatial.dista... |
75bffb884d4598f2dc0e703e9e3639313287f84887a026a8047b34532d15b323 | Python | 21,061 | 471 | """ Split dataset into train, tune, and test sets """
from os.path import join, isfile, isdir, basename
import os
from collections.abc import Iterable
import hashlib
import logging
import numpy as np
from sklearn.model_selection import train_test_split
import utils
logger = logging.getLogger("nn4dms." + __name__)
lo... |
81c0507480c3f7a6471fc99d59de67654585a395ae25cc4979ddaa9192f997f2 | Python | 21,074 | 576 | #Lucas Sancéré
import os
script_dir = os.path.dirname(os.path.abspath(__file__))
import lightgbm
import numpy as np
import xgboost
import yaml
from attrdictionary import AttrDict as attributedict
from sklearn.metrics import balanced_accuracy_score
from sklearn.model_selection import LeaveOneGroupOut
from histo_min... |
9060a36323a62bbec92e28e41eac2aeb6a49294026f391db562e4329d508ed8d | Python | 21,077 | 396 | import os
import tempfile
import unittest
from pathlib import Path
import numpy as np
import pandas as pd
from dtiplayground.dmri.fiberprofile.analysis import profile_qc
def _write(path, text):
Path(path).parent.mkdir(parents=True, exist_ok=True)
Path(path).write_text(text)
return str(path)
COLUMNS = ... |
5b717d2db59814513c0a94244d051559f4bd0bf5ba692951f3fafadca99f7dc9 | Python | 21,086 | 585 |
#!/usr/bin/env python3
"""
Utilities for laminar quality metrics on Schaefer parcels.
We compute FOUR voxelwise metrics:
1) tSNR_orig = mean(orig) / std(orig) (classical tSNR)
2) tSNR_resid = mean(orig) / std(residual) (hybrid post-regression)
3) R2 = 1 - var(resid) / var(orig) (variance ... |
8b9ba2ff2204a97024db4da512e43f0211afaedf4d3e613de06af024a0355b28 | Python | 21,087 | 494 | #!/usr/bin/env python3
import os
import sys
import time
import json
import getopt
import numpy as np
import pandas as pd
import scipy.ndimage as nd
from subprocess import check_call
from skimage import io as skio
from skimage import img_as_ubyte
import skimage.morphology as sm
from skimage import filters
from PIL impo... |
68c68d25f7231ec4be037c975d400aa9aa4c0a3981bb6fd4db006e200f86ca33 | Python | 21,091 | 547 | #!/usr/bin/env python3
# Copyright 2024 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apac... |
c4896407ae554027df56c756ffbe65b65a52754602431d9d9d29b360ae37847d | Python | 21,092 | 353 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import plotting_related_functions
import KC_population_calcium_rate_model_functions as mdl
import os
from sympy import nsolve
from sympy.abc import x,y,z
rng = np.random.default_rng(666) # Set random seed
extensions = ['... |
6799a6f0211577d0859463f1c8c0d8bccfec363706bb3624dcfb7a435a7f23d7 | Python | 21,102 | 461 | from math import gcd, prod
import re
from collections import defaultdict
from typing import Dict, List
from copy import deepcopy
from collections import defaultdict
class LayerNode:
def __init__(self, layer_id, layer_attrs, node_name="", type=None):
"""
To construct each layer node, algorithm equa... |
3679a77538ba555781b9ab00d1233bd2f0fadcb41ba24b73e53688556a7e3e24 | Python | 21,110 | 481 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Scores input tractogram overall and bundlewise, based on reference 'ground
truth' bundles. This script will segment a tractogram into many bundles using
a list of criteria for each (given in a config file), and compare the
segmented bundles with the reference bundles.... |
7dd08d0ac450124c88927f16d8e854fffd175ec75b4c794d3c93a501ad39aa4c | Python | 21,110 | 493 | import sys
import numpy as np
import keras.backend as K
from keras.models import Model
import keras.layers as KL
from keras.layers import Layer
from keras.layers import Conv3D, Activation, Input, UpSampling3D, MaxPooling3D, AveragePooling3D
from keras.layers import LeakyReLU, Reshape, Lambda, PReLU, ReLU, Softmax, mult... |
d49b106908a9dd15463a7d42aad86c2d5ed660cc24a1d71da6c1be639363f118 | Python | 21,112 | 516 | # Kai Sandbrink
# 26.06.2022
# Implements a bandit task with k regular arms but stochastic transitions
from xml.etree.ElementInclude import include
import numpy as np
import random
from utils import sigmoid
class PeekTakeTorchTask():
def __init__(self, n_arms = 3, alphas = {'peek': 0, 'take': 0},
ti... |
9c5740be21a0ebd65d7dbb85c7c5156caf7fadd0e58ec52b49eefd8a18a6fe48 | Python | 21,113 | 535 | #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, ... |
d436eed9f8eb029a3e14b3582076a89cbd49b886b26bcaa5b0aa30b0d6cafd47 | Python | 21,113 | 515 | """Test the Dropbox share-link store.
Run from the repo root::
uv run python python/test_remote_dropbox.py # offline
MEANAP_DROPBOX_URL='https://…' uv run python python/test_remote_dropbox.py
The default run uses a fake HTTP layer and needs no network. That is not a
convenience: the interesting cas... |
5e7732eb8c353117acb2995c3dc1faab99531be130a754379121fe28369727ff | Python | 21,118 | 445 | import pytest
import torch
import SimpleITK as sitk
import numpy as np
from pathlib import Path
from time import sleep
import logging
import subprocess
logging.basicConfig(level=logging.INFO)
# Import FireANTs components
from fireants.registration.moments import MomentsRegistration
from fireants.registration.affine im... |
c1e559481fa8f182cdcd51393ae7fcbcd66431c8518c41694977f9fbb5a4aa39 | Python | 21,124 | 549 | import h5py
import scipy
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
from scipy.spatial.distance import cdist
from sklearn.decomposition import PCA
data_dir = "../data"
cmap_dir = "../data"
mappers_dir = os.path.join(data_dir, "mappers")
train_participants = ["p01", "p02", "p03", "p04"]... |
81d100a3ed381e65153d4e68c8ba100df55382b9d598e7ecc70fbdaf221a5227 | Python | 21,134 | 709 | import builtins
import sys
from types import SimpleNamespace
import cv2
import numpy as np
sys.path.append("./src")
from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.model.prediction import (
RegistrationTransformPredictor,
homography_to_registration_points,
offsets_to_homography,
)
from na... |
cb368735bb126e6e49381a12d3f5dca1354a751ff164eb44587d331093d4dc7d | Python | 21,139 | 490 | import sys
import torch.nn as nn
import torch
from torch import Tensor
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
def get_arry(branch, inputlen, outputlen, replace=False):
mask = np.zeros([branch * outputlen, inputlen])
section_size = int(inputlen / branch)
# pri... |
b7b84f7f414bdf71b2dbee92ee0abbfd95091b89879ffbdcb69cc8da0b8929a4 | Python | 21,158 | 481 | import json
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
from typing import Dict, List, Optional, Tuple, Union
from pathlib import Path
from magicgui.widgets import FunctionGui
import matplotlib.pyplot as p... |
c3945fb12a0d65f6ca4c12c5cc9717426afaa8b169f7713be9ec471dd9bd255d | Python | 21,182 | 609 | """
Support for reading and writing the LAV format produced by the `blastz`_
pairwise aligner.
.. _blastz: http://www.bx.psu.edu/miller_lab/
"""
import sys
from io import StringIO
import bx.seq
from bx.align import (
Alignment,
Component,
src_merge,
src_split,
)
class Reader:
"""Iterate over al... |
3d20fff10692cb496e2b97a51f5f064b9d5101e3608b222c85135171f7d0187f | Python | 21,183 | 474 | # 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
... |
ee998ef05649c89c4e00f29145dbf02ee4d8c4f09f7f44192078896f793a32a1 | Python | 21,185 | 469 | import ANNarchy as ann
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import os
plt.rcParams.update({'font.size': 40})
plt.rc('axes', labelsize=30)
plt.rc('xtick', labelsize=20)
plt.rc('ytick', labelsize=20)
plt.rcParams["font.family"] = "serif"
plt.rcParams["mathtext.fontset"] = "dejavuserif"
... |
119ce448830674839e2bd2f1da926912c9946ffd63eb588d6cd704699ecb3cd1 | Python | 21,188 | 600 | import numpy as np
from dipy.reconst.vec_val_sum import vec_val_vect
from dipy.reconst.dki import _positive_evals
from dipy.core.gradients import gradient_table
from dipy.reconst.base import ReconstModel
from dipy.reconst.dti import (TensorFit, design_matrix, lower_triangular,
eig_from_lo_... |
9934be852619a91fe2c18f5e036c72cac7b979c82318d493a60b49f76d0f5c19 | Python | 21,201 | 673 | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 16:13:56 2015
@author: ckirst
"""
##############################################################################
# Test Alignment
##############################################################################
import os;
from iDISCO.Parameter import *
from iDISCO.Ru... |
961e331a4c150c59d7540f2201970de62513db1585b62975c7efc8bb47cf5c28 | Python | 21,209 | 468 | """The Stats & ML tab: analysing a finished run.
This step differs from every other tab in what it acts on. The pipeline tabs
configure a run over *raw recordings*; this one reads a run that already
finished — a folder or a ``.meanap`` bundle, this session's or one from last
year — so the first thing the panel does is... |
56e394102698e59a7eb6335e72a70c88319e5afb9928530148018b29384c6c2f | Python | 21,227 | 559 | #!/usr/bin/env python3
"""
Voxel Analysis CLI Tool
Processes batch-aligned FCS files to generate voxel occupancy analysis.
"""
import argparse
import sys
import logging
import time
import itertools
import numpy as np
import pandas as pd
from pathlib import Path
from typing import Dict, List, Any
from config import lo... |
6ffaeee69c1326f8700e58ab3c37ea79045d0d36b107aac29c22a61ff1484f71 | Python | 21,230 | 622 | from copy import deepcopy
from math import isclose
import numpy as np
import pytest
import torch
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import LabelEncoder, StandardScaler
from eir.models.output.tabular.mlp_residual import ResidualMLPOutputModuleConfig
from eir.models.output.tabular... |
9911556559d89a2ccb4aebb83c221f758be09924a18bb0215b715f0e49b5304c | Python | 21,230 | 622 | from copy import deepcopy
from math import isclose
import numpy as np
import pytest
import torch
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import LabelEncoder, StandardScaler
from eir.models.output.tabular.mlp_residual import ResidualMLPOutputModuleConfig
from eir.models.output.tabular... |
243bda2045fd10274f04c8a389a01799f4a303c7cc367806070db2e3acedf20b | Python | 21,233 | 614 | # -*- coding: utf-8 -*-
import nibabel as nib
import numpy as np
from numpy.testing import (assert_array_equal,
assert_allclose,
assert_array_almost_equal)
from scipy.ndimage import (binary_closing, binary_dilation,
binary_erosion, binary_... |
f2bfb3c56c2cddb915b2c83c7c51d1ef4e6925127359670c50aab8f51b848822 | Python | 21,243 | 540 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# *************************************************************************** #
# Copyright © 2022, UChicago Argonne, LLC #
# All Rights Reserved #
# Softwar... |
b745cbe5797973396e4abe6d3be1e89e34dee692f7bd535df8222197892e3718 | Python | 21,245 | 609 | from typing import Optional
import timm
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from torchvision.models.resnet import BasicBlock
from torchvision.models.resnet import ResNet
# ------------------------------------------------------------------------... |
132df14367b7726a1a2930c1bee24eecad7a7cc7a994529e2f7d244e588fb342 | Python | 21,247 | 653 | #!/usr/bin/env python
"""
Interface to Point Grey's PySpin Python module.
Tested with "Spinnaker 1.19 for Python 2 and 3 - Windows (64-bit)".
Updated to handle Spinnaker 2.0
Note: As currently written this is designed to work with 12 bit cameras. See
onImageEvent() in SpinImageEventHandler class.
Hazen 01/19
J... |
0a3a7de8d669db04bbe1f3bbb1b4919e93916749c1c5ff3bc70661a4829c5f7b | Python | 21,251 | 378 | # 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... |
b28e355c5f058424cf5cb5b5a2aefb54b1a86149d08ae6067201b687c4b70a61 | Python | 21,255 | 624 | # 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, ... |
2d7bc4874049b00e07ac11855b896bb9f5ad7a957d8f40c47cdd3f5353c05f0a | Python | 21,269 | 334 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# def readScore(file : str) -> pd.DataFrame:
# data = {}
# with open(file, 'r') as f:
# for line in f:
# line = line.strip()
# if line.startswith("Tool"):
# tool = line.split(": ")[1]
# data... |
9e2b7f94fde77b25eff7c5173fdbc945512688353c31a7416406a579c1e5713d | Python | 21,277 | 454 | import boto3
import json
import base64
import re
from urllib.parse import unquote_plus
from botocore.exceptions import ClientError
from botocore.client import Config
import os
import time
CONFIG_BUCKET_NAME = "kuceyeski-wcm-web"
UPLOAD_BUCKET_NAME = "kuceyeski-wcm-web-upload"
CONFIG_FILE_KEY = "config/ec2-launch-confi... |
6f808854faac4fdc6395b2d09857e234f18246b81920d6bc66e1d14a3457985a | Python | 21,282 | 523 | """Step-1 spike-detection check figures, and the small payload they draw from.
These three figures are the only quality-control record of what spike detection
actually did, and they are the ones a bundle could not rebuild: they are drawn
from the raw voltage, which is gigabytes and deliberately never travels.
But alm... |
c7727d6bf82d551434f929a12757d417a3bdc44c0ff43f7fbf09e4a09a95abf3 | Python | 21,293 | 581 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import io
import itertools
import os
from logging import Logger
from pathlib import Path
import pytest
from cvat_sdk import Client, models
from cvat_sdk.core.proxies.annotations import AnnotationUpdateAction
from cvat_sdk.core.proxies.tasks import R... |
1ec20ea6a81104d99221bf16c80bf08be689fea558720826098107570be909a4 | Python | 21,296 | 325 | import numpy as np
orig_strl_additional_exit_point = np.array([[79.61719, 77.53906, 6.65625],
[78.76172, 77.984375, 6.90625],
[76.64453, 79.69531, 8.03125],
[74.41992, 81.609375... |
638a993bba21f0697739238d10a3f237fe8b64a315984b193aa0a440c1544dca | Python | 21,299 | 434 | import datajoint as dj
from datajoint.jobs import key_hash
import numpy as np
import matplotlib.pyplot as plt
from commons import lab
from pipeline import shared
import os
from . import experiment, notify
from .utils import h5
from .exceptions import PipelineException
schema = dj.schema('pipeline_treadmill', locals(... |
6e97214307631a147edce32204a33f817e86781b7020fe054b3c98cdee0163e2 | Python | 21,303 | 459 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# A basic class for the control of the new MVP valves from Hamilton: MVP4
# ----------------------------------------------------------------------------------------
# Jeff Moffitt
# 11/20/21
# jeffrey.moffitt@ch... |
a39a7cd63fced2d2cd4c80eb03e5a6d3e755ea8873bec6d21d742fff97a4cad4 | Python | 21,307 | 708 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import logging
import os
import sys
from enum import Enum
from http import HTTPStatus
from pathlib import Path
from subprocess import PIPE, CalledProcessError, run
from time import sleep
import pytest
import requests
import yaml
from shared.utils.c... |
395df4eaea4f7dc26755f7e65bdca869673cddcb3f7c2e19019fc5ce03e94700 | Python | 21,323 | 560 | """Contains the tests for the image processing helper functions of ViRelAy"""
import numpy
import pytest
from PIL import Image
from virelay.image_processing import (
add_border,
center_crop,
render_heatmap,
render_superimposed_heatmap,
generate_heatmap_image_using_matplotlib,
generate_heatmap_... |
d2a774faf3eead25d67b428629c171d663170ef711b3acebfdf1d09cd67018dd | Python | 21,328 | 674 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
from copy import deepcopy
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
from sklearn.neighbors import NearestNeighbors
from uac.element import Element
from uac import utils
import uac.vars as var
# Create the parse... |
33c9d26a30e51b952b54a9ed5bb138afcbbfbe0480fa08051923c068aa3647c7 | Python | 21,340 | 455 | import torch
import torchvision
import torchvision.transforms as T
from torch.utils.data import DataLoader
import os, sys, math
from copy import deepcopy
import numpy as np
import h5py
import gc
from EIANN import Network
from EIANN.utils import (read_from_yaml, write_to_yaml, analyze_simple_EIANN_epoch_loss_and_accura... |
862ca0daa33fe2b18fa78dc33722ac9d043df6520c3b0d5ce17d81b389ed54c3 | Python | 21,341 | 511 | """Batch (group × age) comparison figures for the CAT-NAP path.
The electrophysiology pipeline ends steps 2 and 4 by pooling every recording
and drawing half-violin comparisons across experimental groups and ages
(``plot_step2_group_comparisons`` / ``plot_step4_group_comparisons``); MATLAB's
suite2p branch does the sa... |
b8f810cf127c67f735c6cf5f3b75901212a104cd520bf3f14a6680f48c5633d0 | Python | 21,347 | 511 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import math
from typing import Any
import torch
import torch.nn.functional as F
def select_closest_cond_frames(frame_idx: int, cond_frame_outputs: dict[int, Any], max_cond_frame_num: int):
"""Select the close... |
078e6ad9ab95ce822454eac633a3442335eec42c46f7b6ff331ddeadba97d987 | Python | 21,362 | 592 | """Provide different loss or metrics classes for labels."""
import tensorflow as tf
from deepreg.constant import EPS
from deepreg.loss.util import MultiScaleMixin, NegativeLossMixin
from deepreg.registry import REGISTRY
class SumSquaredDifference(tf.keras.losses.Loss):
"""
Actually, mean of squared distance... |
9d63ad80cc9447445cb5b1213dfef5909cf91c9146becc922e28fdf40671dbe2 | Python | 21,366 | 618 | # Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
1d6889f6de9d03a050a91fc1c4a90d3714a6f8327addcae438519c51e04951e9 | Python | 21,367 | 580 | """
Plotting functions of YASA.
"""
import warnings
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import mne
import numpy as np
import pandas as pd
import seaborn as sns
from lspopt import spectrogram_lspopt
from matplotlib.colors import ListedColormap, Normalize
__all__ = ["plot_hypnogram", "plo... |
4f6074f3574af894a96909aeb67910779c45dc9178f7f74f6423a0c2a20a2439 | Python | 21,367 | 538 | import math
from typing import List, Optional, Tuple, Union
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn import LayerNorm, Linear, Parameter, ReLU
from tqdm import tqdm
from torch_geometric.explain import Explanation
from torch_geometric.explain.algorithm import ExplainerAlgorit... |
6bfffc12150d6605cffbe27c0305f12e98b83bbaa28f4b52e17166d31e7aaedf | Python | 21,370 | 623 | import sys
import yaml
import os
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.decomposition import PCA
pathpath,myrun,ncluststr,cmethod = sys.argv[1:]
'''
myrun = 'runCrespZP_brain'
pathpath = 'PATHS/filepaths_carlen.yml'
ncluststr = '8'
cmethod = 'ward... |
810589ef8e989cb40c282a203c73558a728f31d8d5ffcaaa5041a37d5e210b79 | Python | 21,380 | 451 | #!/usr/bin/env python
"""
Camera control specialized for an Andor ECCMD camera.
Hazen 04/17
"""
import copy
import os
from PyQt5 import QtCore
import storm_control.sc_hardware.andor.andorcontroller as andor
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.sc_library.para... |
d3ed16ac853c2edb676a59a768c28eb56d1052e363ca15cf2f2b4715cfcea853 | Python | 21,380 | 451 | #!/usr/bin/env python
"""
Camera control specialized for an Andor ECCMD camera.
Hazen 04/17
"""
import copy
import os
from PyQt5 import QtCore
import storm_control.sc_hardware.andor.andorcontroller as andor
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.sc_library.para... |
4616e8d87e9d4fb8e116ad7ac7f0fdc1348f8ffb2a6e261165631b7875ae0cd1 | Python | 21,391 | 607 | """
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... |
6f9b78e190f3cce33f2d3c970cf6d1c32e6415c42e88a78860d4b4a910fb3d45 | Python | 21,392 | 538 | #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... |
cf98a3a3263889dfe2d3de66d4a0918fa2dea0476e82e81582eb1c8a360e2bce | Python | 21,394 | 453 | # Kai Sandbrink
# 2022-10-18
# Script that contains training loop for given specifications (takes config file)
# %% LIBRARY IMPORTS
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
import os, random
import itertools
import wandb
import torch
from torch import nn
import torch.nn.functi... |
25427cb59e4abb728acfb92efbe05547002709cb73b6fa2a33bdda1b240e2021 | Python | 21,408 | 461 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# A basic class for serial interface with a series of daisy chained Hamilton MVP devices
# ----------------------------------------------------------------------------------------
# Jeff Moffitt
# 12/17/13
# jef... |
1ba1daf521d3a750e9d58d7c2fab3575ea74c78fd7a87442f20539e868566f2d | Python | 21,411 | 491 | import torch
import torchvision
import torchvision.transforms as T
from torch.utils.data import DataLoader
import os, sys, math
from copy import deepcopy
import numpy as np
import h5py
import gc
from EIANN import Network
from EIANN.utils import (read_from_yaml, write_to_yaml, analyze_simple_EIANN_epoch_loss_and_accura... |
acc9ec58b8c606da0a91a20b013094927a49cdc0f9cb7d1e2f0355c7de00af8e | Python | 21,413 | 518 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import math
import os
import random
from collections.abc import Iterator
from pathlib import Path
from typing import Any
from urllib.parse import urlsplit
import numpy as np
import torch
import torch.distributed as... |
01b73ee0d92ea5b272848c52e4434c9855f911c2abcc4033a6db0247d9ddf3ac | Python | 21,423 | 502 | """A module that contains unit tests for the :py:mod:`corelay.io.base` module."""
import collections
import typing
from types import FunctionType
from typing import Annotated
import pytest
from corelay.base import Param
from corelay.pipeline.base import Pipeline, Task
from corelay.processor.base import Processor, Fu... |
42696dc011ccfd0daea1a5183f39068bc05282518662b7cde107d50fe77e1211 | Python | 21,425 | 462 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# A basic class for serial interface with a series of daisy chained Hamilton MVP devices
# ----------------------------------------------------------------------------------------
# Jeff Moffitt
# 12/17/13
# jef... |
5cb20f4dae6bbdf39ba51dff60e6599685d3226cfb9ec041f7e27e94e4b8babc | Python | 21,435 | 441 | # 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... |
b8c3deae160cb5e911f29b2851fe1f3e4f31dd725728d45e95d59ee9ae8e797a | Python | 21,438 | 600 | import json
from collections.abc import Callable, Iterator
from copy import deepcopy
from itertools import cycle
from pathlib import Path
from typing import TYPE_CHECKING, Any, Union
import numpy as np
import torch
from aislib.misc_utils import ensure_path_exists, get_logger
from lightning.fabric import Fabric
from PI... |
be98d90018111814956f6cff0016f4f977ff4753b7c60c1765c9f8664b2bc869 | Python | 21,471 | 724 | """Message parsing and molecular-structure extraction helpers.
Every function in this module is **Streamlit-free** so it can be unit-tested
without a running Streamlit runtime.
"""
import ast
import json
import re
from typing import Any, Literal, Optional
from ase.data import chemical_symbols
# -------------------... |
2a9e010a28eca67953371a711753d72c20d1aac6e2e081ea4b033c2d890f851a | Python | 21,476 | 607 | """Atomistic LIne Graph Neural Network.
A prototype crystal line graph network dgl implementation.
"""
from typing import Tuple, Union, List
import dgl
import dgl.function as fn
import numpy as np
import torch
from dgl.nn import AvgPooling
# from dgl.nn.functional import edge_softmax
try:
from pydantic.typing im... |
dc1cffeafcba0bbb45e815c6b948e384aef6a3910ae758ff6c2ad07025bde690 | Python | 21,486 | 638 | #!/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 new atrial coordinates for RA")
# Add the arguments
my_parser.ad... |
de0ed7f9d1b4691b27de77f51b33c21b61777398b5d9972eda4f76910b2b4a63 | Python | 21,488 | 589 | # 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, ... |
efc51ac9576e5ee8c8004212f1b4130f2641c9a0a3bf1037c742ac2cbde8eeda | Python | 21,498 | 533 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 6 10:16:10 2023
@author: gu47yiy
"""
import pathlib
import numpy as np
import re
import pandas as pd
# import tkinter as tk
from tkinter import filedialog as tk_fd
import pprint
import platform
import itertools
import pyarrow
import sys
import functool... |
233c3b4a3d842158cb0ed68b3f0297d9bdb0d959bacca8079dfa6ce64bd3caa0 | Python | 21,521 | 290 | ADE150_CATEGORIES = [
{"color": [120, 120, 120], "id": 0, "isthing": 0, "name": "wall"},
{"color": [180, 120, 120], "id": 1, "isthing": 0, "name": "building"},
{"color": [6, 230, 230], "id": 2, "isthing": 0, "name": "sky"},
{"color": [80, 50, 50], "id": 3, "isthing": 0, "name": "floor"},
{"color": [... |
f08d25e902138953f21f95c54d5b52d3a9cd4a0d0140e74ac84daf7f63373bff | Python | 21,521 | 574 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import functools
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 DenseDataLoader
from torch_geometric.nn... |
41ca0980f729112caea758e56a58ad06d5a9e54fa27288c26eff52cbcf4857dc | Python | 21,529 | 603 | from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
from shutil import copytree
from typing import TYPE_CHECKING
import pytest
from eir import train
from eir.setup.config import get_all_tabular_targets
from eir.setup.schemas import BasicPretrainedConfig
from eir.train_utils.step_lo... |
032ee86439ccf900f4f08f99902058ee6d33bdcec179449c01523de032845b1e | Python | 21,532 | 565 | # coding: utf-8
from typing import Any, Dict, Optional
import numpy as np
import pytest
import lightgbm as lgb
from .utils import assert_datasets_equal, np_assert_array_equal
pa = pytest.importorskip("pyarrow")
# ----------------------------------------------------------------------------------------------- #
# ... |
03f0aae49c1629b333bad001f75261b44199e7b057fdc859485bf71ef9d8f434 | Python | 21,540 | 459 | import tkinter as tk
from .base_window import BaseWindow
import os
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy.signal
import pandas as pd
from tkinter import filedialog, messagebox
import threading
from unittest.mock import patch
# -------------------------
# Helper Function: process_an... |
c3991bea76c9b5414493005ef0607de196a7e95705e8eec6ef4da7f606a1e150 | Python | 21,545 | 603 | from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
from shutil import copytree
from typing import TYPE_CHECKING
import pytest
from eir import train
from eir.setup.config import get_all_tabular_targets
from eir.setup.schemas import BasicPretrainedConfig
from eir.train_utils.step_lo... |
63160a7a7787884814fe8dcd287f095147b1585ebad878294448d39e17399c61 | Python | 21,550 | 551 | import SimpleITK as sitk
import numpy as np
import torch
import cv2
import tkinter as tk
from tkinter import messagebox
from PIL import Image, ImageTk
from torchmetrics import Dice, JaccardIndex
class SegmentationGUI:
def __init__(self, master, seg, gt=None):
self.master = master
self.seg = seg
... |
cf3c49340385b4e928152e74de63eed90f0967ac6a53290fce78ea468017f6db | Python | 21,550 | 607 | import json
from collections.abc import Callable, Iterator
from copy import deepcopy
from itertools import cycle
from pathlib import Path
from typing import TYPE_CHECKING, Any, Union
import numpy as np
import torch
from aislib.misc_utils import ensure_path_exists, get_logger
from lightning.fabric import Fabric
from PI... |
e51a7ce10cc4f06627714d3bb52b15e2a1be049138f8a4cb8fa92e0eb5a28865 | Python | 21,559 | 509 | import numpy as np
import pandas as pd
import scanpy as sc
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
import umap
import anndata as ad
from palettable.cartocolors.qualitative import Vivid_4
from palettable.cartocolors.qualitative import Vivid_3
from palettable.car... |
032422fe615b1bd9aa33a6925d2d8c5704b2363753c118049a53868d19b5d703 | Python | 21,561 | 534 | """
.. module:: SOMZ
.. moduleauthor:: Matias Carrasco Kind
"""
__author__ = 'Matias Carrasco Kind'
import numpy
import copy
import sys, os, random
import warnings
warnings.simplefilter("ignore", RuntimeWarning)
try:
import somF
SF90 = True
except:
SF90 = False
def get_index(ix, iy, nx, ny):
return ... |
e8c79cf6b26d4097a000a8dd905ca411233fd85a4bb952b4e53f680b35b40ab5 | Python | 21,568 | 566 | import numpy as np
import soundfile as sf
import matplotlib.pyplot as plt
class LMSNoiseCanceller:
"""
A class that processes the main signal (= desired signal + noise) and noise reference signal with an LMS filter,
and outputs the noise-cancelled audio (error signal).
Supports two filter modes:
... |
927d511e0b494307e5e8104893f28addf27425999eab0ec83452bbf1f3b4df17 | Python | 21,569 | 678 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Convolution modules."""
from __future__ import annotations
import math
import numpy as np
import torch
from torch import nn
__all__ = (
"CBAM",
"ChannelAttention",
"Concat",
"Conv",
"Conv2",
"ConvTranspose",
"DWConv",... |
7868239de4ceff428fbc3deebc945c86e3502385dd7d602d14834d9e62554cbc | Python | 21,572 | 617 | """Plot the analyses results for individual NSD-synthetic image classes.
Parameters
----------
subjects : list
List of the used NSD subjects.
zscore : int
Whether to z-score [1] or not [0] the fMRI responses of each vertex across
the trials of each session.
model : str
Name of deep neural network model used to ext... |
f63907832db459e00a27dde5b64d1d085381ffefad61edd6c1146bfffe9fe7bd | Python | 21,581 | 540 | # Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import math
from collections.abc import Sequence
from functools import partial
from typing import Any
from unittest import mock
from django.contrib.auth import get_user_model
from django.test import TestC... |
8dc994a9317a250007008baf8c57424951c19937e2f1eedd3a896461549c3342 | Python | 21,587 | 553 | #pylint: skip-file
#type: ignore
"""
Implementation of the context dependent reach task
"""
import time
import math
import typing
import asyncio
import logging
import datetime
import numpy as np
import os
import stl
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import wait_for, wai... |
58cc0edb0b59a31ff39f368a641b1ed52993b2b38b05963cf368d2786237243b | Python | 21,594 | 633 | import json
from collections.abc import Generator, Iterator, Sequence
from copy import deepcopy
from dataclasses import dataclass
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Union,
)
import numpy as np
import torch
from aislib.misc_utils import ensure_path_exists
from diffusers.schedu... |
ea2fcc37fc686af2647a00ac5a7ab387b99c909a2e2ed2cf1bd03fb1da6f300f | Python | 21,594 | 701 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 15 14:46:09 2022
@author: proussel
"""
from collections import namedtuple
from abc import ABC, abstractmethod
import os
import sys
import warnings
from itertools import repeat
import multiprocessing.pool as mpp
from tqdm import tqdm
import time
im... |
0bdec47a1176611b5ffd7a07d10afd04d2525c7f09ff700f1569e9696b997e48 | Python | 21,599 | 411 | from qiskit import QuantumCircuit
from qiskit.quantum_info import Operator, random_statevector, partial_trace
import numpy as np
from my_tensornetwork import MyFiniteMPS
class MyNdarray:
def __init__(self, arr:np.ndarray):
self.arr = arr
# we can use A^B instead of np.kron(A,B)
def __x... |
e3747ad33b5a2b372412cc6473bfccd419813f7727fef93ea63c1699fc0d1a9b | Python | 21,602 | 563 | """In-memory job tracker for async remote execution backends.
Tracks ``concurrent.futures.Future`` objects returned by
:meth:`ExecutionBackend.submit` so that MCP tools can return
immediately after submission and provide separate status / result
retrieval endpoints.
Each MCP server process creates its own ``JobTracke... |
af8a1eb2928b10e39baca500c1c07dc59cc6aa4e56d9b226ae3de6d9764ca420 | Python | 21,611 | 407 | # 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
... |
ea63e617b03fa25cdcae7632109b614011fcede743f97bb875a476b36cdca262 | Python | 21,614 | 578 | # coding=utf-8
from typing import List, Optional, Tuple, Union
import tensorflow as tf
import tensorflow.keras.layers as tfkl
from tensorflow.python.keras.utils import conv_utils
from deepreg.model import layer, layer_util
from deepreg.model.backbone.interface import Backbone
from deepreg.model.layer import Extracti... |
f9acef5755c4e5a6c9fb71405ee101ab8dda2f0e31e28de1bd9248a6f06680ca | Python | 21,628 | 517 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.