sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
2213bc2b82ec12790cbbddbe1564da126af7aedf3442a0a7ea81a02b955f5f04 | Python | 17,278 | 436 | # Copyright (c) 2023 Khaleelulla Khan Nazeer, Anand Subramoney, Mark Schöne, David Kappel
#
# 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
#... |
56519de82ea4cec7c799c9dc0a77759b9fcc452b020cdfd3a7a73bc9177cbd19 | Python | 17,278 | 476 | # -*- coding: utf-8 -*-
from itertools import count, takewhile
import logging
from dipy.segment.clustering import QuickBundles
from dipy.segment.featurespeed import ResampleFeature
from dipy.segment.metric import AveragePointwiseEuclideanMetric
import numpy as np
from dipy.tracking.streamlinespeed import set_number_o... |
8e212c1e62023f36d2ec47cfaaf9bb1f2725eee0fec130362ebd72ae5203f890 | Python | 17,293 | 538 | """
make plots of slopes for different factors and regression coefficients
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import pandas as pd
from sklearn.linear_model import LogisticR... |
5def06f190c321593e95c343bc90c59d04c13b7c4321b80b47c0c809dcf08347 | Python | 17,298 | 488 | import tempfile
from argparse import Namespace
from collections.abc import Generator, Iterable, Sequence
from copy import deepcopy
from pathlib import Path
from typing import Literal, Protocol
from eir.predict_modules.predict_config_validation import (
validate_predict_configs_and_args,
)
from eir.predict_modules.... |
747c0d045e6474385e02b3b9771038297c604692144fb35cac3d6711950530d3 | Python | 17,298 | 538 | #!/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 numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from subprocess import PIPE, Popen
from os.path import joi... |
3c6b8bc78da2833bfba85d1bc6721110168aacdce2d9a35a1119e724fc7ceff9 | Python | 17,301 | 384 | import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
from sklearn.preprocessing import StandardScaler
from scipy.linalg import null_space
from sklearn.decomposition import PCA
from numpy.linalg import svd
import torch
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection impor... |
7a5e98ff542284c054815639d599f1f67f66a4c00ef5fa71a0f31d9efa18f260 | Python | 17,310 | 419 | # coding: utf-8
# (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 agre... |
1d1da63ba1bbc29a7ccde70fecef5a5fb872088a282b091f69be18d395079a62 | Python | 17,318 | 406 | """数据预处理模块(StrabismusProject)
================================================
单一函数 **`preprocess_data`**:
``../data/Data_M1D5.csv → 清洗/标准化/编码 → ../data/Data_M1D5_Preproc.csv``
已消除 `FutureWarning`(pandas 3.0)——改用显式赋值而非链式 `inplace=True` 调用。
"""
from __future__ import annotations
import os
from pathlib import Path
from ... |
c85b4c65a131491deb500ed68e3ec724c11ea8acfb1007a2c98876c117a45713 | Python | 17,334 | 557 | """
Comparison Plot: D-PINN vs Stan (Fixed 10% Error)
This script creates a comparison plot between:
1. D-PINN predictions (fixed 10% error version) - evaluated at experimental time points only
2. Stan results (fixed 10% error) - Monte Carlo simulations with sigma1, sigma2 fixed at mean values
Both methods:
- Use fix... |
c571572a8cf6ff8496344377c0de4c38c25352e869c13fd2c3fe99224686c7fa | Python | 17,338 | 416 | """Test the CAT-NAP cell-type subnetwork GUI controls.
Run from the repo root::
uv run python python/test_gui_cell_type_groups.py
Drives the real PyQt6 widgets offscreen (``QT_QPA_PLATFORM=offscreen``, set
below) — no display needed, so this runs anywhere the GUI dependencies are
installed and skips cleanly when... |
26b4e0c9c5fe9b500cd020a721c09fcc01cfe391e8759fa37ac38de4e6356cc2 | Python | 17,339 | 429 | # ---------------------------------------------------------------
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
# ---------------------------------------------------------------
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "Licens... |
e2046beb62fc24c6d5d059ad4ab43ba16129741c6a862a1beb39470cd2552df4 | Python | 17,346 | 335 | # 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... |
b4e8a8cbc0f1a0b4a3502ae89375bab8e538cc369a8d5794ae85ed63321c7680 | Python | 17,350 | 428 | #!/usr/bin/env python3
"""
Train DREAM-RNN models on lentiMPRA datasets using @DREAM_paper tutorial protocols
This script implements the exact DREAM-RNN architecture and training methodology
from the @DREAM_paper tutorial notebooks for lentiMPRA data.
"""
import argparse
import os
# Suppress TensorFlow warnings since... |
820826c17a215c7653ea9561832f6a613d5acfd715b2e7896001562653a1ac76 | Python | 17,354 | 469 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 2 14:24:25 2017
@author: ajaver
"""
from tierpsy.features.tierpsy_features.helper import get_n_worms_estimate, \
get_delta_in_frames, add_derivatives
from tierpsy.features.tierpsy_features.events import get_event_stats, event_region_labels, ev... |
8e9e86f08acd1d6197bd9fbea1bfad5d0631d9c98c54ebde7b2797827497b890 | Python | 17,354 | 361 | import re
import os
import io
import ssl
import sys
import time
import json
import shutil
import tarfile
import zipfile
import pathlib
import asyncio
import argparse
import subprocess
import urllib.request
if sys.platform == 'win32':
import winreg
def is_up_to_date(command: str, regex, required_version):
if shuti... |
bb298b476e07e18fea3d6eafda951c766c54e8cc87bf9b399691fe798645d058 | Python | 17,354 | 400 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib.colors import LogNorm, Normalize
import matplotlib.colors as mcolors
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
def get_cmap_with_black_for_0(cmap='jet', reversed_... |
866a74608aa4d2b5c577b5f537c620a978948d5a4f8b6f363d4d4286351d2d0a | Python | 17,359 | 449 | # -*- coding: utf-8 -*-
import numpy as np
from typing import Literal
from dipy.io.stateful_tractogram import Space, Origin
from scilpy.tracking.fibertube_utils import sample_cylinder
class SeedGenerator:
"""
Class to get seeding positions.
Generated seeds are in voxmm space, origin=corner. Ex: a seed s... |
0ef8cd30c52e4e7af0b1ed4d7041286758c494d1383c967960cfb1f6f26a9ff9 | Python | 17,362 | 411 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Daniel Abele, Martin J. Kuehn
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... |
d12d18ce4a5a2c095b6ddda470a0d8baed179860f6a754c6945457ef0b8d41ed | Python | 17,365 | 496 | """
This script makes behavior plots for the paper, for the two-player human task.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
import m... |
4f2812a0cd7e3eb675b6769821cc6816e81632f7ee723fa2d792d15fc61b0282 | Python | 17,366 | 448 | from scipy.io import loadmat
import numpy as np
from matplotlib import pyplot as plt
import torch
import torch.nn as nn
from torch.optim import Adam
from tqdm import tqdm
from sklearn.model_selection import train_test_split
from matplotlib import rc
font = {'size' : 12}
rc('font', **font)
class StandardScaler:
... |
60cbc6655d719b8e143fe71ea1450961e5dc2f126957f9fb702cbc9cccf0cead | Python | 17,375 | 319 | """Test spike sorting as a step-1 alternative: units become the nodes.
Run from the repo root::
uv run python python/test_spike_sorting.py
Needs the ``sorting`` extra (``uv sync --extra sorting``); without it the
sorter sections are reported as skipped, and the file-format and geometry
sections still run.
Secti... |
236a18ea775a23e152833dd103590a1171518426bc6762aa603398a36dbefd9d | Python | 17,381 | 538 | #!/usr/bin/env python3
"""
Fix or add RG tags based on Illumina-style QNAMEs and update @RG header lines.
Illumina QNAME assumptions
--------------------------
Supported formats:
Pre-CASAVA / legacy:
<flowcell>:<lane>:...
CASAVA >= 1.8:
<instrument>:<run>:<flowcell>:<lane>:<tile>:<x>:<y>:<index>
Derived RG ... |
b7ad51189ea41990bd281ea5292746fe499687150341a8d718cd820c463ced21 | Python | 17,381 | 331 | """Functional connectivity & thresholding settings panel."""
from PyQt6.QtWidgets import (
QButtonGroup, QCheckBox, QDoubleSpinBox, QFormLayout, QGroupBox,
QHBoxLayout, QLabel, QLineEdit, QRadioButton, QSpinBox, QVBoxLayout,
QWidget,
)
from meanap.gui.advanced import AdvancedSection
from meanap.gui.modes ... |
c7281b1cfe10a51da0aed907a22642ef4957639d9dcf474a7bc844649fbedeea | Python | 17,382 | 559 | import torch
import torch.nn as nn
from rdkit import Chem
import torch.nn.functional as F
import numpy as np
from .modules import (
initialize_weights,
activation_dict,
)
import selfies as sf
from collections import Counter
import concurrent.futures
vocabularies = {
"SMILES":{
'<PAD>': 0,
... |
a2d089be4b77f0b01e348e5d8b797ab4712ad746b5012e4055daca647d058077 | Python | 17,384 | 390 | #!/usr/bin/env python
"""Inference script for protein structure prediction using trRosettaX2."""
import os
import argparse
import shutil
import numpy as np
import re
import collections
from utils_trX2dy.utils import (
folding_with_pred_npz,
calculate_reliability_score,
get_npz_from_pred_pdb,
pred_2d_geo... |
3c98ebf09674447c547a35ab06d597008169a2c23e096b1554e8c15c24d6f004 | Python | 17,393 | 396 | import os
import subprocess
import shutil
import nibabel as nib
import time
import csv
import numpy as np
import pandas as pd
from nipype import Node, Workflow, MapNode
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec... |
80feb77fa2ecf2612bed568d02ba4b7ca1841d3d921736426cb20a4d84ec9ffd | Python | 17,395 | 477 | #############################################################################
# Copyright (C) 2020-2025 MEmilio
#
# Authors: Agatha Schmidt, Henrik Zunker, Manuel Heger
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exce... |
3af4388c2122a5866dfb7948e2e2f0cd123d30704ba9e93a28ad50f2377f1dd3 | Python | 17,399 | 402 | from collections.abc import Iterable, Sequence
import torch
from tqdm import tqdm
from transformers.models.auto.modeling_auto import MODEL_MAPPING_NAMES
from eir.utils.logging import get_logger
al_collector_classes = (
type["ChannelBasedRunningStatistics"] | type["ElementBasedRunningStatistics"]
)
logger = get_... |
120346c62964cf079474adcadd209d19ba6c6c82625cbe4c2913128f77bb2535 | Python | 17,401 | 379 | import itertools
import logging
import math
from collections import OrderedDict
import numpy as np
import xarray as xr
from sklearn.model_selection import StratifiedShuffleSplit, ShuffleSplit, KFold, StratifiedKFold
from tqdm import tqdm
from brainscore_core.supported_data_standards.brainio.assemblies import DataAsse... |
ed6b43177e89eafbff0ceacb16cf790590609f7527d340319f712be36bef08cb | Python | 17,409 | 345 | """The Data tab: what you are analysing, and where the results go.
Paths and Recording were two tabs holding one question between them. Recording
had four settings on it — the sampling rate, the downsample rate, the units and
the electrode layout — none of which mean anything without the folder named on
the other tab,... |
6b50549c19f2559b62314680ceccab99be672f022c03b425900c895dd3415e21 | Python | 17,419 | 442 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import shutil
from pathlib import Path
from textwrap import dedent
from unittest import mock
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils im... |
8153ff858c37ab9da16e739a8c589f9cf177aebbe405de3ab457eb0d17772d29 | Python | 17,420 | 403 | from collections.abc import Iterable, Sequence
import torch
from tqdm import tqdm
from transformers.models.auto.modeling_auto import MODEL_MAPPING_NAMES
from eir.utils.logging import get_logger
al_collector_classes = (
type["ChannelBasedRunningStatistics"] | type["ElementBasedRunningStatistics"]
)
logger = get_... |
8799d84301d2a07b8bd53ce3b935ffcbda2d3bd8feaa29cecde8d582329dd191 | Python | 17,420 | 393 | import arbor
from arbor import mpoint
import os.path
import sys
from math import sqrt
def is_collocated(l, r):
return l[0] == r[0] and l[1] == r[1]
def write_morphology(name, morph):
string = "tmp = ["
for i in range(morph.num_branches):
last_dist = None
sections = "["
for seg in... |
8a6fca60c35d357126e0e64f18dcb54b67c6fcf6a9654e08bf6d1b7f6d95fd0a | Python | 17,422 | 419 | #!/usr/bin/env python
"""
This controls a single channel.
Hazen 04/17
"""
import numpy
from PyQt5 import QtCore
import storm_control.sc_hardware.baseClasses.daqModule as daqModule
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
import storm_control.hal4000.illumination.illuminationChan... |
78563888839a5e2b37c13d99b86ef46267d1589ed088fb2b6008679709ede43e | Python | 17,427 | 402 | import os
from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, BaseInterface, BaseInterfaceInputSpec, File)
from traits.api import Directory, Str, List, Bool, Enum, Int, Float, TraitError, Either
from nipype.utils.filemanip import split_filename
from nipype.interfaces.base import ... |
2eeaa8bd977852c2fe2e6ed27a96c40a6d0a9d49a9e67a1c1343c07f6c914f9e | Python | 17,433 | 490 | from typing import Any, Union
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.signal import istft, stft
from .base import WaveformModel
class AttentionGate(nn.Module):
"""
Attention Gate for U-Net architectures.
This module implements an attention mechan... |
b8481b8043ccf9ca78d126326cb27c3fb1cc424417665bbd57e3b22792450ed8 | Python | 17,437 | 452 |
"""
Section 1: D-P rule
"""
import scanpy as sc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
import warnings; warnings.simplefilter('ignore')
from scipy.stats import mstats, kstest, ttest_ind, fisher_exact
import csv
import math
from scipy.stats import pears... |
b408a83520472823dba7fa09dab36d4276135ce6bf015521b6901d7a8552d76e | Python | 17,440 | 440 | import os
import copy as cp
import h5py
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import r2_score, mean_squared_error, classification_report, confusion_matrix, f1_score
from scipy.spatial import Conv... |
e76af0f3ef4a5ad5ce0d8792b22ff547d87b507f6863aa7599403cacb16b90db | Python | 17,443 | 533 | # 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, ... |
59fb64bbb6260d9cfd0c43fabb8f4a5ea917444bd1732e962aa13fb02fd7fc10 | Python | 17,447 | 576 | """Functions that alter the matplotlib rc dictionary on the fly.
Most of these are Copyright (c) 2012-2016, Michael L. Waskom"""
import functools
import matplotlib as mpl
import numpy as np
from packaging.version import parse as Version
from . import palettes
_orig_rc_params = mpl.rcParams.copy()
mpl_ge_150 = Versi... |
c39f660e20eeae64ad7192057bb979894ef34fef0e6f57717e372232d3c09370 | Python | 17,457 | 384 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
"""Connectome wiring module (specialized)."""
from datetime import datetime, timedelta
import libsonata
import neurom as nm
import numpy as np
import tqdm
from connectome_manipulator i... |
1092a2cc0010266b6cb3fdc170a3c0a13e7443efce590ab7a612c81471394ca6 | Python | 17,466 | 536 | # -*- coding: utf-8 -*-
"""
Surface mesh across cortical depth
This scripts cuts through a mesh to show the cortex in its depth. To do so,
cortical depth-dependent vertex points and faces are added after the cut. As a
last step, a new overlay is created to show depth-dependent values.
"""
# python standard library i... |
e132c9deba75888ca46c2eb3922818ba1f5c6c2a27627be6aedef580bc9ce4f0 | Python | 17,470 | 378 | import datetime
import numpy as np
import numpy.typing as npt
from typing import Type
import multiprocessing
from _functools import partial
import scipy.stats as stats
from neuron.units import ms
from numpy import ndarray
from ..neurosim.simulation.simulation import WaveformType
from ..neurosim.simulation.spike_simulat... |
1259a12a4bbb73ffef89718a5046a2b4c010bdb5a2b9ce81e3b425e909626e69 | Python | 17,471 | 537 | import abc
import sqlite3
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import polars as pl
from matplotlib.axes import Axes
from polars.exceptions import ColumnNotFoundError
from rich.pretty import pprint
from scipy.stats import wilcoxon, mannwhitneyu
from argclz import a... |
0eeffeebb0e83bdd66ce692c46ffe2f03d8a044134619eb7f07c539c9734c607 | Python | 17,481 | 485 | import matplotlib.pyplot as plt
import numpy as np
from typing import List, Dict, Set, Tuple, Iterable
import networkx as nx
import ast
from scipy.ndimage import binary_erosion
from CGAL.CGAL_Kernel import Point_3, Vector_3, Point_2
from CGAL.CGAL_Point_set_3 import Point_set_3
from CGAL.CGAL_Polyhedron_3 import Polyhe... |
524e9aba6486ab230ed3ecfaab2c5a9d30f15593c6a077cf7facf6451bfbdcf7 | Python | 17,484 | 560 | import warnings
from collections.abc import Callable
from enum import Enum
from functools import partial
from typing import TYPE_CHECKING, Literal, Union
import torch
from torch import nn
from torchsurv.loss.cox import neg_partial_log_likelihood
from eir.setup import schemas
from eir.setup.output_setup_modules.array_... |
263a51fe525775e2609512c4f31454c3d89578778df1ac8d433925ae479d09d6 | Python | 17,488 | 420 | #!/usr/bin/env python
"""
This controls a single channel.
Hazen 04/17
"""
import numpy
from PyQt5 import QtCore
import storm_control.sc_hardware.baseClasses.daqModule as daqModule
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
import storm_control.hal4000.illumination.illuminationChan... |
42dcd670a938cc00b17206500a05750f87e94b4dc8113044d39911f5f1f88ae1 | Python | 17,488 | 335 | """
If you use this code, please the SynthSR paper in:
https://github.com/BBillot/SynthSR/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot
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:... |
c5bc4af8d0795af2d94e25710e21f853e1ec4b289ecaf3aa1e2bf4eeeb9210fe | Python | 17,498 | 521 | """
Tests for ChemGraph session memory storage.
"""
import os
import sqlite3
from datetime import datetime
import pytest
from chemgraph.memory.schemas import Session, SessionMessage, SessionSummary
from chemgraph.memory.store import SessionStore
@pytest.fixture
def tmp_db(tmp_path):
"""Create a temporary datab... |
ba6be34751c324b15879d9adaa42541ba2d84da9122fcb175505ee9ce978514f | Python | 17,500 | 416 | import jax
import jax.numpy as jnp
import numpy as np
import matplotlib.pyplot as plt
import os
import plot_utils
from scipy.stats import spearmanr, kendalltau, mannwhitneyu, gaussian_kde
import glob
import re
import json
jax.config.update("jax_default_matmul_precision", "high")
plt.rcParams["font.sans-serif... |
815cef0f1f9ffd2aad3e96cc4991e77632b5f629bebf995b973e5427025a3f2e | Python | 17,502 | 543 | #!/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 numpy as np
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
import sys
from su... |
5f91f1d4d19a668e2c66eceb7c404e9589566bedc322d749e9797382946f1891 | Python | 17,503 | 435 | 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 ... |
4d15663dcfc7ccc66d3a369f30b1269f82d021e2746ebd39909cd35819d02157 | Python | 17,509 | 571 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
from collections.abc import Sequence
from dataclasses import dataclass
from enum import Enum
from functools import cached_property
from typing import TYPE_CHECKING, Any
from django.conf import settings
from django... |
e62186f0603581af564a626049fd1879c28efd22a89a4db9a67079e2e997b996 | Python | 17,516 | 554 | import gc
import io
import os
import pickle
import warnings
from typing import Any
from zipfile import ZipFile
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader, Dataset
def get_swow_data(version: int = 1) -> pd.DataFrame:
"""Load SWOW (Small World of Words) data from CS... |
4be8bddf26792bbfdd534d07fb8b0dded7ca1e6d6115f96462957dfc92153d1c | Python | 17,518 | 521 | '''Some helper functions for PyTorch, including:
- get_mean_and_std: calculate the mean and std value of dataset.
- msr_init: net parameter initialization.
- progress_bar: progress bar mimic xlua.progress.
'''
import os
import time
import torch
import torch.nn as nn
from functools import reduce
import opera... |
ca56f4d758e66ba544c801624f69fbe9bcea8aea32277baed6590e71ad2d4730 | Python | 17,520 | 386 | from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set
from brainscore_core.supported_data_standards.brainio.s3 import load_assembly_from_s3, load_stimulus_set_from_s3
def force_stimulus_set_colu... |
4a01d691a25ce5d549056bf2a4b41ab3591063dc3d163df51183de1800f41f3a | Python | 17,522 | 482 | """Regressions for workspace namespaces, approvals, and async checkpoints."""
import json
import sys
from types import SimpleNamespace
from typing import TypedDict
import pytest
from deepagents.backends import LocalShellBackend
from langchain_core.messages import AIMessage, HumanMessage
from langgraph.checkpoint.memo... |
d60cfa2b9bdd021179496c51dfabd334ff82ea65484d5d170cf4c6fbb627fc0a | Python | 17,527 | 484 | # -*- coding: utf-8 -*-
import os
import tempfile
import numpy as np
from numpy.testing import assert_array_almost_equal
import pytest
from dipy.io.streamline import load_tractogram
from dipy.tracking.streamlinespeed import length
from dipy.io.stateful_tractogram import StatefulTractogram
from scilpy import SCILPY_HO... |
5bb9a0f191e1ceaa1c64141a931dff9565b397bcf7ffef402656ee8c5e21b690 | Python | 17,528 | 346 | import argparse
import random,os,sys
import numpy as np
import csv
from scipy import stats
import time
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.metrics import roc_auc_score
from sklearn import preprocessing
import pandas as pd
import keras
import keras.ba... |
5df60a7c5717d869d8b074d7a37404f380a0cab33580418a547da23022e4a2f0 | Python | 17,530 | 360 | # -*- coding: utf-8 -*-
# This function preprocesses raw EEG and PSG data along with their annotation files.
# It extracts ECG, EOG, and respiratory effort (RES) signals from the PSG data and aligns EEG, ECG, EOG, and RES signals
# with their corresponding labels on a per-second basis. The processed data is saved in .... |
f2b526817407422cf31fe1346ade28baff209f7a8f54fca39722bd4e5d8d7084 | Python | 17,545 | 370 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import hashlib
import os
import shutil
from functools import lru_cache
from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import ARM64, LOGGER, USER_CONFIG_DIR, ThreadingLocked
from ul... |
7fac5063bb502c9fabdf7327342e90a9ae17e6a71963bdf1def58bb0dbea9ddf | Python | 17,549 | 407 | import pandas as pd
import numpy as np
import wfdb
import ast
import os
import torch
from sklearn.preprocessing import StandardScaler
import pickle
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
import matplotlib.pyplot as plt
from scipy.signal import butter, filtfilt
# FILE PATHS TO CHANGE
# ... |
340ccf12a3a07ad5536981a595210a9f885845f07fe3ed8711d3a64b0cb2a229 | Python | 17,579 | 360 | import argparse
from .rclone import *
from .analysis import load_plugins
import sys
from .slurm import has_slurm
from .uge import has_uge
from .remote import *
class CLI_parser(object):
def __init__(self):
parser = argparse.ArgumentParser(
description = 'labdata - tools to handle data from shar... |
314988a2032e8e620084002d9fe90f472b419d8836edd1f8c2b4ea9627f37090 | Python | 17,604 | 451 | # 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, ... |
b047f30d086338f9b6a703cc076ae19ac596189ae4fa05b8bc6196b8fa2b7841 | Python | 17,604 | 367 | from typing import List
import flair
from flair.data import Dictionary, Sentence, Token, Label
#from flair.datasets import CONLL_03, CONLL_03_DUTCH, CONLL_03_SPANISH, CONLL_03_GERMAN
import flair.datasets as datasets
from flair.data import MultiCorpus, Corpus
from flair.list_data import ListCorpus
import flair.embeddin... |
41004b63ac411683596ca6bcfdaf8cf1889f24f8efb988405d5f3b64be0deba3 | Python | 17,612 | 493 | import numpy as np
import pandas as pd
from scipy.stats import t
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
from heig.sumstats import read_sumstats
from heig.voxelgwas import VGWAS, voxel_reader, recover_se_numba
from heig.herigc import CommonSNPs
import heig.input.dataset as ds
from numba... |
4637af8b5ac56581c8d448542b08d5694c922c7c57e867d8e27aa007e8de69ad | Python | 17,616 | 535 | from __future__ import annotations
from typing import Final
import numpy as np
import pytest
from PySide6 import QtGui
from labelme._shape import Shape
from labelme._shape import ShapeType
from labelme._widgets._shape_render import Palette
from labelme._widgets._shape_render import ShapeRenderContext
from labelme._w... |
05da452616ec028907ace0a5ae22ac61b286dbdab69b34ceb5762fc5c8c1d5fb | Python | 17,633 | 428 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# The basic I/O class for a Rainin RP1 peristaltic pump
# ----------------------------------------------------------------------------------------
# Jeff Moffitt
# 2/15/14
# jeffmoffitt@gmail.com
# -------------... |
a849a11f3d89342b1d32eeee7ac60c5a6bfc3d2720d7becc9255f25c65091baa | Python | 17,640 | 555 | """
Utility functions for computing and reporting fit quality metrics
such as MAPE, NMAE, and NRMSE.
"""
from typing import Any
import numpy as np
import torch
import torch.nn.functional as F
from mcmlnet.utils.logging import setup_logging
from mcmlnet.utils.tensor import (
TensorType,
array_conversion_decor... |
73f29e1480efa0e921fabc12666ea8d4eacd126f7175052a756b90adb274610f | Python | 17,643 | 463 | import time
import logging
import h5py
import numpy as np
import hail as hl
from tqdm import tqdm
from scipy.sparse import csr_matrix, vstack
from scipy.stats import chi2
import heig.input.dataset as ds
from heig.wgs.null import NullModel
from heig.wgs.relatedness import LOCOpreds
from heig.wgs.mt import SparseGenotype... |
edf93b5b522fe1d01969bd58bd5d417fde833737411a064fbf2c0a06e70311f5 | Python | 17,643 | 463 | import time
import logging
import h5py
import numpy as np
import hail as hl
from tqdm import tqdm
from scipy.sparse import csr_matrix, vstack
from scipy.stats import chi2
import heig.input.dataset as ds
from heig.wgs.null import NullModel
from heig.wgs.relatedness import LOCOpreds
from heig.wgs.mt import SparseGenotype... |
76606cb424bb4ad754cf29fe157ba25c661d8fd11005def2caa95f60c7965e88 | Python | 17,644 | 627 | # -*- coding: utf-8 -*-
import itertools
import functools
import numpy as np
import nibabel as nb
from nibabel.freesurfer.io import read_geometry
from scipy.sparse import csr_matrix, triu, dia_matrix
# local inputs
from ..io.affine import read_vox2ras_tkr
from ..utils.interpolation import linear_interpolation3d
from ... |
729400b595ff7fd96870c2e5f86085fdcd4f6169aa91f584e868802207848238 | Python | 17,648 | 288 | '''
ClH2
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for ClH2:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy and... |
9fb8f15b763702787f7654151978653f8d010edda8648a80e5044fba9266c291 | Python | 17,658 | 458 | # 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, ... |
10cdb0c91e575a52c68151fd8998614c7d3a5ab4be0c5b39f9ae262da29b4607 | Python | 17,660 | 428 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# The basic I/O class for a Rainin RP1 peristaltic pump
# ----------------------------------------------------------------------------------------
# Jeff Moffitt
# 2/15/14
# jeffmoffitt@gmail.com
# -------------... |
99c99ca72d365aaff34bc497a9b66135861abefc8b069d202c16b01762b853b6 | Python | 17,674 | 540 | from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
from sklearn.utils.multiclass import unique_labels
from sklearn.metrics import euclidean_distances
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
import numpy ... |
f4b0f8125156058acc507af47b0ab971a697c55c63b06a9d316a25702a2965c3 | Python | 17,674 | 274 | import os
import subprocess
import nibabel as nib
import scipy.ndimage
import numpy as np
import pandas as pd
from nipype.interfaces.fsl import FLIRT
from nipype import Node, Workflow
from nipype.interfaces.utility import IdentityInterface
from cvdproc.pipelines.smri.lesion_preprocess.lesion_preprocess import LeftRight... |
026ca4de561904811ce990ef57ad7ad40526a7642fde35bbe9ac6a67c116d970 | Python | 17,686 | 356 | # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717)
# Github source: https://github.com/DingXiaoH/RepLKNet-pytorch
# Licensed under The MIT License [see LICENSE for details]
# Based on ConvNeXt, timm, DINO and DeiT code bases
# https://github.com/facebookresearc... |
03f4ac03f5715b35a6b1d9d15b843d0b43320167484143e01cefe70a294486f8 | Python | 17,694 | 369 | # 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... |
c4978e80fd84c5d3cff8c0572993085f891dd4efe810983e7caae3bbe1a8481e | Python | 17,696 | 521 | """
Simulation and mci file handling for MCML simulations.
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:
... |
b2033c62311f85e3c2715e34f4a40ebd8511a632580b8490b66a192869f30113 | Python | 17,709 | 455 | # 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
pl = pytest.importorskip("polars")
# ----------------------------------------------------------------------------------------------- #
# ... |
8400363f7b4a98bbd13264370ee6deb64ecb89a4ca8ef43929471baff8c8ee54 | Python | 17,711 | 345 | import argparse
import random,os,sys
import numpy as np
import csv
from scipy import stats
import time
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.metrics import roc_auc_score
from sklearn import preprocessing
import pandas as pd
import keras
import keras.ba... |
2c0ced15ceed388ec2d0ced712c637bdcf683f495e0954ecc5ae87241ee7819a | Python | 17,713 | 325 | import numpy as np
import numpy.testing as npt
import pytest
import time
from src.wrappers.OsipiBase import OsipiBase
from joblib import Parallel, delayed
import warnings
#run using python -m pytest from the root folder
def signal_helper(signal):
signal = np.asarray(signal)
#signal[signal < 0] = 0.00001
s... |
c181e25b67ae9089e687f0992cbb1bd76e82ca3981d99c1a70459be0193fb926 | Python | 17,728 | 559 | import base64
import json
import os
from collections.abc import Sequence
from functools import partial
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from PIL import Image
from sklearn.manifold import TSNE
from docs.doc_modules.d_array_outputs.uti... |
b62fb190f88a4737403eb149d03ab5b32eb91b6004d5d1445bc60bf12af471dd | Python | 17,735 | 490 | # -*- coding: utf-8 -*-
"""
Phenotypic space -> matrix construction
"""
import obonet
import numpy as np
import os
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib as mpl
from scipy.cluster.hierarchy import dendrogram
import great_library_phenotypes as glp
from... |
8960c737a6ed36002ba5bd64abaf65e8e713de3c87bbc07b27401b40ea11ff2e | Python | 17,736 | 391 | import numpy as np
import torch
import torch.distributed as dist
import torch.nn.functional as F
from time import time
from fireants.registration.distributed.ring_sampler import distributed_grid_sampler_3d_fwd, fireants_ringsampler_interpolator
from fireants.interpolator.fused_grid_sample import fused_grid_sampler_3d
f... |
f8951e8edef7914409440cad87d2863442971f8f3bd1b99367d6ff444e183194 | Python | 17,740 | 386 | # Copyright (c) 2022, Kwanhyung Lee. All rights reserved.
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTI... |
b51aba0bd5710cceae64ad30ea2e68b307b4dd7c787e78b86d8329fc2d058d6d | Python | 17,742 | 390 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# %%
"""
@author: GM
@edit: CD
#-----------------------------------------
Brain AGE v2 - cross-validation
#-----------------------------------------
Age prediction of brain images with convolutional neural networks.
---
Before using this script, pl... |
5bd4568ac5a7c91da1d270c0585e815d08fd38f2c8afe638b338959e38d66631 | Python | 17,750 | 422 | """
Python implementation of the generalized PCA for dimension reduction of non-normally distributed data. The original R implementation is at https://github.com/willtownes/glmpca
"""
import numpy as np
from numpy import log
from scipy.special import digamma, polygamma
import statsmodels.genmod.families as smf
from dec... |
0294734ed1086bd001517702edfca43a03d647941da9f3909cd04b75abd47bcd | Python | 17,752 | 466 |
# Copyright (c) Sheng He/Yangming Ou, Boston Children's Hospital/Harvard Medical School, 2024
# email: sheng.he@childrens.harvard.edu, yangming.ou@childrens.harvard.edu
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software")... |
f78e214f020fb94a4ce908781ce025355cf0f17d11c49d7fa570db65c7e46cd3 | Python | 17,761 | 510 | # -*- coding: utf-8 -*-
import os
import gc
import numpy as np
from tensorflow.keras.utils import to_categorical
from scipy.ndimage import zoom, gaussian_filter
from scipy.interpolate import interpn
from collections import defaultdict
def _parse_index(i, max_i):
if isinstance(i, tuple):
if len... |
31fa8b78cdc8aabfc535de7bf7c607b2dc25913610cdc0d179be92ca1bb24dc6 | Python | 17,762 | 241 | """ This script investigates the features within the components of the trained neural network.
The focus is on the models sensitivity with respect to pixel-wise data augmentation of unseen samples. """
import os
import argparse
from utils.env_config import setup_environment
import timm
from data.dataloader import ... |
71f1217483b6b47d40f6a0bb7824b847e5f8695aade5de8b64860b97bd01e63e | Python | 17,763 | 353 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from collections import deque
from typing import Any
import numpy as np
from ultralytics.utils.metrics import bbox_ioa
from .basetrack import TrackState
from .byte_tracker import BYTETracker, STrack
from .utils i... |
b2e5b0d13e42f1a49272d5a196da9023cf6ca3ffedd3dc8f0a1b957d641abf71 | Python | 17,763 | 376 | import os
from collections import OrderedDict
from typing import Union, List
import numpy as np
import pandas as pd
import xarray as xr
import sklearn.linear_model
import sklearn.multioutput
from brainscore_core.supported_data_standards.brainio.assemblies import walk_coords, array_is_element, BehavioralAssembly, Data... |
954071905351ef0202b50ef5088a9fe8bace6cdbe1ec2eddc7cc50ae74355277 | Python | 17,765 | 488 | # -*- coding: utf-8 -*-
from copy import deepcopy
import logging
from dipy.data import get_sphere
from dipy.reconst.shm import sf_to_sh
import numpy as np
from scipy.ndimage import gaussian_filter
import scilpy.tractanalysis.todi_util as todi_u
MINIMUM_TODI_EPSILON = 1e-8
GAUSSIAN_TRUNCATE = 2.0
class TrackOrient... |
c5a011c28b56499d8d7aadd05afd00ae5c6c1ac1ebcce4bb75ff21e9b5ea84f2 | Python | 17,767 | 481 | import logging
import dipy.tracking.streamline as dts
import numpy as np
from dipy.io.stateful_tractogram import StatefulTractogram
from scipy.spatial import cKDTree
from scipy.stats import zscore
from sklearn.ensemble import IsolationForest
import AFQ.recognition.utils as abu
from AFQ._fixes import gaussian_weights
... |
d510df51d75a617efc2bddf5e645e241aece1c299b16c423b2d3fae231dababa | Python | 17,767 | 345 | # -*- coding: utf-8 -*-
import argparse
import os
import logging
import time
import warnings
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet import gluon
from mxnet import autograd
import gluoncv as gcv
from gluoncv import data as gdata
from gluoncv import utils as gutils
from gluo... |
fc2054e56033b4d7888768cecedd2d3b56ea8488694425af50dc6eabcbd62e02 | Python | 17,767 | 404 | #!/usr/bin/env python3
"""
NTCP Output QA Reporter
-----------------------
Reads the output folder (or zip) created by enhanced_ntcp_analysis.py / enhanced_ntcp_ml.py
and generates:
1) comprehensive_report.docx – human‑readable QA report
2) qa_summary_tables.xlsx – per‑organ summary metrics + unique patient ... |
058b2c1d29fc2a7502d3f37fc010c05df9db1d16012149071a673ed1b1d5f1bc | Python | 17,773 | 490 | import copy
import math
import sys
import time
from typing import Any, Dict, Optional, Tuple, Union
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn.parameter import Parameter
import torch_geometric.backend
import torch_geometric.typing
from torch_geometric import is_compiling
from ... |
8f4838ba72ad838b3217093e432a127863cd307a73038ad6486e9c0ffc0aceed | Python | 17,775 | 535 | #!/usr/bin/env python
"""
Handles telling the acquisition program to get
a picture & converts the captured image into a
QPixmap.
Hazen 03/14
"""
import contextlib
import math
import numpy
import os
import time
from PyQt5 import QtCore, QtGui
# Debugging
import storm_control.sc_library.hdebug as hdebug
# Communicati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.