sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
181302cacad45700009260ea342d1dee18d21d87b22d95e8d715afb503730e94
Python
20,773
431
#!/usr/bin/env python3 """Unit tests for the pure logic of ``scripts/do_schema_release.py``. Covers the naming rules for the standard schema and a library, version checks, the check that ``hed_add_ids`` only added hedIds, CHANGELOG insertion and extraction, and the replacement of a schema's rows in ``docs/schemas_over...
d021fbdc49303ae577a6a30ca81a23f2ab4a68f783f8c50a48e3159f10804748
Python
20,773
604
import win32com.client import os, pdb import time import numpy as np from collections import namedtuple scanmandata = namedtuple('scanmandata',['img_forward', 'img_backword', 'offset_nm', 'len_nm', 'current','dI_dV']) latmandata = namedtuple('latmandata',['time','x','y','current','dI_dV','topography']) dissman...
4cd49bdcc3806f9acebf7cf96a31e577336a42d082af0b52b13d06e7dbf70d61
Python
20,775
522
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import os from fig_utils import * from matplotlib import patches def brain_plot(ax, x, y, cweights, cmap, theta=np.pi*0.77, subsample=5, vmin=None, vmax=None, brain_axes=True): pos = ax.get_...
7cc43fd41cfbbb00bab1cab7ce60b09a28ed5fb4d7fcade5f9bf1bdc229274f4
Python
20,775
571
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
76efc5f48d4da7b04b86836c3028081b472e62b793dc6bf0e63af16114e925e0
Python
20,784
491
"""Utilities for loading and outputting HED schema.""" from __future__ import annotations import functools import json import os import warnings from collections import defaultdict from urllib.error import URLError from hed.errors.exceptions import HedExceptions, HedFileError from hed.schema import hed_cache from he...
e8e124ddbb78d5653b419a22caea153c6b0a394f89fc16c30e1a2e29b2179b46
Python
20,819
581
import functools import itertools import logging import os import posixpath import re import urllib.parse from dataclasses import dataclass from typing import ( TYPE_CHECKING, Any, Dict, List, Mapping, NamedTuple, Optional, Tuple, Union, ) from pip._internal.utils.deprecation import...
2a6faba2c9cf1bffd28c990201684cdec28fa536dbf60b21501bf623e3b91e49
Python
20,828
528
from __future__ import print_function import sys import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import random import os import argparse import numpy as np from PreResNet_cifar import * import dataloader_...
2458705ae1947c66caa7f8bd867ece3e48c4f275b2b46822bb7aada8a7c94e12
Python
20,832
509
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
1c58831bb2cca1a06cf36f56ba8b6b7c8c1c12b38e13150e47f01e06dc3f4c25
Python
20,834
508
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportErr...
0de6acb166287cecbdbef7ca059382e902c274f94cde19607d18003b4d622860
Python
20,836
499
import os import argparse from tqdm import tqdm import torch import torch.nn as nn import torch.optim as optim import numpy as np import math import random import pandas as pd from sklearn.metrics import mean_absolute_error, r2_score, accuracy_score, roc_auc_score, f1_score from sklearn.model_selection import Stratifi...
851ab0e8e799b1fc72c82c65300ef8d90aeeb94f1a55870515bc479252bdb355
Python
20,840
373
import os import sys sys.path.append('/home/lifesim/MetaWorm/build/') import interact import numpy as np import os from neuron import h, load_mechanisms from eworm.utils import * from eworm.ghost_in_mesh_sim.worm_neural_network import WormNeuralNetwork from matplotlib import pyplot as plt import pickle def normalize_...
5f222987298d38a5e99f6e73b024544a4fe193c359397ae3c046f5e79fe26f47
Python
20,844
542
# -*- coding: utf-8 -*- """sidecars classes""" import itertools import logging import os import re from collections import defaultdict, OrderedDict from fnmatch import fnmatch from dcm2bids.acquisition import Acquisition from dcm2bids.utils.io import load_json from dcm2bids.utils.utils import DEFAULT, convert_dir, c...
73234828964ccffc451eeba0021e9c82dc98003bcf52d90f274c36386089f4a4
Python
20,859
478
"""Implementation of transmit card.""" import contextlib import ctypes import logging import threading import numpy as np from console.interfaces.acquisition_parameter import Dimensions from console.interfaces.unrolled_sequence import UnrolledSequence from console.spcm_control.abstract_device import SpectrumDevice w...
6572bd340364681918b5ce171e3b5999e952cacc74ff9134f0a7447d4e4eff05
Python
20,860
448
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 13 09:11:26 2021 @author: pyess """ import numpy as np import os import nibabel as nib from sigfig import round as sfround import matplotlib.pyplot as plt import seaborn as sns import scipy.stats import itertools ## Syntheitic_P1 is patient ID 'RID...
08ec1d9800855d7ba9307ed55447f92661e7a9582824c7bcd58b8a44222e3191
Python
20,873
593
""" Create a wheel (.whl) distribution. A wheel is a built archive format. """ from __future__ import annotations import os import re import shutil import stat import struct import sys import sysconfig import warnings from email.generator import BytesGenerator, Generator from email.policy import EmailPolicy from glo...
e9b19cb3fadca2663f16d41815f0d912fce74a1195e2c176f59f0e34172ee05e
Python
20,880
622
#!/usr/bin/env/python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from torch.utils.data import Dataset, DataLoader import torch import numpy as np import os import mat...
616ebfe6b143778db3f628bdcf2c8bc644d97c50a79ec00078a931f723f41c5e
Python
20,904
505
import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis as QDA from sklearn.ensemble import RandomForestClassifier as RF from sklearn.mode...
df9e52d105ef7345396b17c82f69604fefd38646ff8faaffc952685ad634b458
Python
20,910
511
from builtins import super from function import * import tensorflow.keras as keras import tensorflow as tf import numpy as np def call_model(x): dic = {'model_12':Model_12(), 'model_7' :Model_7(), 'xception_1d':Xception_1d(), 'xception_1d_2': Xception_1d_2()} return dic[x] cla...
144cb2332035bd77e68cbb1888afc172a2503f5595a1082e468e79f373665fbc
Python
20,938
541
""" Performs Univariate 2nd order analysis to a SetListTomograms object by tomograms Input: - A STAR file with a set of ListTomoParticles pickles (SetListTomograms object input) Output: - Plots by tomograms: + Number of particles by list + Particles densities by list ...
950ffa2d1614bd0712af490cb900f80be07a4ffe53d6f2c1819712bc79f16d61
Python
20,951
563
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
c76bd97832c6fa3e0c972e198064c59c99cea07e73efbd68a695942cd4fab67f
Python
20,957
487
"""Figure generation for the Apply Transforms pipeline. Mirrors the before/after + annotation-overlay figures produced by the main registration pipeline, but scoped to a single warped input volume. Produces, next to the warped NIfTI: - ``<stem>_pair.jpg`` : side-by-side input / warped - ``<stem>_overla...
8aecdf519e667f44af77f296f2fec79a60d117792d6deb891e084be8d3b24949
Python
20,972
427
"""The LiquidAion plugin contracts, registry and discovery (headless; never imports Qt). One registry holds every replaceable component, built-in or user-provided: model_adapter language-model family integration (built-in: Qwen3 profiles) connectome topology and neuron metadata (built-in: FlyWire CX5...
d9aadb75b3a61c1465e13512d5d290882a301a59ea4c56a04cede2d3628bff0b
Python
20,977
454
""" Generates a ListTomoParticle object from a input STAR file (translocon project version) Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import vtk impor...
8a8c8c58fab6b32ba82c214da584a49b1c55a655285f4f736c179b7dd75b5b60
Python
20,995
466
# Parts of this class are from the Scanpy equivalent, see license below # BSD 3-Clause License # Copyright (c) 2017 F. Alexander Wolf, P. Angerer, Theis Lab # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions...
ffccf2550938661150d709964c760cb1529b7c0c05c68e37617b6eed6a122085
Python
20,995
473
from __future__ import annotations from typing import TYPE_CHECKING, Literal, cast import jax.numpy as jnp import numpy as np import numpyro as npy import numpyro.distributions as npd from anndata import AnnData from mudata import MuData from pertpy._logger import logger from pertpy._types import cast_matrix from pe...
c944b96bd0e115fd5b7b9c3e3e6289ee58fc863cae66767f2211c0b33c2601d4
Python
21,010
824
"""Workflow decorators.""" from __future__ import annotations from collections.abc import Callable from functools import partial, wraps from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar, overload from quacc.settings import change_settings_wrap from quacc.wflow_tools.context import NodeType, tracked if TYPE_...
72e6c49db75a98c3caef8e3215f1d1b426c918d6f8b2fe061b46646c582b745c
Python
21,027
523
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
dafb27e140c60b6c5e495847682b9b812084895add52679198ec37f4a14b4d7d
Python
21,029
507
""" Performs Bivariate 2nd order analysis between ListTomoParticles pairs Input: - Two STAR file with a set of ListTomoParticles pickles Output: - Plots with the analysis - Matrix with the analysis for further post-processing """ ################# Package import import os import pickle im...
654ee9ab657014a6cd38af31619a59a25c4c3063180ebcdee1be496ad29be613
Python
21,033
603
"""Competing-risk Brier scores checked against direct subject-wise calculations.""" import importlib import tracemalloc from unittest.mock import patch import matplotlib.pyplot as plt import numpy as np import pytest from scipy.integrate import simpson, trapezoid from scipy.interpolate import PchipInterpolator from ...
9ae93fb8eb959fad03a152f25eaee34e061847697c4141164d9890b9f6d402b7
Python
21,035
387
from typing import Any, Callable, Dict, Optional, Text, Union, Iterable import tensorflow.experimental.numpy as tnp import tensorflow as tf from tensorflow.keras import layers as kl from src.layers.layers import * import tensorflow_addons as tfa from tensorflow.keras import regularizers from tensorflow.keras.layers.exp...
ce10fb477ec8dbe97bb45e31be3d623fd405cecca3984ee095139e06de7ac7ef
Python
21,036
594
from collections import defaultdict from functools import lru_cache from random import choice from codex.data.connections import Connections from codex.data.neurotransmitters import NEURO_TRANSMITTER_NAMES from codex.data.search_index import SearchIndex from codex.data.structured_search_filters import ( make_stru...
f38216f641cda8cd87b5bd9eebafa85230d6f281a7ac3655a2b70c939f76221b
Python
21,037
848
from __future__ import annotations from dataclasses import dataclass import numpy as np import pandas as pd from scipy import stats from sklearn.decomposition import PCA from sklearn.neighbors import NearestNeighbors from sklearn.preprocessing import RobustScaler, StandardScaler from .config import DimensionalityRed...
5c75b4c0be71c274b46298b97c633a33c9b13a9e687a980d64b1dacf92f0ddcf
Python
21,068
534
""" Performs Univariate 2nd order analysis to a SetListTomograms object by tomograms (Translocon version) Input: - A STAR file with a set of ListTomoParticles pickles (SetListTomograms object input) Output: - Plots by tomograms: + Number of particles by list + Particles d...
11bbcdfac96f46353e0fc7fde00656e01d8e974adb34cc01f77cee463060ec8f
Python
21,089
482
import numpy as np from scipy.io import wavfile from scipy.linalg import toeplitz, norm from scipy.fftpack import fft import math from scipy import signal from pesq import pesq ''' This is a python script which can be regarded as implementation of matlab script "compute_metrics.m". Usage: pesq, csig, cbak, covl...
886352e77924d1cb03df43cf2060aec23aa88d38fc7be369ccfece583628c71c
Python
21,090
380
from __future__ import print_function import copy from collections import defaultdict, namedtuple from pddlstream.algorithms.downward import get_problem, task_from_domain_problem, get_cost_scale, \ conditions_hold, apply_action, scale_cost, fd_from_fact, make_domain, make_predicate, evaluation_from_fd, \ pla...
4ce4adb447b695924bec169a93579e780aca6f34d2597819199dd7595523ebc9
Python
21,098
516
"""MobileNet v2 models for Keras. MobileNetV2 is a general architecture and can be used for multiple use cases. Depending on the use case, it can use different input layer size and different width factors. This allows different width models to reduce the number of multiply-adds and thereby reduce inference cost on mob...
000880fdf27251b7d9e09d821b69e5406b8732b849867babab2cf43951295e59
Python
21,099
460
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
9556b3347abe1f2e73d72a7b714d724e07dfb2c8cdafd3bd66a9cd4926748823
Python
21,109
439
#!/usr/bin/env python # ============================================================================= # GLOBAL IMPORTS # ============================================================================= import os import numpy as np import pandas as pd from logP_analysis import mae, rmse, barplot_with_CI_errorbars from log...
c80867c9489bb470c1ddc7d881c6e2a31f9f59e77cee87c20482034a087da2b4
Python
21,112
433
import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.autograd import Variable import torchvision.transforms.functional as VF from torchvision import transforms import sys, argparse, os, copy, itertools, glob, datetime import pandas as pd import numpy as np from scipy.stats import mode ...
924fc500498662b815541110c39dc7899793c45e21a9d9d46b6bec918539cf66
Python
21,113
432
#!/usr/bin/env python """Robust local test runner for RegTools. Wraps pytest with the settings that survive this repo's Windows quirks, learned the hard way, and a watchdog that recovers from the one quirk flags can't fix. Failure modes and their fixes: * Machine sleeps mid-run. A suspend/resume wedges xdi...
aaae5b9dbac7e8451be30e23f96ea7689934167d6fed99e91d238f33931b763a
Python
21,113
630
import logging import os from datetime import datetime from random import shuffle import numpy as np import pandas as pd import scipy import torch from pyedflib import highlevel from scipy.signal import decimate from torch.utils.data import Dataset, Sampler, WeightedRandomSampler log = logging.getLogger(__name__) ...
3b75b023bdca3d75f483faf9d19a1f0f1334363274af3804ad73a0bbdb069b14
Python
21,116
541
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
e35cd1b4116952213ea583d516091352511ddcc172276c3fb490d7af78c6df04
Python
21,116
455
""" Generates a ListTomoParticle object from a input STAR file (translocon project version) Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import vtk impor...
812b73b2218f425fd123052efc9dd301cc04401b4535dadea73606616f579e12
Python
21,146
485
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 7 13:57:01 2023 @author: MegNParker """ import mne import pandas as pd import glob import os, os.path as op import numpy as np import copy #%% subjid="..." session=1 sessions=[1,2] surf_flag=True #FALSE bids_dir="..." subjects_dir=op.join(bids_...
f8faa468eb3373da3eecb4d1d5aa8e2f84aa8b20306c675444a565807b87b9d8
Python
21,147
614
"""Automatic discovery of Python modules and packages (for inclusion in the distribution) and other config values. For the purposes of this module, the following nomenclature is used: - "src-layout": a directory representing a Python project that contains a "src" folder. Everything under the "src" folder is meant t...
0f94ccb244db580f56ed2dd30f42d5ad750d6c7983926841bf65a8f794b2835a
Python
21,148
649
"""Topology optimization of a waveguide mode converter. The worst-case optimization is based on minimizing the maximum of {R, 1-T} where R (reflectance) is $|S_{11}|^2$ for mode 1 and T (transmittance) is $|S_{21}|^2$ for mode 2 across six different wavelengths. The optimization uses the Conservative Convex Separable ...
9f47860559506411749f0acad9e9edc3b6072aee3546286d673856625b4fa10d
Python
21,148
575
## # \file tikhonov_solver.py # \brief Implementation to get an approximate solution of the SRR # problem using Tikhonov-regularization # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date July 2016 # import scipy import numpy as np import SimpleITK as sitk from nsol.definitions i...
8d95be71f6c08bfda015ca400d6e11ab0cc9982308770d5167953c16aec606e2
Python
21,181
557
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
bdf035f997b7a6c40e37d1932b1411d4a18c9e3474c5a7f6f9d2a9d28c3c5ad9
Python
21,188
399
import argparse import json import os from tqdm import tqdm import numpy as np import torch import torch.distributed as dist import torch.optim as optim from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from config import GlobalConfig from model import LidarCenterNet from data ...
c5dcd8b321ff4dc618f24430ab02fa587bc496c7ffe098a53a2fd7d580e69779
Python
21,193
534
"""SMART module interfacing with PETSc SNES solver""" import logging from typing import Dict, List, Optional import dolfin as d from dolfin.common.timer import timed import petsc4py.PETSc as p from .common import Stopwatch from .model_assembly import Compartment import numpy as np logger = logging.getLogger(__name_...
e78c4634691afe56c9d493f010b80d3dc52acd7aa17d53b511bb79c1a7ee6e03
Python
21,193
560
def calc_asymcut(values, coord, ori, imgh, imgrh, imgw, imgrw, centre): """Determines the cross-section along the most asymmetric cut through the z_values and shifts the origin to the geometric centre Parameters ---------- values : ndarray N dimensional array with type float that contai...
e3936fce0bf6320f845b9711e312c43809bffe0338757875591dafb6534063a3
Python
21,196
522
from torchvision import transforms from torchvision import datasets from torch.utils.data import DataLoader import torch.nn as nn import torch from mpl_toolkits.mplot3d import Axes3D from sklearn.decomposition import PCA import matplotlib.pyplot as plt import matplotlib import numpy as np import os from utils import Lo...
2f2e81cf211f9718e400709fac6bb35d388f2e7628c2944ed67d483b37ace11e
Python
21,207
418
import math import sys from matplotlib import animation as animation, pyplot as plt import traceback from src.utils import parse_config, contain_substr import pandas as pd import numpy as np from scipy.ndimage import gaussian_filter1d import os from joblib import Parallel, delayed import glob import joblib import cv2...
ce6f0b508be602b3dbddd98afbc5f4f70e55665879cdb9be593a87e459c6a393
Python
21,231
616
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import os import time import pickle import hashlib import itertools import torch import torch.utils.data import torch.nn as nn import torch.nn.init as init f...
960556356b72fbd3e99ab5d49f700d929690c8a74280f3b3ca9b8f95b9033f8b
Python
21,232
699
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Configs.""" from fvcore.common.config import CfgNode from . import custom_config # ----------------------------------------------------------------------------- # Config definition # ------------------------------------...
5a6f27b7cb9361e794cb1ce12e9c84febac3a7edd7c356d6a40129a8d985d889
Python
21,265
471
import os import os.path as path import numpy as np import torch import numpy.random as nr from scipy import signal import matplotlib.pyplot as plt import _pickle as pickle import re from eworm.utils import func from scipy import interpolate # weight normalization """ Three different weight form ( sample ---- input -...
ac12e3e4972f3fedee70764f29253a52920c22c345a282a8f477e9d14200e3f6
Python
21,274
475
""" Shared dialog classes for the U01 workflow GUI. """ import numpy as np from PySide6.QtWidgets import ( QCheckBox, QComboBox, QDialog, QHBoxLayout, QLabel, QPushButton, QSlider, QVBoxLayout, ) from PySide6.QtCore import Qt import regtools.gui.gui_constants as gc ...
ce58c9cbd3a1815238484b0de0b08e29e1ca80eaaebe11f4d6f4434103dee9a6
Python
21,279
630
""" Set of functions to clean up the non-essential files of each step of the preprocessing pipeline. Each step needs to have an own function to properly work Also, generate comparison images and values that are useful to rapidly assess the correctness of the preprocessing steps. Use this class: https://raamana.gith...
00a689c2daa31442b5f948fbf63cb8f3bd2b29bed397d8f08f449e453c3b2727
Python
21,284
602
import pytest import torch from torch.nn import functional as F from elasticai.creator.nn.integer.linear.linear import Linear from elasticai.creator.nn.integer.math_operations.math_operations import MathOperations from elasticai.creator.nn.integer.quant_utils.calculate_quant_params import ( calculate_asymmetric_qu...
887cb3a69f21f76256ea2e2b4c5759067788dbe40bee92aa413c1090c35ae546
Python
21,285
433
import shlex import sys import uuid from unittest.mock import MagicMock import pytest import NDATools from NDATools.clientscripts.vtcmd import validate from NDATools.upload.cli import ValidatedFile from NDATools.upload.submission.api import SubmissionHistory, NdaCollection, SubmissionPackage, PackagingStatus, \ S...
9441aadc420d445d88ef0d046eebaf6ae89742468c78811060705d51b702f7ca
Python
21,288
687
""" ================================== Extract EEG segments from the data ================================== Segment EEG data around experimental events Authors: José C. García Alanis <alanis.jcg@gmail.com> License: BSD (3-clause) """ # %% # imports import sys import os from pathlib import Path import numpy as np ...
f90e3dce7544d0bdfd71500c741ae2cd706e8f95c114fed655df0642a3d2f218
Python
21,304
484
import numpy import pandas import connalysis import tqdm def compress_id_ranges(dfs): """ Reindexes values in a DataFrame, compressing them to have [0 ... n] as values, where n is the number of unique values in the DataFrame. Args: dfs: list of DataFrames with integer values Returns: ...
2efac7779ab5e8a6f27e4df3011d605f854a0077b05915b02f2bffdf13c5f4e4
Python
21,314
387
#---------------------------------------------------------------------------------------------------------------------------- # Author: Brandon S Coventry CAP Lab Purdue University Weldon School of BME # Date: 09/02/20 # Revision History: 09/15/20 - Adaptation made for multiprocessor use. On a single RX process...
9bfd31135a3be0dca02a89c5c346a97b9834ad27e4633d20a82fe854487fc73a
Python
21,314
439
import copy import unittest from hed import load_schema_version from hed.errors import ErrorHandler from hed.models import HedString from hed.schema import HedSectionKey, from_string from hed.schema.schema_validation import attribute_validators as schema_attribute_validators from hed.validator import HedValidator from...
43c3d551400e4505f1a0e183b6389736c667047f0822c75975273c3422be8018
Python
21,320
499
import math import warnings from collections import OrderedDict from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from einops import rearrange def _drop_path(x, drop_prob: float = 0., training: bool = False, scale_by_keep: bool = True): if drop_prob == 0. or not tra...
5dbeb21b133b39cba8a6aea733142ceb6a33046c53efbb4e455a80ced15b3db7
Python
21,320
517
# -*- coding: utf-8 -*- from __future__ import annotations import os import tempfile from io import StringIO from typing import TYPE_CHECKING, Iterable, Optional, Sequence, Tuple, Union from supar.utils.logging import get_logger from supar.utils.tokenizer import Tokenizer from supar.utils.transform import Sentence, ...
9f4d480b942bd2bbef124121fe61cb396eef1b7b2ba02c661f74c71968148bfc
Python
21,321
375
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.animation as animation import time import ray import os from neuron_model_parallel import NeuronSim from elec_field import sparse_place_human from pulse_train import PulseTrain_Sinusoid...
996c7520535605c4764525d2f9f08821fd14fe9cc599d33cf2353cdd9b42b7e5
Python
21,323
642
"""Tests for ContourCorrespondenceStore - the pure data model extracted from the manual contour registration viewer. All tests are pure Python with no matplotlib, Qt, or Tk dependencies. """ import pytest from regtools.manual_contour_registration.correspondence_store import ( ContourCorrespondenceStore, ...
dec34470f0dcbb5c6b739067015bfbce806fc78fceb4bf4413e6ec2181cea530
Python
21,327
380
from .enums.nbo_type import NboType from .enums.qm_target import QmTarget from .enums.node_feature import NodeFeature from .enums.edge_feature import EdgeFeature from .enums.graph_feature import GraphFeature from .enums.hydrogen_mode import HydrogenMode from .enums.sopa_resolution_mode import SopaResolutionMode from .e...
558e997cccc449f70d0a9a10e164ef00e50236dc472b63304a03e1a5bb486784
Python
21,333
517
# -*- coding: utf-8 -*- # # Syncopy object arithmetics # # Builtin/3rd party package imports import numpy as np import h5py import dask.distributed as dd # Local imports from syncopy.shared.parsers import data_parser from syncopy.shared.errors import SPYValueError, SPYTypeError, SPYWarning from syncopy.shared.computa...
8d90f0139d74e394fba738cb54330218ffd17a5156c8bc9cc221d8f68d360bee
Python
21,335
639
"""Module contains frequently used functions dealing with channel lists.""" import math from cmath import sqrt import mne import numpy as np import scipy.interpolate from mne.surface import _normalize_vectors from numpy.polynomial.legendre import legval from psutil import virtual_memory from scipy import linalg from s...
763245e7888f57da0ead4ea6f23f367c8082fcd036ce1877d1eeab83f5c82d11
Python
21,336
616
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Pansheng Chen, Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import os import time import pickle import hashlib import itertools import torch import torch.utils.data import torch.nn as nn import torch.nn...
5b77fe42255068eeb05a1ecf47013dfa384fe58d32800c173bbd5071c066d540
Python
21,340
361
""" Populates the graph database with all the files generated by the importer.py module: Ontologies, Databases and Experiments. The module loads all the entities and relationships defined in the importer files. It calls Cypher queries defined in the cypher.py module. Further, it generates an hdf object ...
38de7d90555ae72ecdbd14b944cb95be4d1f62cc2b9a0ca9f5a4f85e180794fc
Python
21,346
498
#!/usr/bin/env python # -*- encoding: utf-8 -*- from copy import deepcopy from functools import partial from io import StringIO from inspect import getsource from pprint import pformat import sys import bindings as bi from custom import get_customizations_for, reformat_block str_type = str get_customizations_for = pa...
91b991aff20ab0fde0155175aa1913c926b78c36333910d1fdc9fa6ac6243238
Python
21,346
524
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
e4938cacf4be378bfa8bd8f716b9d846747c89e810720545e9838e66640e190a
Python
21,350
327
""" Connectivity analysis (mostly wrappers around `assemblyfire.topology` functions) last modified: András Ecker 06.2023 """ import os import h5py from tqdm import tqdm import numpy as np import pandas as pd from conntility.circuit_models import circuit_connection_matrix from assemblyfire.config import Config import ...
5cdf0d9b6c6af5869f34a5ca766830410357436de563e3addfdca5d8cea00cde
Python
21,351
486
''' Original Author: Nate Zuniga Modified by: Yi Jie (Josh) Tseng on 10/01/2023 Software requirement: Python Python module requirement: scipy, sklearn, numpy, pandas and matplotlib Purpose: To perform normalization based on the Aguilan et al. 2020. It includes the following steps: 1. Clean and filter data....
f6f67290eb86f13507a647e4af8a98bf80be5107e59c808022f5ddf41390158b
Python
21,351
499
# -*- coding: utf-8 -*- from __future__ import annotations from typing import List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from supar.structs import DependencyCRF from supar.utils.common import MIN class DependencyMFVI(nn.Module): r""" Mean Field Variational Infer...
a313177b331a84409d428ddc274696bc30edb3dcf9d98ce7af252f935c7f3d8b
Python
21,358
509
# NOTE: to use the violin_plot_performance function, you'll need to use an virtual # environment with seaborn version 0.11.0 import os import pickle import json import numpy as np import networkx as nx from nilearn import plotting import matplotlib.ticker as ticker import pandas as pd import matplotlib.pyplot as plt...
509a8c23d84268f87c534f7e53e2e52028130014b836cfffc16d1853b1e69c59
Python
21,362
444
######## Name ######## BiochemSimulMuleRapid ######## Requires ######## {Modules} import numpy as np import numba class BiochemSimulMuleRapid: """Class 'BiochemSimul' Illustration! It is an essential part of the 'BiochemAnalysis' class! ######## Attributes ######## Met...
9be7dd110695de5f142011d45151018bbb8f3b324b61471bcb94886e9301ec97
Python
21,388
1,047
from __future__ import annotations import matplotlib.pyplot as plt from matplotlib.colors import to_rgb import numpy as np import pandas as pd from .config import PlotConfig # ====================================================================== # MORPHOGLIA PALETTE # ==============================================...
bb239942e2c3a8477a425ca25d79fa001f474e8d0ad0c5ef3c3ff7121d784ed1
Python
21,394
529
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
f6d7d3081998ecdab75de1e3fe17aca47082182e3a6a13eb39ae9d78759de885
Python
21,397
648
from pyclamp.dsp.fpfunc import * from pyclamp.dsp.optfunc import * from pyclamp.dsp.nnmod import * from pyclamp.gui.pgb import * import numpy as np SHOWFITS = False if SHOWFITS: from mplqt import * import iplot import resfunc # Numerical analysis class MMA (censca): # Minimum / maximum analysis numlbl = ...
288b6fa3b371f4fcad55f1866dc1fe75cb0bc4bbd709e6f83ac342296246bf3b
Python
21,414
700
import logging import numpy as np class BaseAtlas: """ Simple base for anatomical atlases. Internal representation as dictionary {node_num: "name"}. """ name = "" label = "" def __init__(self, atlas, coords=None): """ :param atlas: anatomical atlas / parcellation ...
df7e3e323369ce4769aeb059f3781f1ead13f6bac31ec70e30ba4119ab629625
Python
21,423
449
from __future__ import print_function import argparse import datetime import math import os import sys import time import numpy as np sys.path.extend([ os.path.join(os.getcwd(), 'pddlstream'), # Important to use absolute path when doing chdir os.path.join(os.getcwd(), 'ss-pybullet'), ]) from collections imp...
9e2dbd20720eeaa87d642f4d4044df869d46249345f652ecda5dbeb0687d7ced
Python
21,444
371
##################################### ######## Paper Draft Cartoon ######## ##################################### #%%# Catalyzer import os import sys path = os.path.dirname(os.path.realpath(__file__)) + '/../Resources' sys.path.append(path) path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(path) impo...
537f63e9c9467a232a19311f1a19b85e3851170ce3caad7aea8b6c569bd17e31
Python
21,445
639
#!/usr/bin/env python # # Copyright 2005 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
695868f7380754f0573e79c940d0714231eb475602fba61dc5a979a541721eef
Python
21,447
622
from datetime import datetime, timezone from logging import getLogger, NOTSET, WARNING, disable from os import SEEK_SET, SEEK_CUR, SEEK_END from os.path import splitext from struct import unpack from pathlib import Path from numpy import (asarray, empty, expand_dims, fromfile, iinfo, nan, ones, resh...
d60e0eb68c4e5cdd7b2a301faa64c198577fbbd24b135283fe0a0278811f2639
Python
21,450
485
import numpy as np import pandas as pd import numexpr as ne import random import copy import json import jsbeautifier from scipy.integrate import odeint, cumtrapz from scipy.optimize import root_scalar import multiprocessing as mp import time from clamping import apply_transition, get_feasible_transitions ...
bbfbf533bdb4bd12f069297d03d6a1376cea2b8adf3b9b0bce6ea8a769e0f875
Python
21,455
562
__author__ = 'martinez' try: import pexceptions except: import pyseg.pexceptions import numpy as np try: import disperse_io except: import pyseg.pexceptions from pyto.io import ImageIO from abc import * ########################################################################################## # Clas...
c3a1f9dc9172c22a0fd8828c93a0669d5369c840e0d705c350d400b774ff206c
Python
21,483
522
"""A segmentation mask drawn over the input pane, like the cell-points overlay. The overlay exists to answer one question before a registration is spent: does the mask actually sit on the tissue, and does the orientation chosen keep the two together? So these tests assert what is DRAWN - alpha where objects are, ...
e4dac5bcf437a144f0e103f5d2974c0cd8720f80ff36d67a6a38dd2aff6e9ba0
Python
21,486
553
import numpy as np from scipy.sparse import csr_matrix from .constants import hpro_rng from .utils import atom_number2name BASE = 20 class PairsInfo: ''' This class is used to deal with atom pairs. The first atom in the pair is always assumed to be in the unit cell at (0, 0, 0), and the second atom is in...
a453b83f9bf1821168ccda6e33a356250f7698eaed324b4b754306b6c9bddc53
Python
21,493
548
""" data augmentation algriothm""" import albumentations as A from albumentations.augmentations.geometric.functional import safe_rotate_enlarged_img_size, _maybe_process_in_chunks, \ keypoint_rotate import cv2 import math import random import numpy as np d...
35a86a9f810fec6a97baf577432cb8f65ed00749350af1c34703c9f06a3a79b2
Python
21,495
478
# ---------------------------------------------------------------------------- # Contributors: Thiago O. Bezerra # Antonio C. Roque # ---------------------------------------------------------------------------- # File description: # # Functions implementing the current densities and differential equ...
4fbae98ce99df7c12027cf1cc04019c59402975a5edc47bdfea6f137aa996b21
Python
21,508
452
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
b7cc79c5602255a89c488946a67c0c22d6c7272a3cd4fb7db7f06692de28ca65
Python
21,508
492
""" model components""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import timm from MolNexTR.utils import FORMAT_INFO, to_device from MolNexTR.tokenization import SOS_ID, EOS_ID, PAD_ID, MASK_ID from MolNexTR.decoding import GreedySearch, BeamSearch from MolNexTR.models impo...
0f15cbc7092ec252eb19f0d57b8221d8167e3dc1c0e0976585ee4305830a10b8
Python
21,514
578
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
2fdb22b5605147ca40f02d8d66d85a7d200bf2ccc705d5bf395531c4979a7a5a
Python
21,518
553
## # \file ScatteredDataApproximation.py # \brief Implementation of two different approaches for Scattered Data # Approximation (SDA) # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date April 2016 # import os import sys import itk import time import numpy as np import SimpleITK a...
51d54110e3928c8fbb407d0a8a4fd9fe7fca0f2cb51808038f121b14462500e8
Python
21,526
558
#!/usr/bin/env python3 """Track tumor instances across timepoints and measure their volume over time. Each file is a binary segmentation mask for one scan date (may contain several disconnected instances, e.g. multiple metastases). The scan date is parsed from the filename (default: "YYYY-MM"/"YYYY_MM" before ".nii.gz...
72fbcb120fcc3a9aea8f98d2c8769835b2307ef8d8a3661dd9e38db11f2de01d
Python
21,536
1,131
from __future__ import annotations from dataclasses import ( asdict, dataclass, field, is_dataclass, ) from pathlib import Path from typing import Any import yaml from .metadata.config import ( MetadataConfig, ) from .preprocessing.config import ( PreprocessingConfig, ) from .segmentation.co...