sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6ca0c32fab5b935856255353a1674f01c35ef19fae1db7d8d2e094fab3cd159a
Python
12,076
337
import argparse import logging import os import shutil import time import warnings from pathlib import Path from pickle import dump from typing import List import matplotlib matplotlib.use('Agg') warnings.simplefilter(action='ignore', category=FutureWarning) import numpy as np import pandas as pd from sklearn.model_...
0b83a7c3f16bc09318b98f18473d84a7611ad2274f9dd37664747163994e5d25
Python
12,094
266
# -*- coding: utf-8 -*- """ Created on Tue Jun 8 17:21:16 2021 @author: fhu14 """ #%% Imports, definitions from typing import Union, List, Dict from h5py import File import numpy as np import collections from copy import deepcopy #%% Code behind def get_data_type(specs: Union[List[str], str]) -> List[str]: r"""...
f25eccb1670abc515d8fa2435321067bc4fb748a80d26f5bf6f7e99d39094a0f
Python
12,111
292
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> from typing import List, Optional, Tuple, Union from torch import Tensor, nn from sbi.neural_nets.embedding_nets.cnn import ( _validate_cnn_input_sh...
00cd83ba1c7323d751d6521a1dfbcb77696f85d8add6aebfc97d604afe18df3b
Python
12,124
311
#!/usr/bin/python # -*- coding: UTF-8 -*- """ Routines for loading and preparing Krupic lab datasets Resolution for the camera used to record R1 is 350px/m; resolution for other rats (R11 and R18) was 338px/m Fs = 50.0 # Sample rate of data (samples/second) """ from numpy import * from scipy.io import loadmat from scip...
f9accb836c1103691910cc44f9cf9f4884c7e73ae4cb8c77bec0a2e22584dba8
Python
12,124
338
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from .resnet import Bottleneck as _Bottleneck from .resnet import ResLayer, ResN...
b757cf02d2264f3b29dd8ac762a710660e462e159d5dc669a026f450af58974f
Python
12,149
322
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source...
ab2dc6de0f8b5472190b599a03bef199cf5d3b4de7126e7b32724ee8f641c511
Python
12,166
316
"""HTML reports for fitted SLM objects.""" import html import json import os import tempfile from pathlib import Path from typing import Mapping, Optional, Sequence, Union import numpy as np MapSpec = Optional[Sequence[str]] SurfaceSpec = Optional[Union[str, Mapping[str, object], Sequence[object]]] def _is_surface...
7f74fa6d453884630990836046d41f9ae53f0a3146c3c7cd317499cdc42610c9
Python
12,169
244
""" Michele, 02/09/2021, bugs fix and merge preprocessing 1D and 2D bugs: 1D and 2D: - Uses a different method to select 90% production regions (union of crops) but then uses stats90 in model evaluation (some regions will be thus missing) 2D: - image norm was very strange (norm by cum with effect of having 1s in meteo...
ab3371e5b5a7dce4832f6e525a3a32fea6c790e4fbce718572ceb4eddea77950
Python
12,188
310
# -*- coding: utf-8 -*- """ Created on Wed Oct 12 13:38:23 2022 @author: Daniel """ from phase_to_rate.neural_coding import load_spikes, rate_n_phase, load_spikes_DMK import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import os import sys import matplotlib as mpl import pdb i...
c57c5020e20490b2a004f5748839f379192ec66021c2f7f671e311f2f218c06a
Python
12,216
317
# -*- coding: utf-8 -*- """ Created on Wed Oct 12 13:38:23 2022 @author: Daniel """ from phase_to_rate.neural_coding import load_spikes, rate_n_phase, load_spikes_DMK import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import os import sys import matplotlib as mpl import pdb i...
268c94637ff378ba6d1a50c93842aa9623c3a2437c96f138123ba2c9a80e1291
Python
12,222
304
import abc import argparse import dataclasses import typing import warnings import numpy as np import pandas as pd from matplotlib import pyplot as plt from osgeo import ogr from osgeo import osr import argparse_types import models.abstract import scope_utils from argparse_ext import DeprecatedStoreAction from plots ...
8bf6d0997843b34c765aaa014303e1181f92b4fb83402a21258ffcd9f4e21c27
Python
12,222
193
"""The metric class used during network training to record metrics of interest such as the readout accuracy or reconstruction error. Example: all_metrics = metrics(evaluate_on_validation_data=args.use_validation_data) all_metrics.add_run() all_metrics.compute_and_append(results_path, flags['eval_steps'], r...
18687debd95fcd11ba9aa3eaec43b8e6560cb662584976d5e2538d444b494efc
Python
12,275
382
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 6 13:52:52 2021 @author: baris """ import numpy as np import copy import shelve import os import glob import pdb def _spike_counter(spike_times, bin_size_ms=100, dur_ms=2000): n_bins = int(dur_ms / bin_size_ms) n_cells = len(spike_times...
a17bffe85b0778f47b6ec7fc1e93dceea1fc184545ad9d90c4e45d5543fa55e8
Python
12,276
328
import torch import csv from dateutil import parser import numpy as np import time import random import os # !wget https://files.ipd.uw.edu/pub/training_sets/pdb_2021aug02_sample.tar.gz # !tar xvf "pdb_2021aug02_sample.tar.gz" # !wget https://files.ipd.uw.edu/pub/training_sets/pdb_2021aug02.tar.gz # !tar xvf "pdb_20...
8fc4b7f5272d54bd5dd77bc4e5e7db7bd3bee2fcb90093b92ae6fb9affe1101b
Python
12,277
262
############################################ # imports ############################################ import pandas as pd from joblib import Parallel, delayed from joblib_progress import joblib_progress from oligo_designer_toolsuite._exceptions import ConfigurationError from oligo_designer_toolsuite.database import Oli...
0ce90c3e5fad90b34be72cb292db4d0f042dd2f5efbd583b417785ad0afe6fb1
Python
12,280
374
# Copyright (c) OpenMMLab. All rights reserved. import copy import logging import os import os.path as osp import tempfile from unittest.mock import MagicMock, patch import mmcv import numpy as np import pytest import torch import torch.nn as nn from mmcv.runner import EpochBasedRunner from torch.utils.data import Dat...
fd16a7034fd51d10b5a4ee00a754ee4e4277d49d9578f4c07b6d0693f973eb20
Python
12,284
372
''' Author: ---- Date: 2022-04-16 11:47:44 LastEditors: GhMa LastEditTime: 2022-10-02 19:25:28 ''' import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn from torch.utils.tensorboard import SummaryWriter import os import uuid import argparse ...
726d84e705e85352bab3b5e1e55492d3d2d5a66b4af98036651f54741307fa81
Python
12,295
304
import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from scipy.stats import ttest_ind, pearsonr from sklearn.model_selection import StratifiedKFold, train_test_split, cross_val_predict, \ RepeatedStratifiedKFold, GridSearchCV from sklearn.feature_selection import VarianceThreshold from sklea...
11b5725686ba0e6b7b4d7ebc1cb59f5b045fdd7b67c78194d1366a3e143cf501
Python
12,303
304
""" This test file contains tests that involve fitting distributions to reference data and checking that the results are similar to previously saved values. All of the test datasets can be loaded using ``powerlaw.load_test_dataset()`` if you would like to experiment with them. Note: in the original repo, quakes.txt w...
c636dd2b812367fb520413fbb9d35564c95e825bcfea48d75322905be2723807
Python
12,306
317
import os os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false' from pprint import pprint import jax import jax.numpy as jnp import jax.tree_util as tree import numpy as np from functools import partial import haiku as hk import optax from absl import app, flags, logging from collections import namedtuple from tqdm i...
76e8c4c2cf156f4b849f16ab725f8c915a0765d5531e3b8bd6ab5c84b768ae11
Python
12,308
351
# -*- coding: utf-8 -*- # # LightGBM documentation build configuration file, created by # sphinx-quickstart on Thu May 4 14:30:58 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
8ea84f7e248c260d2ac24a232b187f5315a53f44f1c7bd6379a43da0da28fece
Python
12,327
293
# -*- coding: utf-8 -*- """ Created on Sun Jun 25 11:09:32 2023 @author: Anandita """ '''In this file we consider product of two different tuning curves, sigmoidal and Gaussian. We consider an even no. of dimensions and assume tuning along half of the dimensions are sigmoidal and along half of the dimensions...
27f305d822599b32971242cadc1061720cbf8bdc218c9d0750fb86eb923d42e0
Python
12,350
286
# -*- coding: UTF-8 -* import numpy as np import networkx as nx from graph import * import random import time import math import numpy import scipy import networkx as nx import matplotlib import pylab from collections import defaultdict import matplotlib.pyplot as plt from utils import * ###############################...
73f380f58fe71219d451d8f45f198105e62bf317df3246510690df6b2c2bad35
Python
12,351
297
import argparse import logging import os import random import socket import sys import datetime import numpy as np import psutil import setproctitle import torch import wandb import yaml # add the FedML root directory to the python path sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) fro...
22ef48b734ed4dc5cbe55248dc688157b7e8b4aaa98b98e247350752df21cbaa
Python
12,354
240
"""Packed periodic neighbor lists for stress training with the built-in loader. ``SizeGroupedDataset`` batches are dense ``(B, N)`` arrays, while stress needs explicit neighbor topology with periodic shifts. :class:`PeriodicNeighborCollate` converts each batch to the packed mode-1 layout the calculator uses: real atom...
f3fdc930287cdbf96192db71d29652eb8f67619cb2eb5bfdd258c750e06c7033
Python
12,373
231
import numpy as np import tensorflow as tf tf_rng_seq = tf.random.Generator.from_seed(1234) @tf.function def select_kv(key, val, len_full, len_select, select_method): ''' select some k-v pairs from the full set of k-v pairs, and append them to the list of k-v pair lists if len_select > len_full, then sele...
3834545101ceb94238612a6f333d6b0f4a781cf58adba7fa0939f87326601e55
Python
12,376
368
"""File IO for daart package.""" import csv import numpy as np import os import pickle from typing import List, Optional, Union from typeguard import typechecked import yaml @typechecked def get_subdirs(path: str) -> List[str]: """Get all first-level subdirectories in a given path (no recursion). Parameters...
7c1bf5f33fa8e2f179b834ab50e6e1895f28faaf697ce1c5cccb03d1faedb497
Python
12,389
339
# Copyright (c) OpenMMLab. All rights reserved. import copy import os from argparse import ArgumentParser from multiprocessing import Pool import matplotlib.pyplot as plt import numpy as np from pycocotools.coco import COCO from pycocotools.cocoeval import COCOeval def makeplot(rs, ps, outDir, class_name, iou_type):...
1584e9ef5af733d0c9657bc08e1ee0b867a6f151fed149056022686b2acdfb51
Python
12,395
383
import argparse import numpy as np import os import pandas as pd from pathlib import Path import pickle import shutil import subprocess import time import yaml from daart.io import find_experiment # https://stackoverflow.com/a/39452138 CEND = '\33[0m' BOLD = '\033[1m' CBLACK = '\33[30m' CRED = '\33[31m' CGREEN = '\3...
28a315fde3b348ad3c8d7fed2142a063f57e016deaf555b62ad7ed0130fc6800
Python
12,400
319
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch.nn as nn from mmcv.cnn import build_conv_layer, constant_init, kaiming_init from mmcv.utils.parrots_wrapper import _BatchNorm from mmpose.core import (WeightNormClipHook, compute_similarity_transform, fliplr_regres...
7e37094628da13d720f42f914af0aa7ff2def66bd28ec6a054bb20040e36ed0a
Python
12,409
286
""" Created on Wed Dec 1 11:46:36 2021 @author: baris """ from phase_to_rate.neural_coding import load_spikes, rate_n_phase from phase_to_rate.perceptron import run_perceptron import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns # parameters phase_bin = 360 time_bin = 250 dur...
6f7b9a3dbc7470e2d0440f7c9ce2056e492640f6b0a635e188b563f5dedc1d1f
Python
12,414
306
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> from typing import Any, Callable, List, Optional, Tuple, Union import torch import torch.distributions.transforms as torch_tf from torch import Tensor fr...
0535a1a47caaa5a784d492cf755a4fba52d8ad2cd7330a3a13fdec8ce14b1e20
Python
12,423
338
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) from typing import Optional, Tuple import torch from torch import Tensor, nn from torchmdnet.models.utils import ( ...
93263a7dc273836afa0a1aa6d55674be53cf591fcb89aac9cd4b3930a3f2d130
Python
12,437
340
# __author__ = haitham elmarakeby from sklearn import metrics from sklearn.metrics import average_precision_score import seaborn as sns from mpl_toolkits.axes_grid1 import make_axes_locatable from utils.stat_utils import score_ci from sklearn.metrics import confusion_matrix from matplotlib import pyplot as plt, ticker...
e8c79984fa3fde9383241e7b9f3bf0f5f14facc60e89bd3450d314160f631e6e
Python
12,456
337
from typing import Union, List, Optional import numpy as np import pandas as pd import re from .depth_estimation import calculate_brain_center_depths from .plane_alignment_functions import plane_alignment def trim_mean(arr: np.array, percent: int) -> float: """ " Calculates the trimmed mean of an array, sourc...
7a71e0e9d01e678e0f4395313fc27cb0676cc7f603b2a91ae86d1933b645e690
Python
12,476
202
import argparse from collections import namedtuple import math import torch # Generates bash scripts for random-search-based hyperparameter optimization. # AUXILIARY TYPES AND FUNCTIONS VarRange = namedtuple('VarRange', ['min', 'max', 'type']) rescale_rand = lambda rand_val, min_val, max_val: min_val + (max_val - min...
a99df89eab1e59af11ea2dd511b378c88be01fe768fb68f732b19d355ac589ae
Python
12,485
319
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 28 15:41:50 2020 @author: bariskuru """ import seaborn as sns, numpy as np import matplotlib.pyplot as plt from grid_short_traj import grid_maker, grid_population, draw_traj from scipy import interpolate from skimage.measure import profile_line fro...
71606f3c2a0135fc9f2cdb2b73163162798e195e8feab3c5f0988f3a9061e2dd
Python
12,492
293
import torch import numpy as np from tqdm import tqdm from functools import partial from .diffusion_utils import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like from .ddim import DDIMSampler class DDIMSampler_VD(DDIMSampler): @torch.no_grad() def sample(self, steps, ...
8c472a9bcf530583f775608166360f78e724553f52201c0adae94c61bed16304
Python
12,497
347
# -*- coding: utf-8 -*- # # This file is part of the taxopy package, available at: # https://github.com/apcamargo/taxopy # # Taxopy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
f15f0168a6b2a0d8fbd640976a4c4fc081ddc467aa6c3733fe111dbf79393fbd
Python
12,497
268
# -*- coding: utf-8 -*- """ Created on Mon Jul 4 13:44:36 2022 @author: fhu14 Training process for the repulsive model only. The electronic aspects of the SKF files are maintained as constant (not trained). The workflow looks like this: 1) Add DFTB+ predictions to the molecules using the existing analysis code ...
47f002b8b3992e9bf75bda9230dab755e9c4d183dd32a747cb7ccf76082b048a
Python
12,500
366
# ------------------------------------------------------------------------------ # Adapted from https://github.com/leoxiaobin/deep-high-resolution-net.pytorch # Original licence: Copyright (c) Microsoft, under the MIT License. # ------------------------------------------------------------------------------ import math...
2f22cd6e3ff60c6e3e5c73be5020ef0cfee3bf7ab7aaf4a43ae715bfbe42faf7
Python
12,514
329
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch import torch.nn as nn from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init, normal_init) from mmcv.utils import digit_version from torch.nn.modules.batchnorm import _BatchNorm from mmpose.models.utils.ops ...
0737655b52b7363f4169938c9e30ad5bc66980f3d16fe04b76324f13baf6b722
Python
12,525
330
import numpy as np import pandas as pd import math def get_eye_speed_outlier_threshold(eye_speed): """ Get the eye speed outlier threshold, defined as the maximum of 10 and three standard deviations above the mean eye speed in the entire experiment. All times where the eye exceeds this threshold will ...
4c347039504ed28f9f9c982c0a5ea3e552d09d5850a376799ec3c803918be2b7
Python
12,541
353
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> from dataclasses import asdict, dataclass, field from typing import Any, Dict, List, Optional, Tuple import matplotlib as mpl from matplotlib import pypl...
4772eee75eafa86d0a0931bd9c4c09d79fdba5ed6094ba525d814a5b5d51fff8
Python
12,544
343
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict, defaultdict import mmcv import numpy as np from mmcv import Config, deprecated_api_warning from mmpose.core.evaluation import keypoint_mpjpe from mmpose.datasets.datasets.base imp...
0a205d1b176379527674f98160bf147ce2d3b1d9cb5cc2a185ef663b44c36015
Python
12,550
399
# Copyright (c) OpenMMLab. All rights reserved. import cv2 import mmcv import numpy as np import torch from mmpose.core.post_processing import (affine_transform, fliplr_joints, get_affine_transform) from mmpose.datasets.builder import PIPELINES def _flip_smpl_pose(pose): ...
4ac63a24350ebed14e1d32785bfac6547f1d46760d83526d62734600c6db76db
Python
12,550
305
""" Training dataset for AnySleep model with variable channel counts. This module extends the U-Sleep sampling strategy for attention-based models that can handle variable numbers of input channels. Unlike USleep which always uses exactly 2 channels (1 EEG + 1 EOG), AnySleep can process any number of channels and lear...
f780abae554d05c77219416345f91fa122ec5c30aba789d881e8739360a51dcc
Python
12,565
347
# @author semese import torch import shutil import numpy as np import matplotlib.pyplot as plt from torch.optim.lr_scheduler import ReduceLROnPlateau device = torch.device( 'cpu') if not torch.cuda.is_available() else torch.device('cuda:0') class Trainer: ''' Wrapper class for model training and evaluation....
b2eaea86899d85ba2ea9682d4a46d44b32c5d59cfccf3144641ae8e9d170d883
Python
12,632
308
import argparse import sys import pysam def parse_options(): parser = argparse.ArgumentParser(description="This program checks " "whether reads that overlap SNPs map " "back to the same location as the " ...
b75d40012b517721cc95c45e305688d4179f6f876f4f3a2e73c93427a3b3a11c
Python
12,636
368
#!/usr/bin/python # -*- coding: iso-8859-1 -*- # # progressbar - Text progressbar library for python. # Copyright (c) 2005 Nilton Volpato # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundatio...
62524136fc8340ecbbb72ab8e36e7fe8c8a2f3ab79618498016cc55bfe41ec05
Python
12,643
270
# -*- coding: utf-8 -*- """ Created on Thu Nov 4 21:49:06 2021 @author: fhu14 """ """ Updated Cat1 DFTB+ analysis script with master functions written in run_dftbplus.py Analysis pipeline: 1) get test dataset 2) run add_dftb to compute and add targets based on trained SKFs 3) feed resultin...
ce18fcdb0ee415661ae0efdd6a66b204a517f65ec49e989ebf8d6e97cd0e9413
Python
12,646
325
import jax import jax.numpy as jnp import numpy as np from functools import partial import weno_3_coeff as coeff def get_euler_eigen_vector(u, c, H, gamma): # each of size [...] # right eigen vectors of Euler equations, R # [3, 3, ...] # _ _ # | | # | ...
cf015678f56dbe041f8f0ddbce15d42c2140c95f04f33ad929079c945aeeef3d
Python
12,646
340
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from ..builder import LOSSES from ..utils.geometry import batch_rodrigues def perspective_projection(points, rotation, translation, focal_length, camera_center): """This function computes the perspective...
ddc1286352dd19698c254bc8d9907e1f883f5685809f0ea5d6558015f881ba46
Python
12,646
317
import math import pytest from usqc.phantom import Phantom import usqc.qc as qc import usqc.data from pathlib import Path import itk @pytest.fixture(scope="session", autouse=True) def phantom(): return Phantom() @pytest.fixture(scope="session", autouse=False) # it takes forever to make the phantom image def image(...
91c08fef77750a6c06d59f22baa27e30924d6f5d5d128fa5a53cb01c2b37e28e
Python
12,650
347
import warnings import numpy as np import pytest import torch from aimnet.calculators import AIMNet2Calculator pytestmark = pytest.mark.weights def _set_method(calc, method): with warnings.catch_warnings(): warnings.filterwarnings("ignore", message="Model has embedded Coulomb module", category=UserWarn...
d90576793813bc31c93b5e655a59aeb9f184f0a7f4d99653f063c9323c5425ae
Python
12,657
410
#!/usr/bin/env python3 # Copyright 2021 Wen-Chin Huang and Tomoki Hayashi # Copyright 2022 Shuai Guo # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Evaluate log-F0 RMSE between generated and groundtruth audios based on World.""" import argparse import fnmatch import logging import multiprocessing as ...
90fc2f858bf718ba633ff1e1208ed527ee060cdb96fd9672273917cb60edfa6b
Python
12,664
245
import sys ############################# # 1. Config file, run type, name, and where to tune ############################# # run_name = 'ZM_20241220'# '20241016_75_100_maize_sunflower_soybeans_NorthernCape' #'20241004_75_100_maize_sunflower_soybeans' # runtype is overwritten when called by manager_50_ope or manager_...
c13ccd921fbf9630ed768d2b742b18340ad909b75b9e42d51e952cfa2bd2a0d1
Python
12,670
331
import os import math import torch import torch.nn as nn import torch.nn.functional as F from torchmdnet.models.energy_correction.functional import softplus_inverse, switch_function from typing import Tuple, Optional """ computes D4 dispersion energy HF s6=1.00000000, s8=1.61679827, a1=0.44959224, a2=3.35743605 "...
0533cd38bd5de507a55367241715d5a03d9fb10f604cd0f098ba00bda0f64380
Python
12,697
310
import pandas as pd import numpy as np from glob import glob from os.path import join import os import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.patches import Rectangle import seaborn as sns import re import sklearn.metrics as metrics def plot_result(df_full, x="test_score", con...
640aee60cccd284e3c977019b8326f7348b2652ef1ac9ff716a2e1e63f1b1167
Python
12,711
379
# Copyright (c) OpenMMLab. All rights reserved. from collections.abc import Sequence import mmcv import numpy as np import torch from mmcv.parallel import DataContainer as DC from ..builder import PIPELINES def to_tensor(data): """Convert objects of various python types to :obj:`torch.Tensor`. Supported ty...
9bad90fea1ee6b5e0447b218bd676aa040ec7bacd0037ee320acdca132014237
Python
12,716
417
#merge cnvnator output import os import sys import sys from optparse import OptionParser import functions #hard coded cutoffs GAP_LEN_CUTOFF = 70 GAP_CUTOFF = 90 CNV_CUTOFF = 30 LEN_CUTOFF = 70 RATIO_CUTOFF = 10 header = ["#sample","chrm","start","end","cnv","size","normalized_rd","e-val2","q0"] parser = OptionParse...
8d17ce605590f17aa7b3027c295f048a79a144fcb94790625d721c417413f4db
Python
12,725
383
from __future__ import absolute_import from __future__ import division from __future__ import print_function import binascii import codecs import marshal import os import re import sys import time import types as python_types import zipfile import tarfile import numpy as np import six class Progbar(object): """D...
1fb5af2a86ef62ce24615301068d7f59584fed0c4975163fd01ed0ca3b7f2afa
Python
12,736
353
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init, kaiming_init) from mmcv.runner import Sequential, load_checkpoint from torch.nn.modules.batchnorm import _BatchNorm fr...
ba6eb6d23915b5064a0713b62556490d601f2c67014e63ae8e3e0d28447257e5
Python
12,736
382
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from pathlib import Path import matplotlib import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np import pandas as pd import seaborn as sns # Biplot def mybiplot(score, coeff, path_name_saved_file=None, score_...
0d4b24270df8da1c0ae6c3b1a4cd6ded89fb57c2620e971889c18d045b786ab7
Python
12,748
292
# -*- coding: utf-8 -*- """ Created on Sun May 29 14:04:15 2022 @author: fhu14 """ #%% Imports, definitions from typing import Dict, List import random import os, shutil, pickle import re #%% Code behind def shuffle_dict(dictionary: Dict) -> None: r"""Shuffles the molecule list for each empirical formula in the ...
5c5af6e5f71dfdad17d85c3b87b6751c0cc515ca8e389ae90211573e520abf17
Python
12,759
341
import torch import torch.nn as nn import torch.nn.functional as F import torchvision try: from torchvision.models.utils import load_state_dict_from_url except ImportError: from torch.utils.model_zoo import load_url as load_state_dict_from_url # Inception weights ported to Pytorch from # http://download.tenso...
9a50dbb78e7cb190335feb33a113d4904844c2d4bbcf0f81d9a27d8ed16ae6c1
Python
12,768
305
import argparse import os import torch import numpy as np import cv2 from sep.training.JointModel.network import JointModel from sep.eval.get_items import compute_metrics, get_items import sep.helpers.utils as utils from sep.helpers.eval_utils import si_sdr from sep.helpers.constants import FS, SPEED_OF_SOUND from ast...
0ae2963fc8e302b4d87022f971ef54f2ee9dcb15ac034c9ecf568619d1831f01
Python
12,770
289
############################################ # imports ############################################ from typing import Any from effidict import EffiDict, LRUReplacement, PickleBackend from oligo_designer_toolsuite._constants import SEPARATOR_OLIGO_ID from oligo_designer_toolsuite.utils._logging import logger from ....
41589b9a0ce744ea3170c4b4e747c2464fcaa8d98aef3db327d3f33e040241ff
Python
12,770
357
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict import json_tricks as json import numpy as np from mmcv import Config, deprecated_api_warning from mmpose.core.evaluation.top_down_eval import keypoint_pck_accuracy from ...builder...
018e86900674b913c14b58e27c0bb6cad21607d6ffe7a5b7ebc48ddd03d15c93
Python
12,771
324
''' The code deeply follows and taken from the MRQy (https://github.com/ccipd/MRQy) @article{sadri2020mrqy, title={MRQy—An open-source tool for quality control of MR imaging data}, author={Sadri, Amir Reza and Janowczyk, Andrew and Zhou, Ren and Verma, Ruchika and Beig, Niha and Antunes, Jacob and Madabhushi, A...
ca729a0bddf376a774d6abd065a009a6df1b5d375fc2c18509354f9118fd621e
Python
12,788
417
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) import yaml import argparse import numpy as np import torch from os.path import dirname, join, exists from lightning_ut...
fd6a2f2d2d926a58857e2b653485a02d304a26b03f0b60138342ee271e7e6981
Python
12,792
294
import copy import logging import time import torch import wandb import numpy as np from torch import nn from fedml_api.distributed.fedavg.utils import transform_list_to_tensor from fedml_core.robustness.robust_aggregation import RobustAggregator, is_weight_param def test(model, device, test_loader, criterion, mode...
fd79c640580f66560f7fe053a00a8fa2a3ad4c880aa06fe7fa116f67145acbe0
Python
12,797
357
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict, defaultdict import json_tricks as json import numpy as np from mmcv import Config, deprecated_api_warning from xtcocotools.cocoeval import COCOeval from ....core.post_processing i...
381e6ea3f6110c07b1c906e0426b4d2d6f64433e8d944701ff7da45de2de5e80
Python
12,818
323
import torch from torch import nn from pl_bolts.losses.self_supervised_learning import nt_xent_loss class NT_Xent_Loss(nn.Module): def __init__(self, temperature: float) -> None: """ Initializes NT Xent Loss (SimCLR). Args: temperature (float): Distillation temperature. ...
4ae91755fdd428835b5ba5953def038119a9f65c256de9b88fd08a7c95c98f3a
Python
12,852
285
import numpy as np def weighted_component_reformat(U, V, K, indices, W): """ Reconstruct A Denoised Movie Parameter: U: decomposed spatial matrix V: decomposed temporal matrix K: indices: W: weighting component matrix Return: U_full: expanded spatial compon...
e3af076b4ce6f2af5dfc58c19df7c44c47e0e04efc5b1a06334d15bf68c97e1d
Python
12,858
325
import sys import argparse import numpy as np import pysam import util import snptable import tables import os def write_results(out_f, chrom_name, snp_tab, ref_matches, alt_matches, oth_matches, geno_sample): haps = None has_haps = False if geno_sample: # get index for t...
02ec129977a8ddec89883177583334d90d11e7d107da870498d848aa0eb571c4
Python
12,870
419
#merge erds output import os import sys import sys from optparse import OptionParser import functions #hard coded cutoffs GAP_LEN_CUTOFF = 70 GAP_CUTOFF = 90 CNV_CUTOFF = 30 LEN_CUTOFF = 70 RATIO_CUTOFF = 10 header = ["#sample","CHROM","START","END","SVTYPE","SIZE","FILTER","SAMPLE|REFCN","SAMPLE|CN","IMPRECISE","SVL...
cb878dd57d6d5eabe6e2f502b25039ff70a400f8a768df8e23aa923ecb5383d2
Python
12,876
274
import tensorflow as tf import numpy as np import jax.numpy as jnp from einshape import jax_einshape as einshape from pprint import pprint tf.config.set_visible_devices([], device_type='GPU') import sys sys.path.append('..') import utils from absl import flags FLAGS = flags.FLAGS def serialize_element(equation, capti...
33d6456378c98c515799b736d7967364cd7b52f271ae9899c2f5234b81f7911f
Python
12,877
339
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from mmcv.cnn import (build_conv_layer, build_norm_layer, build_upsample_layer, constant_init, normal_init) from mmpose.core.evaluation import pose_pck_accuracy from mmpose.core.post_processing import flip_back fro...
bf222b0ac498dcfc2785d5d65a61b5a53b6173b2e15ddc5954d0ed56da0ba7f4
Python
12,879
363
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict, defaultdict import json_tricks as json import numpy as np from mmcv import Config, deprecated_api_warning from xtcocotools.cocoeval import COCOeval from ....core.post_processing i...
3b8b3d7eb3a2e859ff1e8e5d499ec0d511e14311400d35211d42cf29c898ad84
Python
12,898
351
"""Genetic decoding using abagen.""" import tempfile from contextlib import contextmanager from pathlib import Path from threading import RLock from typing import Optional, Sequence, Union import abagen.images import nibabel as nib import numpy as np import pandas as pd from abagen import check_atlas, get_expression_...
5958c262b0c2d0d9744bac0e4010f7e43b6124476c8fb617963c1b69deaaa3d3
Python
12,904
202
from Classes.Menu import MenuBase, ImageSetDropdown, ImageSetItem, dp from kivy.uix.button import Button from kivy.uix.label import Label from kivy.uix.dropdown import DropDown from kivy.uix.checkbox import CheckBox class ConfigureScreen(MenuBase): def __init__(self, **kwargs): super(ConfigureScreen, self)...
6ab2d350f2edfe55958d30a5013227478bdb1021616a30a5ee2ca1f0a9c57325
Python
12,913
359
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict, defaultdict import json_tricks as json import numpy as np from mmcv import Config, deprecated_api_warning from xtcocotools.cocoeval import COCOeval from ....core.post_processing i...
d258d725c73be3c83be99aa1328b011953a2e84623b68e79398bbd9fb965190b
Python
12,915
196
"""Train a predictive coding network. PyTorch implementation of a Hebbian Predictive Coding network described in Brucklacher, Bohte et al., 2022. Please cite: https://www.biorxiv.org/content/10.1101/2022.07.18.500392v2 Code author: Matthias Brucklacher (UvA Amsterdam). """ import argparse from during_run_analysis.m...
cef9ea31541b0eb60e7deab900f95992aa82179f48c2da1fa2d25068ffb7d0db
Python
12,943
322
import sys import numpy as np import numpy.typing as npt from genomad import sequence, utils from genomad._paths import GenomadOutputs def branch_attention( w: npt.NDArray[np.float64], b1: npt.NDArray[np.float64], b2: npt.NDArray[np.float64], temperature: float = 2, ): w_1 = np.array( [[...
5574b6f98f79f6fd42c2398f78e3e5f92a4a6ca41920001b03bbe60a379e60b9
Python
12,997
308
import pickle import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.gridspec as gridspec import jax from jax.config import config import tensorflow as tf import os os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false' tf.config.set_visible_devices([], device_type='GP...
f0cf08bdf31206d7757182fb054986b7a0b8c292b3548393468bbf3104383fb8
Python
13,041
352
import torch import os, sys import glob from scipy import interpolate import pandas as pd import numpy as np from torchviz import make_dot from tqdm import tqdm from torch.utils.data import DataLoader from sksurv.metrics import concordance_index_censored, integrated_brier_score from torch.optim import Adam from weibull...
9de4aa650e334b51b27460c2edfc2da3767ea10a8e265eb6caf1b2a03ddff37e
Python
13,042
296
# 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 # # http://w...
0152a2096aae05a3e62b59445e22e552d0740a42276c2119c34e6bb0aeffaace
Python
13,058
313
""" Step 2 pattern separation analysis with Pearson's R. Load the raw data, extract phase and rate code and calculate Pearson's R between pairs of input and output patterns. The results are stored in a .csv file. These results are necessary to reproduce Figures 1 & 2. """ from phase_to_rate.neural_coding import load_s...
269030a98997ae3802c9993c35fb3f8182522fe65c6449a95b40ed5ea22450fb
Python
13,072
406
"""File IO for daart package.""" from pathlib import Path import csv import numpy as np import os import pickle from typing import List, Optional, Union from typeguard import typechecked import yaml __all__ = [ 'get_subdirs', 'get_expt_dir', 'get_model_dir', 'get_model_params', 'find_experiment'...
b5fe1fa671dfbd22233614f6f592ff1a2760f43ec94667282c674b636e11ac22
Python
13,078
253
import argparse from my_tools import * import matplotlib.pyplot as plt from matplotlib import rcParams, cycler rcParams.update({'font.size': 17,'font.family':'STIXGeneral'}) def cherry_colors (): col = plt.get_cmap('tab20') col = list(col.colors) col[0::2]+col[1::2] colors = np.asarray([list(el) + [1....
553e0ee39e746a47aaf9994a04f2899c85e33d57ea8d12d71339ddbff32d2221
Python
13,089
302
import pickle import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.gridspec as gridspec from absl import app, flags, logging import sys sys.path.append('../') from jax.config import config import tensorflow as tf import os os.environ['XLA_PYTHON_CLIENT_PREALLOCATE']...
12277db0618abf9b47b0025fb0433e266d20906bc24f30c889bfa37e4822b34b
Python
13,095
414
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source...
f42fcca3ef0187617ce24fd56fdd75a9fb275a1510ecbf8962aee289ade56a4b
Python
13,105
370
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # MIT License (https://opensource.org/licenses/MIT) """Decode with trained Parallel WaveGAN Generator.""" import argparse import logging import os import time import numpy as np import soundfile as sf import torch import yaml from tqdm ...
bb7f62bcd832557163603905b4ef495122a44493bd1a3d77a52234d8a140250e
Python
13,107
357
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 8 14:47:21 2021 @author: bariskuru """ import numpy as np import copy def _spike_counter(spike_times, bin_size_ms=100, dur_ms=2000): n_bins = int(dur_ms/bin_size_ms) n_cells = len(spike_times) counts = np.zeros((n_cells, n_bins)) ...
a86aea9681b97a170f05a62efe9f05689134f49f05af624f094c64dbe312b6a9
Python
13,139
361
from collections import namedtuple from copy import deepcopy import numpy as np from sklearn.svm import SVC, SVR from tpot.config.classifier import classifier_config_dict from tpot.config.regressor import regressor_config_dict def get_grid(task, model): """A general function to obtain a grid for specific task and...
fef5d3ff0fddd6778ecf70e3e1adc97d70888338f211ddb7d65d368a81e4305f
Python
13,150
409
#!/bin/env python # # Copyright 2013-14 Graham McVicker and Bryce van de Geijn # # 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 re...
672a65945bc3ad3a4925dcc8824de1521ea46602a762531e66d1252b82cf33cc
Python
13,154
361
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) import h5py import numpy as np import torch as pt from torch_geometric.data import Data, Dataset, download_url, extract...
a287c285485f0373d0738204ce57635f29583092bc79f42d9e3bc52430b9fbb9
Python
13,157
365
# Copyright (c) OpenMMLab. All rights reserved. import math from typing import Sequence import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import build_conv_layer, build_norm_layer from mmcv.runner.base_module import BaseModule from mmcv.utils import to_2tuple def nlc_to_nchw(x, hw_shape): """Co...
66ad51fa47534fb424be56bc5c8121d290c934d11b43f4896576889a97788776
Python
13,161
370
# Copyright (c) OpenMMLab. All rights reserved. """Optimize anchor settings on a specific dataset. This script provides two method to optimize YOLO anchors including k-means anchor cluster and differential evolution. You can use ``--algorithm k-means`` and ``--algorithm differential_evolution`` to switch two method. ...