sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6945202150491db4df064cb0fa9714e872164ab63ac197af0437bb243eb0a858
Python
11,895
255
import sys ## Usage: $ python scale_coef_duplex.py [2,1,1,1,1,1,1] [3,1,1,1,1,1,1] cbl_dimer.ninfo input_Y4J.bpl cbl_dimer.pdb def usage(): print("Usage:") print("python scale_coef_duplex_ninfo.py scale_duplex scale_nonduplex ninfo_file basepair_file cg_pdbfile\n") print(" scale_duplex given as [x...
01972790e38e173e4bc01c19914927c45c2b043ad171a914550de0f9a3095f7b
Python
11,896
370
import colorsys import math import random import re import numpy as np import numpy.typing as npt def clamp(value, min_value, max_value): return max(min_value, min(value, max_value)) class Lab: Kn = 18 Xn = 0.950470 Yn = 1 Zn = 1.088830 T0 = 0.137931034 T1 = 0.206896552 T2 = 0.128418...
4f855d43f904e380ef54e8364158e6d671fcdc4073b528eaba123ac18fb3d298
Python
11,897
320
import numpy as np import pytest from SurvivalEVAL import SingleTimeEvaluator, SurvivalEvaluator from SurvivalEVAL.evaluations.discrimination import auc @pytest.fixture def auc_data() -> dict[str, np.ndarray]: return { "predict_probs": np.array([0.8, 0.3, 0.1, 0.6, 0.2, 0.01]), "event_times": np....
7ce230b8de5195bcbfcadd48d4eb39eb53d21210e84b5f9e615cb49b4916ac05
Python
11,897
274
import os import time from configparser import ConfigParser import numpy as np import torch from e3nn.o3 import Irreps from .utils import orbital_analysis, refine_post_node class BaseConfig: def __init__(self, config_file=None): self._config = ConfigParser(inline_comment_prefixes=(';',)) ...
1cef658ec8e499d191199d3a882bd127d0e770e7c09cc2fdeaad801415adb0ba
Python
11,899
295
"""Testing of sequence unrolling function.""" import tempfile from pathlib import Path import numpy as np import pypulseq as pp import pytest from console.interfaces.acquisition_parameter import AcquisitionParameter from console.interfaces.dimensions import Dimensions from console.interfaces.rx_data import RxData fro...
3126a4a27f56ef989db0ecb898a64b4e6d110a82e974745c578f8f6a40c03dfa
Python
11,899
323
import random import logging from functools import partial from typing import List, Tuple, Dict, Optional, Any import math import numpy as np import torch from torch.nn import ModuleList import torchvision from torchvision.transforms import Compose, RandomApply from torchvision.transforms import functional as F fro...
b81f9c07edd0e1b9970cb2e96ce5a4985be2c3e15d7b7f73c8c57ab4a2765874
Python
11,903
289
import logging from datetime import datetime from logging import Handler, LogRecord from pathlib import Path from types import ModuleType from typing import ClassVar, Iterable, List, Optional, Type, Union from pip._vendor.rich._null_file import NullFile from . import get_console from ._log_render import FormatTimeCal...
caed1b1d44c99d09616773299a6aabed5e99c3df57f51186cca3b3cda1ee2ad0
Python
11,907
224
import pathlib import sys import argparse from datetime import datetime, timedelta, time import numpy as np import pause import logging import cv2 from logging.handlers import RotatingFileHandler from modules.data_collection import DataCollector from modules.object_detection import DetectorBase from modules.upload_aut...
aba934739028876984f099e57d394267c2c37cd3a0f6767b506b88672ce6e61c
Python
11,908
291
#!/usr/bin/python # -*- coding:utf-8 -*- # -*-mode:python ; tab-width:4 -*- ex:set tabstop=4 shiftwidth=4 expandtab: -*- # from ctypes import * import sys if sys.platform == 'linux2' or sys.platform == 'linux': try: dll = CDLL('/usr/lib/libgxiapi.so') except OSError: print('Cannot ...
edf000ca69c920494faed56070cf29ba3fa42f9172f5aead58cc25caa397636e
Python
11,909
258
import lavaset.best_cut_node as best_cut_node import numpy as np import pandas as pd from joblib import Parallel, delayed class StochasticBosque: def __init__(self, minparent=2, minleaf=1, nvartosample=None, ntrees=100, nsamtosample=None, method='g', oobe=False, weights=None): self.minparent = minparen...
cfa823604ced12bc4b01f7f522fb144dc91b54cd4ff3bcfa91af3d8359194051
Python
11,910
332
import warnings import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import pytest from scipy.stats import chi2 from SurvivalEVAL import ( CompetingRisksEvaluator, SingleTimeEvaluator, SurvivalEvaluator, one_calibration, one_calibration_cr, ) def _weighted...
aac51cb0044a6eba18301f4e65d7faa95d51086d276a953e6e1d02036e0a5e83
Python
11,912
274
# 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...
2c6c4c3659e6a8b850b314e8ea5357bc8b3b1b6f2d4257f1d789ef21c2dedcd9
Python
11,918
294
"""Slice-thumbnail filmstrip mixin for the CCF Boundary Editor. A horizontal strip of small thumbnails sits beneath the canvas: the current slice in the centre, plus ``RADIUS`` neighbours on either side (``FILMSTRIP_COUNT = 2 * RADIUS + 1`` thumbnails total). Each thumbnail shows the modified slice for that index...
f251b79822856cf0a9f54540f70bb56619b0af5cec8e18a21ff92bbefbda454c
Python
11,918
318
import numpy as np import tensorflow as tf slim = tf.contrib.slim _BATCH_NORM_DECAY = 0.9 _BATCH_NORM_EPSILON = 1e-05 _LEAKY_RELU = 0.1 _ANCHORS = [(12, 16), (19, 36), (40, 28), (36, 75), (76, 55), (72, 146), (142, 110), (192, 243), (459, 401)] @tf.contrib.framework.add_arg_scope def _fixed_...
eb5189c73422a742089e1b8eebd648e466cd43cd97103501ff51a0e7f2ad5287
Python
11,920
330
import json import os import sys import tempfile from contextlib import contextmanager from os.path import abspath from os.path import join as pjoin from subprocess import STDOUT, check_call, check_output from ._in_process import _in_proc_script_path def write_json(obj, path, **kwargs): with open(path, 'w', enco...
a2bbe520fd096b1901ddb8d89ee8476f9b379bb72d99a7f7145b8eb0e4ebbf39
Python
11,923
418
auto_scale_lr = dict(base_batch_size=10, enable=False) backend_args = None data_root = 'F:/action_test/Corrected/' dataset_type = 'CocoDataset' default_hooks = dict( checkpoint=dict(interval=1, type='CheckpointHook'), logger=dict(interval=50, type='LoggerHook'), param_scheduler=dict(type='ParamSchedu...
841bfe39285bfee2af2e3a3f136baab502c424d0415d316096f7fa9b36d437ca
Python
11,924
356
"""distutils.cygwinccompiler Provides the CygwinCCompiler class, a subclass of UnixCCompiler that handles the Cygwin port of the GNU C compiler to Windows. It also contains the Mingw32CCompiler class which handles the mingw32 port of GCC (same as cygwin in no-cygwin mode). """ import os import re import sys import c...
32554980aa1e000ac982dd6a3ee677c7651dd570958567ed5ec4e657169ccd84
Python
11,935
374
# STAGE-1: Read, Preprocess & Save The Data # Imports import time import copy import numpy as np import pandas as pd from tqdm import tqdm from sklearn.preprocessing import OneHotEncoder from sklearn.model_selection import train_test_split #print('Completed importing necessary libraries and utilities.') # Start Timer...
e8afc64486a9d7348372803ad5829aaacbed9cf19d6a5ec7d5fe5487215e234e
Python
11,935
412
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
72a86bcce78d62a4965b11d7cabb7a9ef8b9f1f645be22fd22c4317c7e4b2489
Python
11,936
391
import os.path as osp from pathlib import Path import numpy as np import torch import torch.utils.data as data import cv2 import argparse from .io import _numpy_to_tensor, _load_cpu from .params import * import random from PIL import Image, ImageEnhance import types import torch.nn.functional as F def img_loader(path...
992802e8e3d7c20e1f044ee2388f06f3d646d6d696df76f0327850f0d7b092e0
Python
11,939
324
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2022/10/14 10:53 # @Author : piaoyang cao # @File : prepare_mol_data.py import os import pandas as pd import numpy import numpy as np import torch import random from molecule_fragment import * # 处理每一个mol 形成大图 import networkx as nx import iterto...
243a4c2739e0b4e31a9d8e3cf47aa8c2cd40ea51802d2cf7d8f3bf6b1fc6106b
Python
11,940
350
import os import collections from classification_models_3D import get_submodules_from_kwargs from ._common_blocks import GroupConv3D from ..weights import load_model_weights backend = None layers = None models = None keras_utils = None ModelParams = collections.namedtuple( 'ModelParams', ['model_name', 'repe...
9b9d11e119cad705ca922250cfa9bd11e8777563af343634490be70e48e41977
Python
11,940
291
import os import sys import datetime import SimpleITK as sitk import numpy as np from shutil import copyfile from PIL import Image from functools import cmp_to_key from src.utils import file_utils as futils from src.utils import evaluation_utils as eutils from src.utils import sitk_utils as sutils from...
bd9a42c6248f584667daeac33a15abfcd244733a09e328f3a3449e675aace1fe
Python
11,945
335
import numpy from matplotlib import pyplot as plt """ Various plots used in the notebooks. """ def plot_simplex_divergences(divergences): """ Fig. 2B """ fig = plt.figure(figsize=(7, 2.5)) ax = fig.add_subplot(1, 2, 1) for dim, vals in divergences.items(): if dim > 0: ax....
06c0ee56526aa4e4356843218dad82429dbb3a031acf22edc859ecaf954802e2
Python
11,947
404
""" Configuration settings for simulation: logger formatting, solver configuration, other flags """ import logging from logging import config as logging_config from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, Optional, Tuple, NamedTuple from termcolor import colored import ...
19b1ad3b40bf7b3e62d7dd51b2490349d3ff3e6433c5153e8050bef3680f7527
Python
11,948
404
"""Core recipes for VASP.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, Literal from warnings import warn import numpy as np from monty.os.path import zpath from pymatgen.io.vasp import Vasprun from quacc import flow, job from quacc.recipes.vasp._base import ( ...
690c301aecc2a5a9fa9ad99297190aa5ccee5ccebd0ed67ded47870b1af45fee
Python
11,949
241
import os import mne import logging import numpy as np import itertools from typing import Any, Callable, Dict, Tuple, Union import pandas as pd from ..module.base_dataset import BaseDataset from ...utils import LazyLoader _MOABBDataset = LazyLoader( 'moabb.datasets.base', install_hint='Install with `pip install...
2e30470a90e7f5ff25ced73d31ff15915ebfce931cc69eb969f72c36d57b7063
Python
11,963
332
# 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...
f3fd52b6aff0853db6b3f82b6f803aa1021346b0bdcd7d59eb233c5c2796b043
Python
11,963
227
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # Copyright 2017 The Chiron Authors. All Rights Reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Created on...
b826d048a786f78cbc024c792d5e71cbac8280c9f6a1178bf7df5eb0c2976ef3
Python
11,964
335
# 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...
b09749e7cc1005e4d15676c5b5657ec09c439a2b3ff632bf18358983c18efb90
Python
11,966
347
""" Performs Univariate 2nd order analysis from a STAR file with a set of ListTomoParticles entries Input: - A STAR file with a set of ListTomoParticles pickles Output: - Plots with the analysis - Matrix with the analysis for further post-processing """ ################# Package import im...
bf3fa68b93bf0209cf8c270d6fa358c285ec5245925d1acce9480820ef70e74f
Python
11,970
275
#!/usr/bin/env python3.9 # compile / train a model and save the best models and the last models import time import locale import pandas as pd import numpy as np import tensorflow as tf from contextlib import redirect_stdout # function to save the actual best mean loss (train and validation data) and mean accuracy mode...
72ce99de1b43e5a9192f256dd032e4320e490d078721cb425caa6b3dd1356d27
Python
11,971
399
# 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...
639ad8dd20d0eb27fa8cf3ec56215d9c35d0e383ca3e5fd898fae87bfe3ecd7a
Python
11,972
259
# 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...
14961be5728297e666071d19230038599b7c19edf08e7007b766f8f8fa44c195
Python
11,976
290
# -*- coding: utf-8 -*- """ Created on Jun 23 2023 @author: Jonas A. Thiele """ ### Apply models build in main sample (610 subjects of HCP) to ### predict intelligence scores in the lockbox sample (196 subjects of HCP) ### for models that were trained with different numbers of the most relevant links (dete...
29a70c62aa82bab8245765f58b4e1ed271d20a73694e60b1095bfc73579a1fcc
Python
11,976
344
"""Data handling utilities involving dataframes.""" import warnings import numpy as np import pandas as pd from hed.errors.exceptions import HedFileError def add_columns(df, column_list, value="n/a"): """Add specified columns to df if not there. Parameters: df (DataFrame): Pandas dataframe. ...
a2947426c72a2367b4001cbe0053237b963cd2d8afac248d40a8429b76612f03
Python
11,978
292
# Node-group asset "Style Ball and Stick" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_C...
d37f92b5122693d795b66ea8804b2ba6ce759ef65f14b6edd4ce40af0e57dbf6
Python
11,979
415
from functools import reduce from itertools import count from typing import ClassVar from .tracer import Box, Node, getval, isbox, primitive, toposort, trace from .util import func, subval # -------------------- reverse mode -------------------- def make_vjp(fun, x): start_node = VJPNode.new_root() end_valu...
1216ed27b3c266efb3a256bec4363aa616afe50ba80cf83f1497cbeacd1cae85
Python
11,986
317
""" This module, 'bands.py', contains recipes for performing bands and fermi surface calculations using the bands.x and fs.x binaries from Quantum ESPRESSO via the quacc library. """ from __future__ import annotations from typing import TYPE_CHECKING from ase.dft.kpoints import bandpath from pymatgen.io.ase import A...
527c650f451690b59c3b1cb78faa087f410229d6489a24834e4d79f42575fc7c
Python
11,993
253
import torch from torch import nn from torch.nn import functional as F from torch.utils import data as torch_data from torchdrug import core, tasks from torchdrug.layers import functional from torchdrug.core import Registry as R @R.register("tasks.KnowledgeGraphCompletion") class KnowledgeGraphCompletion(tasks.Task,...
81e9bde0283e83f7cc623b2e8fb4eedb5dd8d36590371d5be6ae372dc567e87f
Python
11,995
314
"""A Q-Chem calculator built on Pymatgen and Custodian functionality.""" from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.calculator import FileIOCalculator from quacc.calculators.qchem.io import read_qchem, write_qchem from quacc.calculators.qchem.params import cleanup_attrs...
3e3e762d130ef5f2d65541c780f328640d8340dcfca136cd470cca019bcde5ef
Python
11,998
195
# 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...
65c755146e2603de48c19b1f9823b3d2af0934bd172eded05415e23ab795fc66
Python
12,001
292
import os import re import numpy as np from scipy.sparse import coo_matrix from .structure import Structure from .constants import AOFT_QGRID_DEN from .utils import atom_number2name from .orbutils import parse_siesta_ion, parse_deeph_orbtyps, parse_gpaw_basis, read_upf, grid_R2G, GridFunc, LinearRGD def argsort(seq):...
8249f6781adcb07aa0ffa318cf660e2f33264b3b117b75e0aab6e5133aab3ecc
Python
12,001
286
#!/usr/bin/env python3 __author__ = "Zoe Wefers" __credits__ = ["Ryan Huang"] __version__ = "1.0.0" __maintainer__ = "Zoe Wefers" __email__ = "zoe.wefers@mail.mcgill.ca" """Purpose: Executable file to collect localization statistics froms users result files and skeletons/prints.""" import localization_analysis as la...
c69851b6bb8e4815a12b74abea47fadc90428a3b22127234ca1d56517ee328b1
Python
12,002
322
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Adversarial training to unlearn bias label from disease classification -> Adapted from Raissa/Vedant's code for unlearning scanner from Parkinson's disease prediction, based on "Deep learning-based unlearning of dataset bias for MRI harmonisation and confound removal"...
6db58b0148e31331e03e49018a9e34d4bf0fa26cc7b987f8fbd48c35a7a318b2
Python
12,003
194
# 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...
d612c4367643cde76b6cf6edc461b4acedecd289d0a28a4046f40a685e92d013
Python
12,007
232
# This is a stand alone script that plots ECGs from body surface potentials # simulated from monodomain simulations. # The normalisation strategy is the same as in ecg_functions.py. import numpy as np from scipy import signal import matplotlib matplotlib.use('tkagg') from matplotlib import pyplot as plt # Helper functi...
684e838f9bb77d942ebe68b27e73929273c21bb9dab43242cbec2063ffcb761e
Python
12,012
307
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ DETR Transformer class. Copy-paste from torch.nn.Transformer with modifications: * positional encodings are passed in MHattention * extra LN at the end of encoder is removed * decoder returns a stack of activations from all decoding...
1f5116bcf3a50bf76b01e97431826ba94dc336ee0c8f71dd0752e6059964dec0
Python
12,013
265
"""Manager of events of temporal extent.""" import bisect import pandas as pd from hed.errors.exceptions import HedFileError from hed.models import df_util, string_util from hed.models.hed_string import HedString from hed.models.model_constants import DefTagNames, TopTagReturnType from hed.tools.analysis.hed_type_de...
689e5aab097dbb764810b650f3ba838d23610909dbf69b9e90359d1eab7782ca
Python
12,016
313
# Copyright (c) 2023 Se42 Authors. 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 # # https://www.gnu.org/licenses/why-not-lgpl.html # # Unless required by applicabl...
97ebaf925435718b41287a2b82e085a5e9afc9c3430486ee339859b2b949cb08
Python
12,017
413
import os import sys import time from contextlib import contextmanager import nibabel as nib import nrrd import numpy as np import scipy from skimage.filters import threshold_triangle as triangle from skimage.filters import unsharp_mask from sklearn.preprocessing import quantile_transform sys.path.insert( 0, "/ho...
7db18445e4e8d4b389a20ee6c31e31bd149ebab87f65bf2601041546b7a2a742
Python
12,019
272
import torch import numpy as np import os from model.TwoResNet.model import TwoResNet from lib.utils import masked_MAE, masked_RMSE, masked_MAPE import pytorch_lightning as pl from model.RNN.model import Teacher from model import const class Cluster: def __init__(self, label): self.label = label ...
9f2e122eb6e8ef553b6e9f89f3675b4e171603b788b4a2423a162578c12c26dc
Python
12,021
308
""" Logic to apply transform generated by 'bifrost register' to an image Execute using the 'bifrost' executable installed by setuptools """ import logging import os import sys import tempfile import ants import h5py import numpy as np import tensorflow as tf import voxelmorph as vxm from skimage.exposure import equ...
a4cb35045ab3625b6325b7f86c2e8eeb1ffd76f6f375ea21ec7b002c4ea19275
Python
12,021
292
from typing import Tuple import numpy as np import torch from einops import rearrange from einops.layers.torch import Rearrange from torch import nn def _pair(t): return t if isinstance(t, tuple) else (t, t) def _get_emb(sin_inp): emb = torch.stack((sin_inp.sin(), sin_inp.cos()), dim=-1) return torch.f...
13a06d87b6985bd17d4efb305b76f17d36caf3e65501dd2fdb55b2b5a2389355
Python
12,026
185
import argparse import sys from NDATools import exit_error from NDATools.Configuration import * from NDATools.Download import Download logger = logging.getLogger(__name__) def parse_args(): parser = argparse.ArgumentParser( description='This application allows you to download files from an NDA package. ...
558db7d1c55e3b33fbe2ef7307b1d7783410ccd92b3655939f8ce708f281632c
Python
12,028
206
"""SURVIVE.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02n-SURVIVE.md Four checks asked for by an attack on draft 10. P1: Shiu et al.'s own Brian2 code on all 50 odour channels, published signs and laboratory prior. P2: the census's cells re-checked in spikes. P3: the margin moved by scaling excitatory loc...
562b3e924989dc6d1113f20c1a7e9bee896c1c584df4880b8e593dacc3a8d17f
Python
12,029
370
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
019e75f423fdbeedb2916f7f75e635d6bad1c30dc97e3eb2919add5641f0a596
Python
12,039
297
import math import torch from torch import nn import time from warnings import warn from collections import OrderedDict import numpy as np class RNN_Net(nn.Module): def __init__(self, dim_in, dim_hid, dim_out, n_layers=2, nonlin=torch.nn.Tanh(), bias=False, out_scale="small", g=...
5ad13ec68c0ba8b2a52490ca3accaa58da31887cf7577daa365fea3318ff85ea
Python
12,039
297
#!/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 glob import shutil import unittest import subprocess import numpy as np from cbig.He2019.config import config from cbig.He2019.CBIG_prepare...
6798f39e3a86427cbcce2f4b6ecd765ab5309e9aabba64f5836504191feb9d35
Python
12,042
241
import os, sys, argparse, time import json from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch_geometric.data import DataLoader #from tensorboardX import SummaryWriter sys.path.append('..') from models.ddi_predictor import DDIPredicto...
fcda3e99fde3aa8c92289081fc296330fbba7a124b0c31e51c3bffaa59d0546b
Python
12,046
316
from abc import ABCMeta from contextlib import contextmanager from enum import StrEnum from typing import TYPE_CHECKING, Iterator, List, NamedTuple, cast import bpy from bpy.types import GeometryNodeTree, NodesModifier from databpy import ( BlenderObject, ) from nodebpy import geometry as g from nodebpy.builder imp...
a5e49aecacf769f0d69f93a0dc4af57cbc6fed579651da7169131ee77333f159
Python
12,051
321
import hashlib import importlib.resources import inspect import json from collections.abc import Callable, Hashable, Iterable, Iterator, Mapping, Sequence from contextlib import ExitStack from functools import wraps from importlib.resources import Anchor from os import environ from pathlib import Path from typing impor...
0195be62a97f5e2de0ab3263b73c0ae74a2e7935213f666f6485d84601fcde64
Python
12,055
264
"""Drag-tool behaviour (sketch / paint / align) for the viewer, packaged as a mixin so the per-mode handlers live in their own file. Mode-switching itself (``_set_tool_mode``) is also here since it's where all three modes coordinate. The mixin assumes the consuming class declares these instance attributes in its...
40d836f020ac33458a176ba6b6fdf1e9d49a05d912c553e26937ad8407ba1a23
Python
12,056
311
import numpy as np from scipy.sparse.linalg import spsolve from scipy.sparse import coo_array from numpy.linalg import norm import copy from ednm.aot_residual import residual from ednm.aot_jacobian import jacobian def alpha_c_phi(model, dt, alpha, c, phi, ss_, t, t_AP, stimulus_protocol, verbose=True): """ Upd...
b4354bc9e9b13637ea9ff64061f3c2a9ccdef7d6c03335c7ba9e61a42dfa6009
Python
12,056
304
""" Script for extracting an analyzing a GraphMCF with a segmented membrane (v3) 18.11.15 - Modification for not to compute filaments Input: - Density map tomogram - Segmentation tomogram Output: - Connectors clusters """ __author__ = 'Antonio Martinez-Sanchez' # ################ Pack...
28144d2e52887d6cce824f295e4e7d66c00438b23c026987c50facc862daaa88
Python
12,059
245
import numpy as np import glob import pickle import random import pandas as pd import os from os import path import copy import h5py from collections import Counter from itertools import groupby from operator import itemgetter def norm(A, B): return (((A[0] - B[0])**2 + (A[1] - B[1])**2)**(1 / 2)) def V_unit(A0...
a2fd985ff28bc754c404691fca62a19df32bf58e33e761733b5c060cce7a336a
Python
12,060
353
# 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...
c433f643f424d73f6296752fdc0241de812e2a1360553ac1df1f7cb6128b0795
Python
12,062
326
import copy import numpy as np import analysis_utils as au def fit_data(df, config_columns, mean_columns, metric_column, method_column, plot_column, raw_data, process_plot_column_fn_in_raw_data=lambda plot: plot, ...
303276edc32fba4f3fc212dd24a32bebe4444992797d4efc1522c0760b8b9433
Python
12,065
279
#!/home/dingml/anaconda3/envs/expressBert39/bin/python3 import ast from tqdm import tqdm import argparse import os import sys import numpy as np import pandas as pd import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from sklearn.model_selection import train_test_split from torch...
77c04b3550f1d8870b5307a718c8849639c413c1b7054d3164fc0fc479cca14d
Python
12,068
400
#!/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 torch import torch.utils.data import torch.nn as nn import torch.nn.init as init class CBIG_dataset(torch.utils.data.Dataset): """PyTorch datase...
b94cf3ea842dc9b19240b5991bb74ffa7b9d2a9d71f23043d57290db5b0203cc
Python
12,068
247
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 6 10:09:47 2023 @author: daltonm """ from pynwb import NWBHDF5IO import ndx_pose import numpy as np import matplotlib.pyplot as plt from importlib import sys import neo import elephant from quantities import s from scipy.stats import median_test i...
b86d2c3fb96a9135ef7e0de1b3c9f484728c2ca2eb6bf205c65e573284d4e80c
Python
12,069
370
"""Implementation of CLI render command.""" import numpy as np from treem import Morph, SWC from treem.utils.geom import rotation # pylint: disable=wildcard-import # pylint: disable=unused-wildcard-import # pylint: disable=redefined-builtin from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * ...
8db2bd472b1843b599c26d6dbb86328de63ea77a3fc75e8d1720572cc21cf3f6
Python
12,073
301
import argparse import os import numpy import torch import sys import numpy as np sys.path.append('.') from src import config from src.common import get_tensor_from_camera def associate(first_list, second_list, offset=0.0, max_difference=0.02): """ Associate two dictionaries of (stamp,data). As the time stamps...
7b73ecc24b9ff6a716ebc7ef66ec7e86b51029166b84d5c29c17a9e730cc5f92
Python
12,074
308
#!/usr/bin/env python # Copyright (c) 2018-2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provide BasicScenario, the basic class of all the scenarios. """ from __future__ import print_function import opera...
30be2000f315a8fa58d729764caa59d8b6e69d3caf3a15d4f5b122003ed2af4e
Python
12,075
256
#!/usr/bin/env python # Copyright (c) 2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Wrapper for autonomous agents required for tracking and checking of used sensors """ from __future__ import print_function import mat...
02152b80d330bc7b5311506108d8241633f74cf2457f37a01382298d130b6bb4
Python
12,081
271
"""DeepSlice tilt in the core 2D pipeline. The old path (`_resolve_ccf_index`) filled only the CCF index from DeepSlice and registered to a FLAT coronal slice, discarding the predicted cut tilt. These tests pin the new behaviour: `_resolve_ccf_plane` also returns the tilt (angle_dv->pitch, angle_ml->yaw), `_obliq...
2e50a54d287b78bf848f2addae868526c31ac8e44b41dd5eb352936b850fc30f
Python
12,081
272
import os from typing import Any, Callable, Dict, List, Tuple, Union import numpy as np import wfdb from scipy import signal from wfdb.processing import resample_multichan from ....utils import get_random_dir_path from ..base_dataset import BaseDataset class P2018Dataset(BaseDataset): r''' The PhysioNet/Com...
551c9d2e3f212cc4f7b37a3b256e9a243e693045bd53b787f20afa00b69454a3
Python
12,081
275
from __future__ import print_function import time from itertools import product, islice from random import choice import numpy as np from dimensions.common import BOWLS, CUPS from learn_tools.active_gp import STRADDLE_ACTIVE_GP, VAR_ACTIVE_GP, BATCH_MAXVAR_GP, BATCH_STRADDLE_GP from learn_tools.active_rf import BATC...
f0497111eec446facccdc02a1a4ac55111556e0aa7090e4213b6ab07c6a1d0d2
Python
12,081
334
# -*- coding: utf-8 -*- """ Created on Mon Jul 12 23:16:07 2021 @author: u0139894 """ import cobra import numpy as np import os import ast class Reaction: def __init__(self, model_folder=None, model_list=None, model=None, biochem_input=None, dbType=None, fixed_bounds=None): ''' General class to ...
481814fc878761164cbe69aac84e88f2a5c06e1d59fb077ad077f462ff7b0a5b
Python
12,085
286
"""text_file provides the TextFile class, which gives an interface to text files that (optionally) takes care of stripping comments, ignoring blank lines, and joining lines with backslashes.""" import sys class TextFile: """Provides a file-like object that takes care of all the things you commonly want to d...
58388811842e3aa0d825bb41ed6f8a861e92929081f1ee7c319fe845d560a772
Python
12,087
304
# 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...
1b748918d48290daf630072cb7f5895eceae572c1ef7b9d6a73b440c1a9a3182
Python
12,088
303
""" Set of utils for helping factory classes # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 16.09.14 """ __author__ = 'martinez' __version__ = "$Revision: 002 $" try: import graph except: import pyseg.graph try: import disperse_io except: import pyseg.disperse_io #...
42212f52e8c99efecb95931465ed458a9d39d01d40a1693cf3131a4ec3c5ac7f
Python
12,088
251
# Code adapted from the appyter-catalog github repository (https://github.com/MaayanLab/appyter-catalog/tree/main), # distributed under an Attribution-NonCommercial-ShareAlike 4.0 International license. # Librairies import os import pandas as pd import numpy as np import plotly import plotly.graph_objs as go from iter...
c1ac88a2300cf4e6e95eddd56eaaed0ab189df506bb2a622ca58c98ed09a612b
Python
12,088
275
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # # 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://ww...
84e355d8bbe60a795c6215a6ba1f058e3e20716ab315fe5d10669c7ba1d56909
Python
12,090
294
#!/usr/bin/python # -*- coding:utf-8 -*- # -*-mode:python ; tab-width:4 -*- ex:set tabstop=4 shiftwidth=4 expandtab: -*- # from ctypes import * import sys if sys.platform == 'linux2' or sys.platform == 'linux': try: dll = CDLL('/usr/lib/libgxiapi.so') except OSError: print('Cannot ...
9a96fe8adedce659b4196a3127595d2c985c19d193b0ef7782514725163b9519
Python
12,090
313
import time from .pr2_utils import get_top_grasps from .utils import get_pose, set_pose, get_movable_joints, \ set_joint_positions, add_fixed_constraint, enable_real_time, disable_real_time, joint_controller, \ enable_gravity, get_refine_fn, wait_for_duration, link_from_name, get_body_name, sample_placement, \...
a668339407ab80f81fffea88768589dc5be5fec7a65f4db6bb85b2df912e0e78
Python
12,090
334
import itertools import logging import numpy as np from pyccg import chart from pyccg.lexicon import predict_zero_shot, \ get_candidate_categories, get_semantic_arity, \ augment_lexicon_distant, augment_lexicon_cross_situational, augment_lexicon_2afc, \ build_bootstrap_likelihood from pyccg.perceptron imp...
e6047fcdff089734c67f7fb5a11ed4b2a007e02813d2825d20252c2eb14927ca
Python
12,090
294
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Mar 21 10:56:33 2022 @author: deeperthought """ GPU = 0 import tensorflow as tf if tf.__version__[0] == '1': config = tf.ConfigProto() config.gpu_options.allow_growth = True config.gpu_options.visible_device_list="0" tf.keras.backend.s...
5609aef9898f28138ea5520697a6f8452435a9fd5e6f28eac1a40079c95dd7f4
Python
12,096
236
import numpy as np import math import os from neuron import h import torch import pickle from eworm.ghost_in_mesh_sim.pre_interaction import CNN, CNN2 from eworm.network.detailed_circuit import DetailedCircuit from eworm.utils import * from eworm.network import * class WormNeuralNetwork(object): """class for a wo...
cb20ba624b6240d071d6ed1e9c8c4a76adabffafdcf3c91b59186ed86be0156d
Python
12,098
453
# import tensorflow as tf import numpy as np from tqdm import tqdm import sys import torch import pickle from sklearn.metrics import classification_report def DF_train(model, dataloader, loss_func, device): model.train() # counter = 0 # loss_avg = 0 losses=[] outputs=[] y_real=[] for x, y...
da2c27733c0f277612dc9d0ad298827edadfd1e78e49ded78a41ce17c70e3af3
Python
12,100
313
import os import torch import torch_sparse import numpy as np from itertools import combinations import random from utils.sampler import Adj from torch_geometric.data import Data from torch_geometric.transforms import ToSparseTensor from torch_geometric.utils import remove_self_loops, to_undirected def add_...
6f4f0a30757534124f6180b981599ca016e04124bc3114934d4848c63bf49e3d
Python
12,111
288
""" BEFORE RUNNING ##### Manually assign corresponding labels from histological atlas see `MicroarrayData/all_structure_lut.csv` ##### Reannotate microarray data microarray probes reannotated (March 2023) ##### download latest biomart data (approved symbols for genes etc, April 2023) https://biomart.genenames.org/mar...
21239be06ea6398ae7cd5b42d4943f2e84fa4fd039786a1afd93cd0939646dc5
Python
12,112
331
"""Edge / gradient / connected-component utilities ported from MATLAB. Functions here mirror the originals in `utils/`: - canny_edge_magnitude <- canny_edge_histogram.m (the gradient-magnitude part) - threshold_histogram <- threshold_Histogram.m - canny_edge <- MATLAB's edge(I,'ca...
6ff67123ab4cd157188cedbb47a7b014faeef5ff2e84665e36dc85fdfc98df8f
Python
12,117
241
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 6 10:09:47 2023 @author: daltonm """ from pynwb import NWBHDF5IO import ndx_pose import numpy as np import matplotlib.pyplot as plt from importlib import sys import neo import elephant from quantities import s from os.path import join as pjoin fro...
1d4f576ccef4a3202ad1bb6f8372fc1256d8456f24ac4d9e7afba65f9dd58051
Python
12,118
324
from __future__ import division import logging import numpy as np import matplotlib.pyplot as plt import pandas as pd from func_unsupervised_TC import fit from IterativeMethod import iterativeTC """ Created on Mon Jun 24 16:04:07 2019 @author: Hannah Choi """ """ This code finds intra- or inter-module h...
8be014a0c841bcdebd798d6438dc3da0c85e23426cbeb4ed4bf443f6ec6fbfb1
Python
12,119
316
# 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...
5f040a931ea50779c5fa33c568d24a50599ce078c3ef7c7ec857bbd9b6424f70
Python
12,120
303
# -*- coding: utf-8 -*- import tensorflow as tf from .. import _logging as logging from .core import * __all__ = [ 'LocalResponseNormLayer', 'BatchNormLayer', 'InstanceNormLayer', 'LayerNormLayer', ] class LocalResponseNormLayer(Layer): """The :class:`LocalResponseNormLayer` layer is for Local ...
dbd804653227492e2d5b9db98e1ac5426830fe4b74f7f33ea11cb8615e49ba87
Python
12,120
400
from __future__ import annotations from collections.abc import Iterator from dataclasses import dataclass import numpy as np from typing_extensions import Self from SurvivalEVAL.evaluations.util import ( _inverse_censoring_weights, check_and_convert_event_data, validate_time_point, ) from SurvivalEVAL.no...
38a0687505089f6d86085ab8ecc344922e4c491e5d52aa456623af7c2a0db49f
Python
12,121
304
""" Multiclass test for unsupervised and deterministic classification of membrane-bound particles Input: - The STAR file with the particles to classify - Classification parameters Output: - A set of STAR files with the new classes - 2D rotational averaged around membrane normal e...
1a2cab382a9d71f639c09ce8c87d2dc08d1d2baaebdaddaf7c2d8ee1a8208a2c
Python
12,122
285
import json import re import os import time import h5py import numpy as np import csv from .kernel import NetOutInfo, DeepHE3Kernel class testResultAnalyzer: def __init__(self, data_dir, output_dir): self.data_dir = data_dir self.output_dir = output_dir self.kernel =...