sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7d1c4be30ad77b63bc7cdfac0d9b25e3aff3a457c05ee67c59451383696f31f5 | Python | 6,293 | 133 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
493afe6478d43bd2326453c1002c06907c87a44bd556002ea372401505618e0c | Python | 6,294 | 181 | import numpy as np
import pandas as pd
import scipy.signal as signal
from pathos.multiprocessing import ProcessingPool as Pool
import spikebench.oopsi as oopsi
from spikebench import SpikeTrainTransform
class SmoothingTransform(SpikeTrainTransform):
"""Smooth a set of time series"""
def __init__(self, windo... |
4270cd73771d9c323df9207c05616f183ca4a8bc6911fa14d0db97c5b30b305e | Python | 6,295 | 209 | import pickle
from pathlib import Path
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.utils import Bunch
from ..graph import MaggotGraph
from ..graph.utils import to_pandas_edgelist
version_loc = Path(__file__).parent / "version.txt"
with open(version_loc) as f:
v... |
9c85cdc45285ce9520cce76187a21403937d309603e0bc5499c744caac9dbcc3 | Python | 6,296 | 80 | """Composite every frame of a hybrid_video.py run (A = no cars, B = cars, E = engine) and write PNGs.
usage: hybrid_video_finish.py RUN_DIR [--soft 0.5] [--shadow-min 0.3] [--erode 1]
Writes RUN_DIR/frames/{naive,comp}_NNNN.png and RUN_DIR/frames/neural_NNNN.png.
"""
import argparse, json, os
import numpy as np
from PI... |
c0625e0173a82799aeef2d9eb07c2a64694b85401eeb047e70f96a4d1749a7ff | Python | 6,296 | 178 | from generators.neural_rendering import NeuralRenderer
import math
def next_upsample_step(curriculum, current_step):
# Return the epoch when it will next upsample
current_metadata = extract_metadata(curriculum, current_step)
current_size = current_metadata['img_size']
for curriculum_step in sorted([cs ... |
9e37b42785965368531f31a255799ada68b30ead7f2acfc73702cc15c212ef28 | Python | 6,297 | 152 | ## inspired by the Attributionprior repository <link>
## developed by orizuru (= orisenbazuru 😬)
import torch
from torch.autograd import grad
from torch.utils.data import DataLoader
class IntegratedGradExplainer():
def __init__(self, background_dataset, device, k=50, scale_by_inputs=True, fdtype=torch.float32):
... |
e0abbfe55f58c9e4ea9b5f962f906e7a003a1b9894d57a60a291fa8ea9debcaa | Python | 6,298 | 171 | # basic imports
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
def recover_position(state: int, width: int) -> np.ndarray:
'''
This function recover the position coordinates of a state.
Parameters
----------
state : The state index.
... |
f05e957054920aec972daf7cfaf704bffa20b64d52f6ea6f2f6b89e2481efd85 | Python | 6,303 | 150 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
5c50d5e6d4ba84a5e9ff9e3c93819a141f2d8795012d7d3aa5e67b832b53d953 | Python | 6,305 | 178 | #//=============================================================
#//Copyright (c) 2011 G. Gogoshin
#//Distributed under MIT-style license.
#//(see LICENSE.txt or visit http://opensource.org/licenses/MIT)
#//=============================================================
import os
import numpy as np
class cext:
de... |
c331565f5935dd2c0b010774bbf93faa119adea88ac6194c6acc20fbccbe6d23 | Python | 6,305 | 150 | import torch
import torch.nn as nn
import torch.nn.functional as F
OPS = {
'k3_e1': lambda C_in, C_out, stride, dilation, affine, track: MBBlock(C_in, C_out, 3, stride, 1, 1, dilation, affine=affine, track = track),
'k3_e3': lambda C_in, C_out, stride, dilation, affine, track: MBBlock(C_in, C_out, 3, stride, 3... |
cf4f64809733704a33f083eca43d23439b74b6deb79323b9f9f54ede15202f4b | Python | 6,305 | 154 | # Copyright 2021 Google Research. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
f2099e90ffe3ec4894877c8f6a50d7634cc56919989ddb13b3d218131c09de43 | Python | 6,305 | 182 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import SimpleITK as sitk
from PIL import Image
import numpy as np
import cv2
import pydicom
# parameter
classes = ["ASD", "DCM", "HCM", "pMI", "NORM"]
(a,b,c) = (3,1,1)
... |
3ac73de192fdb330d3c4c623df3384a0979ae23590b750ebb58e1ffdd06d2c9c | Python | 6,307 | 150 | from torch import nn
from .deform_pool_func import deform_roi_pooling
class DeformRoIPooling(nn.Module):
def __init__(self,
spatial_scale,
out_size,
out_channels,
no_trans,
group_size=1,
part_size=None,
... |
9e9efea14f8db93d46d0ef85948e5555b6e4b3471316c180c3846fcd8f3209f8 | Python | 6,309 | 192 | import logging
import os
from pathlib import Path
from typing import Union, List
from torch.utils.data import DataLoader
from .pt_dataset import PTDataset
from .web_utils import download_from_zenodo_record
from neuralop.utils import get_project_root
logger = logging.Logger(logging.root.level)
class NavierStokesDat... |
c97ff0889ab1bf36ad8552c868c87ce59cd837f89624c535d950827352367a24 | Python | 6,310 | 204 | import argparse, os, time, pathlib
from logging import warn
import datetime
import numpy as np
from termcolor import colored
from tqdm import tqdm
import warnings
warnings.filterwarnings("ignore")
import wandb
from logger.wandb_creds import get_wandb_credentials
wandb.login(key=get_wandb_credentials(person="sanchit"... |
48b9b66d899b2f47e42af38f7aa6f4a0cafea54c27caf0816e93e8fed277d512 | Python | 6,311 | 189 | import torch
import torchvision
import torch.nn as nn
import numpy as np
import torchvision.transforms as transforms
# ================================================================== #
# Table of Contents #
# ========================================================... |
1e1ffeb2dda235281f502b605674a89f708bada718fcbc7e31557ca50778c03a | Python | 6,313 | 253 | import sys
import pickle
#import sys
import os
import re
import numpy as np
import random
import matplotlib
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from skimage import io
import math
import time
import utils.general_utils as general_utils
import utils.plot_utils as plot_utils
import utils.math_ut... |
baf3b4a0d438e0de66137dc0560967f7daa2d0eebc7ded2adbe3f28b43d1616f | Python | 6,313 | 154 | import numpy as np
import h5py
from utils import ImageDataset
class PatchGenerator():
def __init__(self, patch_size, res_increase):
self.patch_size = patch_size
self.effective_patch_size = patch_size - 4 # we strip down 2 from each sides (on LR)
self.res_increase = res_increase
# we... |
e8c9b381523c32ba9dfa809c9bc568bd33b667947ced2e700494e6dacc5c1616 | Python | 6,317 | 226 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
##################### IMPORTS #######################
import os
import sys
from keras.models import model_from_json
from matplotlib import pyplot as plt
import numpy as np
from keras.callbacks import ModelCheckpoint
from rdkit.Chem.Draw import IPythonConsole
import os,... |
24d51ea2c835b7335fa37c934d5c5589e1adb013e79baf5509e09918e08d1acd | Python | 6,320 | 209 | # %% [markdown]
# ##
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import matplotlib as mpl
import numpy as np
import pandas as pd
import seaborn as sns
from src.data import load_metagraph
from src.hierarchy import signal_flow
from src.visualization import adjplot, CLASS_COLOR_DICT, set_them... |
f61da3683e8297430377a627f5a4adfa55a2c7c0b5f4d70424f6a10dea8fa6ef | Python | 6,320 | 154 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
9e3d5d3d4965c400ee0eeae3fa9b88badcf4cfe0b06bdc6ac175abb969a38cb7 | Python | 6,328 | 171 | """
Description:
Compare the diff scores for the nominally significant and
nonsignificant variants.
Output:
Saves all information and the figure generated to files
Usage:
variant_groups_comparison.py <features-path> <nonsig-scores-npz>
<sig-scores-npz> <output-dir>
... |
f6a23eda9906ecfdd697eca3dfd77bc0a976804bca586632befc5314cc66ca44 | Python | 6,328 | 171 | import numpy as np
import os
import torch
import torch.nn as nn
import torch.autograd as autograd
import torch.nn.functional as F
from torch.utils.data import TensorDataset, DataLoader
import torch.optim as optim
import nibabel as nib
import config as c
from utils import pytorch_ssim
def load_dataset(data, input_s... |
7e191c68af019194953084a9e4ccddeff7326baf5b49e4ba456e8cd86e8e52b2 | Python | 6,330 | 165 | import torch
import torch.nn as nn
class AdaIN(nn.Module):
"""Adaptive Instance Normalization (AdaIN) layer for style transfer in neural operators.
AdaIN performs instance normalization followed by adaptive scaling and shifting
based on an external embedding vector. This allows for style transfer by
... |
b789df33c5da3e9a63bbdad4336a406395337b69a4b3601b13f95ee46e4639c5 | Python | 6,330 | 181 | """
TT100K Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
Modified to TT100K by: Kang Seok Hoon
"""
from .config import HOME
import os.path as osp
import sys
import torch
import torch.utils.data as dat... |
e4bbca3ae2485e4619bc65eb3613c8af28204c8cd5eea4fddd4a93ad2275abf6 | Python | 6,331 | 164 | from itertools import chain
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader, TensorDataset, Dataset
from drugex.data.corpus.vocabulary import VocSmiles, VocGraph
from drugex.data.interfaces import DataSet, DataToLoader
class SmilesDataSet(DataSet):
"""
`DataSet` th... |
d2abde4f60ba6a9242bc8c5986c50a198802234763de62a6d76404416c016b40 | Python | 6,333 | 198 | # %%
import numpy as np
import pandas as pd
import logging
from box import Box
import matplotlib.pyplot as plt
import pathlib
import copy
import json
import pathlib
import pickle
import pprint
import warnings
from collections import defaultdict
import box
from box import Box
import matplotlib.pyplot as plt
import nu... |
de4df3b796239791f9e48b58d94cf23739ede253a4f6a88119fe49e1658578a8 | Python | 6,336 | 211 | # unmute when the error "libgcc_s.so.1 must be installed for pthread_cancel to work" came up
# import ctypes
# libgcc_s = ctypes.CDLL('libgcc_s.so.1')
from cell_detection import cell_detection
from spot_detection import blob_detection, spot_assignment
from image_manipulation import *
from params import *
import panda... |
f4e732d3c4b0508b1b21f8845176b07a45b0756fecc81abc02daebd02c347779 | Python | 6,336 | 213 | import logging
import numpy as np
from scipy.spatial import distance_matrix
from sklearn.neighbors import radius_neighbors_graph, NearestNeighbors
from sklearn.metrics import pairwise_distances
import pandas as pd
from typing import List, Union
def get_target_lengths(L_max, L_all):
"""Equalizes the length distrib... |
9ed4a90d819628b541b6bce323c9962c853d029b1932a674a54c31a6a88a1fc9 | Python | 6,337 | 167 | """Public API and CLI regressions for #801, part of #757."""
import gzip
from pathlib import Path
import struct
import subprocess
import sys
import pytest
from conftest import macs3_env, no_core_dumps
def run_probe(tmp_path, path, source):
script = tmp_path / "probe.py"
script.write_text('''
from pathlib i... |
c61ac2c4f27a781ad141a1b5ab40a5c075f8acfff707cfcfb6575ceb6516c657 | Python | 6,337 | 164 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
ccee962b1b0a47eeeda56a996ae2095fa1fbac0ad9ab4a278c3e6e400b51862c | Python | 6,339 | 171 | import pandas as pd
import numpy as np
from .base import Tracker
from typing import Dict
import logging
class DiffusionTracker(Tracker):
def __init__(
self,
max_diffusivity: float = 5.0,
max_blinks: int = 0,
# For the diffusion weight matrix
d_bound_naive: float = 0.1, # n... |
566bfa034645825270db58a06f38803d146ec1686f5adf804155623dfa961ebd | Python | 6,341 | 194 | # This script is part of navis (http://www.github.com/schlegelp/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# This program 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... |
82dccb68cd56da718aaf0ca7750e3a05e44136ea01347b635a6d48a8c0308936 | Python | 6,341 | 225 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"A few basic operations needed throughout Eelbrain"
from collections import defaultdict
import functools
import logging
import re
from warnings import warn
from tqdm import tqdm
LOG_LEVELS = {'DEBUG': logging.DEBUG, 'INFO': logging.INFO,
'WARNING... |
e5a38071616b6bf46caac0affe232d993b3880af515ed3e3a94ab2fcc9cd4771 | Python | 6,341 | 143 | import torch
import torch.nn.functional as F
from typing import Tuple, Union, Iterable
from piq.functional import gaussian_filter
def compute_ssim(inputs, tr_inputs):
mean_tensor = torch.tensor([0.485, 0.456, 0.406]).reshape((3,1,1)).to(inputs.device)
std_tensor = torch.tensor([0.229, 0.224, 0.225]).reshape(... |
e1133e76aa68bd2b6d148ee36c7a4ec90a5438ffbb32d7c76e25a8d914d7feee | Python | 6,344 | 164 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import partial
import tensorflow as tf
import tensorflow.contrib.slim as slim
import tflib as tl
conv = partial(slim.conv2d, activation_fn=None)
dconv = partial(slim.conv2d_transpose, activati... |
73289fbdbf887419679d659c354e3c7493262c445ed50e49aa8e57eb5978679a | Python | 6,345 | 252 | #%% IMPORT MODULES
from __future__ import division
import pickle
import argparse
import numpy as np
from grr.Tools import generateOUprocess
#%% PARSE COMMANDLINE ARGUMENTS
parser = argparse.ArgumentParser()
parser.add_argument(
'output',
help='Path to save output. '
'Pickled dict with ser_input and g... |
d53ece4c944ab9f6ad30dabd349b310a081854293239c097371a0a2094ba04f3 | Python | 6,349 | 164 | ########################################################################
# Reconstituted branched actin networks sense and #
# generate micron-scale membrane curvature #
# Modeling the shape and size of GUV dumbbells #
# Felix Frey, TU Delft, ... |
981ad322305da95c4fd5e8fc5f213c837fb5e58e1d1ebc8ed79c8b225902e68e | Python | 6,350 | 141 | """Public compiled-track and CLI regressions for #802 (part of #757)."""
from pathlib import Path
import random
import pytest
from MACS3.Commands import callpeak_cmd, callvar_cmd
from MACS3.Signal import FixWidthTrack, PairedEndTrack
@pytest.mark.parametrize("command", [callpeak_cmd, callvar_cmd])
@pytest.mark.par... |
6e93b3e035599a82372e2d2068617425158d1b0882e277bd00df55d30ec01c1c | Python | 6,353 | 164 | from dataclasses import dataclass, field
from typing import Collection, Dict, Optional
from oaklib.datamodels.obograph import Edge, Graph, Node
from oaklib.transformers.graph_transformer import GraphTransformer
from oaklib.types import PRED_CURIE
from oaklib.utilities.obograph_utils import index_graph_nodes
@datacla... |
9c4cfcea3bdac1b6a8572d05656fb602b230ed802754999b5844f9056c8cef5b | Python | 6,357 | 180 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Modules with util functions and classes for displaying images with PyQt5.
Created on Wed Jun 19 17:24:26 2019
@author: nicolas
"""
import numpy as np
from skimage import io
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QLabel, QSizePolicy, QScrollArea
from... |
c7731bd52b57779a2acc217a86343bfe4051422e9ee08b27b396808989d2dcf9 | Python | 6,362 | 155 | import os
import sys
import glob
import argparse
from multiprocessing import Pool
import gzip
from pathlib import Path
import sys
parser = argparse.ArgumentParser(description='Merge multiple kallisto count files into a matrix.')
parser.add_argument('kallisto_base_path', help='base path from where to search for kallist... |
91bd0d390ac4f29764ee9d3e502715f3347334a7cf9d0806dea6d7649f7299fd | Python | 6,366 | 154 | import unittest
import numpy as np
from pathlib import Path
from os import chdir
from nipype.interfaces.base import CommandLine
from qipype.commands import NewImage, Diff
from qipype.fitting import Ellipse, EllipseSim, PLANET, PLANETSim, eMT, eMTSim
vb = True
CommandLine.terminal_output = 'allatonce'
class SSFP(unit... |
4bdb5e12105f21b424b8bc33a50fee1d612fa45647fa6ebb38ec85940485799a | Python | 6,370 | 179 | # Copyright 2021-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
d46c174da2d3dbb1ef553ba9ba6f841a398d6cea2433addc24e129bd739e22f7 | Python | 6,373 | 156 | import torch.nn as nn
import torch.nn.functional as F
from mmcv.ops import sigmoid_focal_loss as _sigmoid_focal_loss
from ..builder import LOSSES
from .utils import weight_reduce_loss
# This method is only for debugging
def py_sigmoid_focal_loss(pred,
target,
weigh... |
64b9a58d24b71075056da7c6a578bdf5c0ddd45695b5cf3dfa01038b7e07d429 | Python | 6,374 | 163 | import re
import math
import collections
# Parameters for the entire model (stem, all blocks, and head)
GlobalParams = collections.namedtuple('GlobalParams', [
'batch_norm_momentum', 'batch_norm_epsilon', 'dropout_rate',
'num_classes', 'width_coefficient', 'depth_coefficient',
'depth_divisor', 'min_depth',... |
b187e3b9fe49cdc7179c691babe9c0b2300804cec0329109e2fbcf83b8498ab3 | Python | 6,375 | 189 | from collections.abc import Sequence
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from .bbox_overlaps import bbox_overlaps
def _recalls(all_ious, proposal_nums, thrs):
img_num = all_ious.shape[0]
total_gt_num = sum([ious.shape[0] for ious in all_ious])
_iou... |
7ee38b87ced95cfa07185bddfc672dc09739e9a25e61add2379393c9cf770403 | Python | 6,382 | 153 | # Copyright 2023 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
e144f26301300bd49fcb1e88a4add18c20e1610d67fe3fb4ab4081d48132e89f | Python | 6,382 | 143 | """Phase 3f experiment: reversal learning, Mancini 2019 paradigm.
Acquisition phase: CS_A -> reward, CS_B -> nothing (30 trials)
Reversal phase: CS_A -> nothing, CS_B -> reward (30 trials)
For each model, track m_hat(CS_A) and m_hat(CS_B) across both phases.
Compare KINETICS of acquisition vs reversal.... |
8637b870e69e73ddc6cdbf45a980a278b7d3f3f04ebfcb5119d82673acf05258 | Python | 6,383 | 172 | #!/usr/bin/env python3
"""Publish CARLA ground-truth traffic-light states to Autoware's external input."""
import argparse
import json
import signal
import time
import rclpy
from autoware_perception_msgs.msg import (
TrafficLightElement,
TrafficLightGroup,
TrafficLightGroupArray,
)
from rclpy.node import ... |
6d0a53b2b4a257b2ddf8dac88c4e452057eea6020d707e46ee232f72ed243f86 | Python | 6,384 | 196 | import numpy as np
import torch
def bbox_flip(bboxes, img_shape, direction='horizontal'):
"""Flip bboxes horizontally or vertically.
Args:
bboxes (Tensor): Shape (..., 4*k)
img_shape (tuple): Image shape.
direction (str): Flip direction, options are "horizontal", "vertical",
... |
69974b84502ebc5d599453d4b7c974feab05252d550b4158899a5f26dbb5087a | Python | 6,385 | 154 | # object for analysing hit_histograms from cascades run using TraverseDispatcher
import numpy as np
import pandas as pd
import connectome_tools.process_matrix as pm
import sys
sys.path.append('/Users/mwinding/repos/maggot_models')
from src.traverse import Cascade, to_transmission_matrix
from src.traverse import Traver... |
d93876b1dcabb5afd519f740e28d70f4c6b8a80e2007015bfaeed5d02d4b7f9e | Python | 6,385 | 146 | #!/usr/bin/env python
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import argparse
import sys
import carla
OBJECT_LABELS = {
'Buildings': c... |
1c0e01059df59193c220037171c4457de1a6e369ed0dde57cc30830eec405690 | Python | 6,386 | 166 | """CROPro normalization pipeline for whole-volume T2W preprocessing."""
from __future__ import annotations
import os
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
import numpy as np
import SimpleITK as sitk
from .resample import DatasetLayout, iter_t2w_files
def _split_s... |
e3ac998ff1483fe4bb66c3112152538eab4684981cb1c9b938592e2a4c5b6be0 | Python | 6,392 | 159 | """PhysicalAI-AV camera ring used by Alpamayo 2 Super."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class CameraSpec:
index: int
name: str
display_name: str
x: float
y_left: float
z: float
yaw_left_deg: float
pitch_up_deg: float
... |
790ec9d21133cf738c4f3ca2c65d5e44bd60e8286e23f575858e8778502a589b | Python | 6,394 | 211 | from .diverse import *
from .minimal_conv import *
from torch_geometric.nn import (
global_mean_pool,
GINConv,
GINEConv,
MessagePassing,
GCNConv,
NNConv,
InstanceNorm,
)
from torch_geometric.nn.aggr import AttentionalAggregation
from torch.nn import BatchNorm1d
from torch_sparse import Spars... |
8a94bcc7ed7e61e8bd2b368cf0d32da3b938f427022f2da36068078eee59c444 | Python | 6,394 | 255 | # %% [markdown]
# ##
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from scipy.integrate import tplquad
from scipy.stats import gaussian_kde
import pymaid
from src.data import load... |
9a7bf924ba5d5a79307f0d187ddee58bf525f9aa2c05aef8273af89493928be1 | Python | 6,398 | 143 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
a0f27dba45c21b99c407debae80dde31bdfc59aa12b883acc33894b5b4ac481d | Python | 6,398 | 158 | # Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""Smoke test for the replay aliasing fix.
The bug being prevented: when the recorder replays a ses... |
e359229f96048b939c9492ab45354a79a729eed53a507a541781e83c44cb29e3 | Python | 6,403 | 170 | import itertools
import numpy as np
from ..sequences import Genome
def in_silico_mutagenesis_sequences(sequence,
mutate_n_bases=1,
reference_sequence=Genome,
start_position=0,
... |
298d0a1ff0f1401db0d8a4ce8c27aa02c46518c6a78c187cf2a567950ad0e10a | Python | 6,406 | 192 | import argparse
import logging
import os
import re
import sys
import traceback
import pandas as pd
import pyBigWig
from pybedtools import BedTool
success_message = "successfully written to disk"
# process bigWig file and output data in bed format
def process_bigwig(
bigWig_file, out_fname, cellTypeName, chrms_di... |
7476b149ff8b3dc09145691903de3d265599566c5c92992125ee290dd49c2868 | Python | 6,406 | 191 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
7ffc6bede9a1c0bb6a86511d672eb82fd7d27d9c36fdf9352c4d6ae2a2ec75d5 | Python | 6,407 | 181 | import argparse
import json
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def cal_train_time(log_dicts, args):
for i, log_dict in enumerate(log_dicts):
print(f'{"-" * 5}Analyze train time of {args.json_logs[i]}{"-" * 5}')
all_times = ... |
39e72d599ec2eb588b64c84fe64fcfe20bd2a32c2c64cc9d04f49d4e56420537 | Python | 6,408 | 169 | # Third-party
import brian2 as b2
# Local
from cxsystem2.neurodynlib.neuron_models import PointNeuron
# ruff: noqa: RUF012
# These test are generated with Mistral AI.
class TestablePointNeuron(PointNeuron):
"""Concrete subclass for testing PointNeuron with custom __init__ parameters."""
neuron_model_defns... |
5fbb227f6f66e315456e326eb973af3daea427eb06c6e389e0493569fbd07059 | Python | 6,408 | 182 | """
File: main.py
Created: 2020/10/14
Last Changed: 2020/10/20
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program 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 ... |
6515eab6631fbe20a3e81c61ba0bdc46a9507ecb038ef0e396841206c164b5fb | Python | 6,408 | 137 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib as mpl
from pymaid_creds import url, name, password, token
from data_settings import pairs_path, data_date
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
from contools import Analy... |
9e2354053e3871dc9c9202dc387dc4f0318ddb6020991fbe267f427546e9652e | Python | 6,412 | 115 | __author__ = 'duarte'
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict
from modules.input_architect import EncodingLayer, InputNoise
from modules.net_architect import Network
from modules.io import set_storage_locations
from modules.signals import iterate_obj_list
from modules.visuali... |
59110d1d664ea044d1a9830266be8152768786ab854c55213db8e498068dfa7b | Python | 6,413 | 148 | from __future__ import absolute_import, division, print_function
import torch, math, os, sys
from torch import nn
import warnings
warnings.filterwarnings("ignore")
import torch.nn.functional as F
from torch_geometric.nn import SAGEConv, GCNConv, GraphConv, GATConv, RGCNConv
sys.path.append("..")
device = torch.dev... |
eaba7b81a7a4cb0271281489999f424338873160d7b47346511725f982d23cb8 | Python | 6,413 | 184 | '''
Batch processing: applies a script on multiple files recursively.
Parallel running on cluster uses GNU Parallel.
There must be a configuration file named `~/.parallel/cluster`.
Example file:
-j 50%
-S slave1
-S slave2
-S slave3
--progress
--wd .
'''
import os
import subprocess
import time
from .configuration impo... |
91f38cd64047ca8c611ae322003aa044cfcb05ce6c07a600c6de3ffb8f14a087 | Python | 6,414 | 126 | """Synthetic clips (ffmpeg test pattern) for smoke tests and CI — no CARLA needed."""
from __future__ import annotations
import secrets
import subprocess
from pathlib import Path
import numpy as np
from .clip import SCENE_DIR, Clip, video_file_name
from .contracts import AV_CAMERAS, CameraManifest, ClipManifest, Ri... |
ddee002e8298760d698d1f1cc525b733d11cc8c29d5f33bb14968f4fe5377bb6 | Python | 6,414 | 200 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unetsl, unetsl.model, unetsl.data, unetsl.config
from unetsl.data import VolumeViewer
from matplotlib import pyplot
from matplotlib.widgets import Slider
import sys
import numpy
import time
import math
import click
def getDataGenerator(source, n_labels, p... |
90f9165ebd7cd3331915e35e3bfdf34fad67662ceaf3566111b61a4392f33aac | Python | 6,415 | 148 | import numpy as np
import torch
from mmdet.core import bbox2roi
from mmdet.models.losses import SmoothL1Loss
from ..builder import HEADS
from .standard_roi_head import StandardRoIHead
@HEADS.register_module()
class DynamicRoIHead(StandardRoIHead):
"""RoI head for `Dynamic R-CNN <https://arxiv.org/abs/2004.06002>... |
2996e05f0ba75fc460aa77297843328559ddfc65e36d1447254438fb338e6e54 | Python | 6,421 | 182 | """
Command-line interface for scHumanNet.
This module provides a command-line interface for running scHumanNet analyses.
"""
import argparse
import sys
import os
import pandas as pd
import json
from typing import Dict, Any
from . import core, utils
def main():
"""Main CLI entry point."""
parser = argparse... |
414646b2f6200f71754749644ee1523005be30e05914c86f4dc3ce3d46a6e2e9 | Python | 6,421 | 157 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
658a31bc3a4e9bcd4ef3f86612fe13b3c23836b93d7938890370679386573ea6 | Python | 6,421 | 236 | import logging
from typing import List
import cv2
import numpy as np
from skimage.draw import disk
from skimage.exposure import rescale_intensity
from cenfind.core.data import Field
from cenfind.core.structures import Centriole, Nucleus
logger = logging.getLogger(__name__)
def resize_image(image: np.ndarray, facto... |
2aec70f2c11e5f3d7e802c2112dac31c4135d21cfae1c250195760e77201f428 | Python | 6,422 | 140 | '''
collection of chemisorption models.
newns_anderson:
'''
import torch
import numpy as np
class Chemisorption:
def __init__(self, model_name, **kwargs):
# Initialize the class
if model_name == 'gnn':
self.model_num_input = 2
if model_name == 'newns_anderson_semi':
... |
d7b8ea7aef58aa53ba126d5686827f4a1e27319caeca3fa194cc3775d8bdafce | Python | 6,422 | 140 | '''
collection of chemisorption models.
newns_anderson:
'''
import torch
import numpy as np
class Chemisorption:
def __init__(self, model_name, **kwargs):
# Initialize the class
if model_name == 'gnn':
self.model_num_input = 1
if model_name == 'newns_anderson_semi':
... |
44c4883182b99db9c8f6752be969a3975b14486a921b52d5bf09c8bd9b9505b2 | Python | 6,423 | 193 | import serial
import threading
import time
import matplotlib.pyplot as plt
from matplotlib import gridspec
# please specify the port name
PORT_NAME = "COM6"
# Parameters for serial communication
# If you change these parameters, you must also change the vhdl code on the FPGA
BAUD_RATE = 2000000 # 1000000 baud rate
NU... |
f20831dc6be18b515ee3322add8c77de8bea0fa75cb04dbc417eaf97738bd1a3 | Python | 6,424 | 143 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
f65e209c39c10aa355f572a78a0c95e4dacc2f6e50375a62428196bb5b9446a8 | Python | 6,426 | 227 | """Code to construct the VLAAI network."""
import tensorflow as tf
def extractor(
filters=(256, 256, 256, 128, 128),
kernels=(8,) * 5,
input_channels=64,
normalization_fn=lambda x: tf.keras.layers.LayerNormalization()(x),
activation_fn=lambda x: tf.keras.layers.LeakyReLU()(x),
name="extractor"... |
27550ccd07c1131971c4381f024c0f3795dba3d32b7f9fb4eea4ababd8bfe9e8 | Python | 6,428 | 168 | # Code reused from https://github.com/jennyzhang0215/DKVMN.git
import numpy as np
import math
class DATA(object):
def __init__(self, n_question, seqlen, separate_char, name="data"):
# In the ASSISTments2009 dataset:
# param: n_queation = 110
# seqlen = 200
self.separate_char... |
6badbfdd65df2e329f6e287f21bb7f5e500a3eddd1af3e65e0e06082c59caa68 | Python | 6,428 | 158 | #!/usr/bin/env python3
"""
File: export_decon_to_excel.py
Created: 2021/02/16
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program 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 ... |
0788caf3a62da27543073c108db8312b693bd505195bf74fcd4821c0eac065d8 | Python | 6,429 | 185 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
db0315c90f8f88022540e99d53559d085005f800aef482bedefba12573b21169 | Python | 6,431 | 172 | """
Vowel unmasking data pre-processing to filter summary data into a form that
is amenable for data analysis
Here we do some general housekeeping to get the columns into a common format,
create columns to make the statistics in R more straightforward and bring
together some columns containing redundant information... |
7c2f75987c14d3919f921e83de44b232c6b4090e125acb580ad9f6e90d5dd604 | Python | 6,434 | 258 | # %% [markdown]
# #
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from graspy.simulations import sbm
from src.io import savefig
from graspy.plot import heatmap
FNAME = os.path.basename(__file__)[:-3]
print(FNAME)
sns.set_context("talk")
def stashfig(name, **kws):
savefig(n... |
43d4ddde84870c1896c3f2d9ec4b9fd6343402792bdcb04a4a5c52da7557d19a | Python | 6,437 | 152 | import tensorflow as tf
# from tensorflow.python.framework.ops import disable_eager_execution
# disable_eager_execution()
class SR4DFlowNet():
def __init__(self, res_increase, block='cspnet_block'):
self.res_increase = res_increase
self.block = block
def build_network(self, u, v, w, u_mag, v_m... |
9fcf41b157c71597465212b1b02f25a08799f53a8015e6b9b4dca5b72b6793dd | Python | 6,438 | 202 | import numpy as np
import torch
import random
import cv2
class Scale(object):
"""
Resize the given image to a fixed scale
"""
def __init__(self, wi, he):
'''
:param wi: width after resizing
:param he: height after reszing
'''
self.w = wi
self.h = he
... |
1de0fb68db86a09129fc6ed8596ba18e25865fe6dca4fe434cc8d6ef1ec91390 | Python | 6,439 | 186 |
"""
Created on Mon Apr 4 2022
@author: akutschireiter
"""
import numpy as np
import circularFiltering as flt
def IdMatr(x_to,x_from,sig=0.001):
N_to = x_to.size
N_from = x_from.size
IdM = np.zeros((N_to,N_from))
for i in range(N_to):
for j in range(N_from):
dist = np.arccos(np.co... |
93a37e25bd29e95c0a219756b469bd49bc9b589debb8cb372b982fb6978cbbdd | Python | 6,439 | 171 | from typing import List, Tuple, Dict
from math import sqrt
import numpy as np
import torch
from torch import Tensor
import torch.nn as nn
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import k_hop_subgraph as subgraph
from ._base import _BaseExplainer
class GNNPool(nn.Module):
def __i... |
034dd83b44366f6d273b3a4930e143d695f982d4357abd331105aa425ff086ca | Python | 6,440 | 154 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
a0a7b4e7d78fef1059c4eb109a34a1760ccacc9799cd7b1623d7e489df0c223c | Python | 6,441 | 173 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
3ee85c03d5ff92663ca9ced9572e1fc17e9e72cee265aa79ff3e552f21cfc7a3 | Python | 6,443 | 261 | # %% [markdown]
# ##
from src.data import load_metagraph
from src.visualization import matrixplot
from src.visualization import CLASS_COLOR_DICT
from src.io import savefig
import os
from src.graph import preprocess
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from itert... |
0bdb5edc0c3615614b9fb4fb986744b6f2ed051159e0560fde021b3290f7c448 | Python | 6,445 | 159 | ####################################################################################################
# Copyright (c) 2018 - 2021, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis>
#
# This program is free ... |
44e26c7995c5fd2d90abacc5339ca03e45db54f6b43184d7b557918135b818db | Python | 6,446 | 123 | # A dictionary that contains templates of frequently used models or strings
library = {
# Adaptive exponential integrate & fire:
'adex': ('dV{0}/dt = (gL{0} * (EL{0}-V{0}) + gL{0}*DeltaT{0}*exp((V{0}-Vth{0})/DeltaT{0}) + I{0} - w{0}) / C{0} :volt\n'
'dw{0}/dt = (a{0} * (V{0}-EL{0}) -w{0}) / tauw{... |
1bb164596c3d993e60278a4e7e56e821029ef94bd9828909cfc8830eeb589bef | Python | 6,448 | 167 | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import dni
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MNIS... |
cc1dd0c3f0f2f092f11ef7182ddbdb3bc44946d9d2c2f0a6157977675469a0c0 | Python | 6,449 | 214 | import os
import argparse
import json
import pickle
import warnings
from numpy.linalg import LinAlgError
from grr.Filter_Exps import Filter_Exps
from grr.Tools import gagProcess
# Model to be fitted is imported lower down.
# PARSE COMMANDLINE ARGUMENTS
parser = argparse.ArgumentParser()
parser.add_argument('expe... |
a90476a64637e51178c25a591c773c786103f95ee8e731b2d4e59971a0f9b918 | Python | 6,450 | 151 | import datetime
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
import torch
from scipy import stats
from benchnirs.load import load_dataset
from benchnirs.process import process_epochs, extract_features
from benchnirs.learn import machine_learn, deep_learn
ALL... |
c3dd23092fb466a46c68239a852eebe59f543d26e7183e60505442bb5a71392a | Python | 6,450 | 192 | """
Turns summary data into analysis-ready data
What does that mean?
Summary data is simply all trials from each session concatenated,
whereas analysis data contains has processed variables that are
more useful for statistical assessment or plotting.
Analysis data also contains extra columns for variables (... |
22c2b4a58e49b1662d1dd617661bcf2c81e1a924ee4a21c815ed44da5d436fce | Python | 6,455 | 141 |
import numpy as np
from matplotlib import pyplot as plt
# from skimage import draw
import sys
import os
from pathlib import Path
import pandas as pd
from xai.heatmap_utlis import *
import pickle
# machine = 'solar'
machine = 'ts'
if machine == 'solar':
root = '/project/labname-lab/'
save_dir = Path(root + '... |
67e10acbc7f8f3b502b528e79e110cc5c1aaf0317a58bfedfb6a4aa341cab3e3 | Python | 6,456 | 209 | '''
Reader for EDF+ files.
'''
import re, datetime, operator, logging, sys
import numpy as np
from collections import namedtuple
EVENT_CHANNEL = 'EDF Annotations'
log = logging.getLogger(__name__)
class EDFEndOfData(Exception): pass
def tal(tal_str):
'''Return a list with (onset, duration, annotation) tuples for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.