sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2bfd50ddb1bcd81b80f742fe744c2144bb57331b9a6d71ea9573a2b3c257fdd2 | Python | 5,396 | 134 | import numpy as np
class network:
def __init__(self, size = 1):
self.size = size
self.adj_matrix = np.zeros([size,size])
self.mean_matrix = np.zeros([size])
self.edges = []
self.diag_val = 0
self.precision_matrix = None
self.covariance_matrix = None... |
c11abb97c0d4429474bf0f625a9341244e9ebaa3c087d5c11ef7442177cdb9c4 | Python | 5,399 | 145 | """
File: create_tech_cov_matrix.py
Created: 2020/10/15
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 Foundation, either vers... |
ac5b3e5c6a712111fa8dba478aba1d5171b37f3d8ec5bb5b2188679cf330f599 | Python | 5,403 | 153 | from __future__ import print_function, absolute_import
import os
import os.path
import numpy as np
import torch
import torch.utils.data as data
import torchvision
import torchvision.transforms.functional as TF
import h5py
from dataloader.data_utils import *
def generate_pair_images(root, subjects, actions, gap=... |
d7bc3f7a54e6921b0633ab83005bba4e96c41b66a8911ed26af7ce691ffd06e8 | Python | 5,404 | 110 | import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def main():
theme = 'white'
matplotlib.rcParams['axes.edgecolor'] = '#ff0000'
sns.axes_style("darkgrid")
N = 2999
n_clusters = 14
fixation_end = 1100
s_dm = np.load('s_dm.npy')
s_go =... |
3b32f93e5c815231c5f659b4eea4a3bd7032e495a7c099cc1e773786e22b9087 | Python | 5,405 | 124 | # 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 in... |
34692976eafa609bafb70450f759768667269ead930b1be7c03328194a6c088e | Python | 5,406 | 89 | # Form implementation generated from reading ui file 'melodicompTemplate.ui'
#
# Created by: PyQt6 UI code generator 6.6.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
... |
e41bfd9d7d64c6a3a6132621fd35b50951290ec7136857739b83e5729dd07839 | Python | 5,406 | 74 | """Close-up fidelity review on a dedicated CARLA server; restores world settings."""
import argparse,carla,math,queue,json,os,time
from pathlib import Path
p=argparse.ArgumentParser();p.add_argument('--port',type=int,default=4674);p.add_argument('--views',default='',help='Comma-separated view names; default captures al... |
d645253f1fa6dfb4366903810c8afa7f29858d2b93b23f92b2667114cfe3998a | Python | 5,411 | 168 | import argparse
import glob
import os
import requests
import pysam
import subprocess
import sys
# creates bam slices for a specified gene and assembly for all alignments in alignment path
# bam slices are output to <current workding directory/bam_slice/
# assumes you are running script from folder containing bams from... |
1d6bf0d7437ea1f0b74519bdd35db450b989d045735363f8a9a415086e21ad11 | Python | 5,414 | 133 | import torch
import cv2
import time
import os
import os.path as osp
import numpy as np
from torch.autograd import Variable
import torch.nn.functional as F
from argparse import ArgumentParser
from collections import OrderedDict
from IOUEval import iouEval
from PIL import Image
import loadData as ld
from models.baselines... |
966101faab3e53b57243a23b01e0b3afbc09c41dbd884cf070445ab2fad60d91 | Python | 5,415 | 115 | # pylint: disable=invalid-name,protected-access
import copy
from typing import Dict, Union, Any, Set
from allennlp.common import Params
from allennlp.common.testing import ModelTestCase
import sys
import os
from pathlib import Path
from allennlp.data import DatasetReader, DataIterator
from numpy.testing import asse... |
1f887f20e232e44d1a49990162aae07557efa8b3d3dcfde28e023c20d142983a | Python | 5,416 | 209 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Parse contrast expressions
AST
===
Nested tuple composed of:
- comparison: ``('comp', cell_1, cell_0)``
- Unary functions: ``('ufunc', func, arg)``
- Binary functions: ``('bfunc', func, [arg1, arg2])``
- Array functions: ``('afunc', func, [arg1, arg2, ..... |
2bad695b64af10a8b1ba402e89f56088f5cbfb8547b6636745a6b577e8dc488b | Python | 5,416 | 167 | import csv
import random
import pandas as pd
import tqdm
from base import cross_val, single_run, _load_data, _single_run
from regression.mle import MLEModel
from regression.random_forest import RFModel
from rulenn.rule_nn import RuleNNModel
from rulenn.apply_rules import print_rules, apply_rules
from dl import DeepLe... |
b9f6f8e8a9470362764c354e3a784ea1979dfb68e7a901ad9d4d9520ec175db8 | Python | 5,417 | 131 | # 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... |
0654c7c02e5f12c01d008b24335dfecb89f47aee96bd2d5dbc9742e49524f266 | Python | 5,418 | 132 | # 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... |
df3e44a3eb3adbdd3a4357dd1dd315101da15cb94b1bc5cf71b2cd945ad37b3f | Python | 5,418 | 132 | ''' Define the Transformer model '''
import torch
import torch.nn as nn
from torch import optim
from .layer import EncoderLayer, DecoderLayer, PositionalEmbedding
from .layer import pad_mask, tri_mask
from drugex import utils
from drugex.training.models.encoderdecoder import Base
class Encoder(nn.Module):
''' A e... |
b2fb53fa66a679d2d19b57d365928adec1064ce24633dc74ca2e8974a706adb2 | Python | 5,419 | 143 | import os
import scipy
import numpy as np
import random
from sklearn import metrics
import math
import scipy.io
from sklearn.metrics import mean_squared_error
from sklearn.metrics import confusion_matrix
import matlab.engine
import glob
import mahotas as mt
import random
import argparse
random.seed(6666)
eng = matlab.... |
0e0e857a7721526b14e980e48ebaaf4156083dddf0b140c05e230963e6b51e1c | Python | 5,420 | 61 | """Fresh-process material integration checks; run as an Unreal Python commandlet."""
import json,os,unreal
from pathlib import Path
root=Path(__file__).resolve().parents[4]
P=Path(os.environ.get('CARLA_MODEL3_WORKDIR',root/'artifacts/tesla-model3'))
base='/Game/Carla/Static/Car/4Wheeled/TeslaModel3UE58';r={};mel=unreal... |
19489174f24b0b8a197554b3216e8929d5b19c13c7e2d665b34e98c1c9fb0ce9 | Python | 5,421 | 163 | """Context Encoding for Semantic Segmentation"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.baselines.segbase import SegBaseModel
__all__ = ['EncNet']
class EncNet(SegBaseModel):
def __init__(self, classes=2, aux=False, backbone='resnet50', se_loss=True, lateral=False, pretra... |
1cdd9e291f160f785085b26b0ffaecb581d7af315f5068073e827bab40ec9229 | Python | 5,422 | 137 | import sys, os, re
from collections import namedtuple
'''
merge output files of EHDN after running through DBSCAN script into one file
get values for outlier, repeat size, a1000g_freq from EHdn.expansion.<date>.tsv
and merge with merged.rare.expansion.<date>.tsv for ANNOVAR annotation
manifest_1000G.txt:
EHDN ma... |
f7244af6147e1d1485aa110208c4b49d3fe1368d1b567a80615519bcfeb478f3 | Python | 5,424 | 147 | """
Handles outputting the model predictions
"""
import os
import pyBigWig
from tqdm import tqdm
from .handler import PredictionsHandler
class WritePredictionsMultiCtBigWigHandler(PredictionsHandler):
"""
Collects batches of model predictions and writes all of them
to file at the end.
Parameters
... |
b3fc017a622158943fce620b3be2c008b55b67a6e2ee905cc00c818e4a228729 | Python | 5,425 | 134 | import argparse
import numpy as np
from keras.models import Sequential
from keras.layers import LSTM
from keras.layers import GRU
from keras.layers import SimpleRNN
from keras.layers import TimeDistributed
from keras.layers import Dense
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.optimizers im... |
c22ab3baab921fe0c5bb5ca3ddb827adda91d169e92b53f152ee1845f4b6f745 | Python | 5,425 | 187 | from __future__ import (division, print_function, unicode_literals)
import numpy as np
from tensorflow_forward_ad import logger
from tensorflow_forward_ad.cbfs import bfs
log = logger.get()
def get_path_cover(adj, src, dst, bfs_cache=None):
"""Generates a list of nodes that contains all the nodes in between the
... |
f5662f154fe0dc85745ebfda97be7928b7b31ba81d6d460336e4171848c43d3e | Python | 5,425 | 158 | # Copyright 2020-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 agr... |
4eaa62ac726dce412fe2562fe634de3518b698fe2c3712e65fe8ad853c34e2b3 | Python | 5,432 | 137 | import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmdet.core import auto_fp16
from ..builder import NECKS
from .fpn import FPN
@NECKS.register_module()
class PAFPN(FPN):
"""Path Aggregation Network for Instance Segmentation.
This is an implementation of the `PAFPN in... |
78c2c38cd944cabed92ac324ada7e6146861e19f788e9af79bd5ad2f66dedc78 | Python | 5,432 | 126 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from ..box_utils import match, log_sum_exp
class MultiBoxLoss(nn.Module):
"""SSD Weighted Loss Function
Compute Targets:
1) Produce Confidence Target Indices by matching grou... |
2df10f12dcfce6777e9d576827af745fce8918d606b6be649888987d0e9f3f88 | Python | 5,433 | 137 | import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import auto_fp16
from ..builder import NECKS
from .fpn import FPN
@NECKS.register_module()
class PAFPN(FPN):
"""Path Aggregation Network for Instance Segmentation.
This is an implementation of the `PAFPN i... |
16d6fcd9e255bd5a88bb3d5447b9c3b9e0379085f2dc660669f4a622378b7338 | Python | 5,434 | 202 | #%%
import logging
import os
import time
from pathlib import Path
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy.cluster.hierarchy import linkage
from scipy.spatial.distance import squareform
from scipy.stats.mstats import gmean
from skl... |
4ab9ca29e42ec39c14685a26cd6640564bfc2aa8c91673b55d40db07a64cd84d | Python | 5,434 | 155 | '''
A few useful function for experimental recording.
'''
import os
import shutil
from clampy import *
from glob import glob
import os
import time
import datetime
import numpy as np
import datetime
import yaml
import inspect
import imageio
__all__ = ['make_experimental_files', 'cell_folder', 'prepare_experiment',
... |
a709c7a464da2ec6fd386afcaab1bab250a4a3100928aeb09ac5213cdb039fb8 | Python | 5,434 | 145 | #!/usr/bin/env python3
"""
File: export_eqtl_ad_interaction_to_excel.py
Created: 2022/05/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 ... |
e7f80c0d1f54f0017e55b1e3d9f9b8df1268a8e8283a677b36e14b842fc16642 | Python | 5,435 | 162 | import torch
import numpy as np
from numba import njit
from constants.constants import*
def NILMmetrics(pred: np.array, ground: np.array, threshold: int = 40, rounding_digit: int = 3):
def convert_precision_16_to_32(arr):
return arr.astype(float)
def divide(num, den):
if den > 0:... |
5fcf4fe3b303a74a6a59640dc3b635c73d5be6caa5ad911e9735646e90293ce9 | Python | 5,436 | 166 | from abc import ABC, abstractmethod
import logging
from typing import List, Union
import os
from palm_tools.data_structure.trackset import TrackSets
import json
import unicodedata
import re
_filename_ascii_strip_re = re.compile(r"[^A-Za-z0-9_.-]")
def secure_filename(filename: str) -> str:
# Taken from https://gi... |
b26b165eb7b24d18c88fcfada34de791fece6d15fd3842a1404fe5702366edf9 | Python | 5,443 | 176 | """
https://github.com/niecongchong/HRNet-keras-semantic-segmentation
"""
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, BatchNormalization, Activation
from tensorflow.keras.layers import UpSampling2D, AveragePooling2D, add, c... |
75928d7a40b762b0c1d99ad7b715b5d0785fd170972cef03d041f1344d45f840 | Python | 5,445 | 140 | # 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... |
19fa4020be1ece4429d7cd9d02afe6dfc69f65cd4aa83fc29a5c62a49ce78750 | Python | 5,446 | 156 | """
Script to convert jsonlines files to tensorflow binary files
Usage: python json_to_bin.py input.txt output.bin
If you want to create vocabulary you can pass additional path to the output vocab file
python json_to_bin.py input.txt output.bin --vocab_file output.vocab
"""
import os
import glob
import gzi... |
1d6dfc94d46bd45c6f41c3aad7cfd438bc594a521d6059ecacf7b135d1647b7a | Python | 5,446 | 178 | import logging
import numpy as np
import scipy.ndimage as ndim
from skimage.morphology import binary_dilation, convex_hull_image
from scipy.spatial.distance import dice
import nibabel as nib
from dipy.io.utils import (create_nifti_header, get_reference_info)
from dipy.tracking.streamline import select_random_set_of_... |
0f1d22f15e3d48af4516f38835922e61bca1570528c2a2ec37092a91631e7175 | Python | 5,447 | 175 | """
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import torch
import torch.nn.functional as F
from torchvision.transforms.functional import pad
import numpy as np
def calc_pad_same(in_siz, ou... |
046eec18f20faf792e461b0d2e0e1ee52ba89c275f1d43cc6289b02d4a7f1015 | Python | 5,451 | 113 | # 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... |
51964a2d8d79917b70fe822378e65ecbd5d2de3cf13264c8a36a067c5ffee69f | Python | 5,453 | 139 | # 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 glob
import os
import sys
import unittest
try:
sys.path.append(glob.glob('../carla/dist/... |
72ae996b939188e8990eb239f13fee6114351fa0207ec039cbc1c8eda187a35a | Python | 5,454 | 138 | import torch
import numpy as np
import networkx as nx
import matplotlib
import matplotlib.pyplot as plt
from collections import Iterable
from torch_geometric.utils import to_networkx, remove_self_loops, remove_isolated_nodes
from torch_geometric.utils.num_nodes import maybe_num_nodes
from torch_geometric.data import Da... |
d358d3ea47629780c6aeba7a9ebff64b8b8cbf54c0308c1150c91c599b758fa8 | Python | 5,458 | 128 | """Public API/CLI regressions for strand-empty chromosomes (#812, #757)."""
import subprocess
import sys
import pytest
from conftest import macs3_env, no_core_dumps
REGION_PROBE = '''
from pathlib import Path
import sys
from MACS3.Signal import FixWidthTrack
from MACS3.IO.PeakIO import PeakIO
assert Path(FixWidth... |
198236b0745adec20415d0814cb3404f4af5851c6a68979799d27d97cc9116bb | Python | 5,459 | 128 | import time
import random
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.neural_n... |
46f19b55e177e84a1b55996ec1be881f583c8f7f080b8f71c2b634433115fd6c | Python | 5,461 | 82 | import sys
sys.path.insert(0, '.')
from svgkit import Svg, C, render_png
# Traffic Manager architecture, following TrafficManagerLocal::Update (LibCarla/source/carla/trafficmanager).
W, H = 1260, 760
s = Svg(W, H)
s.text(W / 2, 42, "Traffic Manager architecture", size=26, weight="bold", anchor="middle")
s.text(W / 2, 6... |
b9edc9a13380f8050e7af8662f5f94f2fbc4c3f7c19fef8483c42d65c126910f | Python | 5,462 | 89 | # Form implementation generated from reading ui file 'rtgraderTemplate.ui'
#
# Created by: PyQt6 UI code generator 6.6.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
cl... |
01cd4ac749876af6a518b7a75f0e59b95bfd0d8e8353b685baf6cee9f9b86948 | Python | 5,463 | 138 | import math
import numpy as np
from sklearn.model_selection import train_test_split
from drugex.data.interfaces import DataSplitter
from drugex.logs import logger
from drugex.parallel.collectors import ListExtend
from drugex.parallel.evaluator import ParallelSupplierEvaluator
from drugex.parallel.interfaces import Pa... |
1ea2f93452ea2bb4b977a49d622f63c0fc3a9e61819a4cca8e764750b593ba5f | Python | 5,467 | 166 | from torch.nn import Parameter
import torch
import numpy as np
import matplotlib.pyplot as plt
from tqdm.contrib.logging import logging_redirect_tqdm
import logging
def upper_half(M):
"""
Returns coefficients located above the diagonal, under the form of a 1D array
"""
t = torch.tril(torch.ones_like(M... |
d55c74e7db681be74a0888ae75afa5d4a6d1d56474d1ad360097b72cc63d9022 | Python | 5,467 | 195 | import numpy as np
import sympy as sp
import torch
class Operator:
def __init__(self, func, name, repr, arity, complexity, sympy):
self.func = func
self.name = name
self.repr = repr
self.arity = arity
self.complexity = complexity
self.sympy = sympy
def _SAFE_LOG_F... |
7240e1bc19f77b68fa8b69619ed0de4bfe7d8e5ad41e5736739256ef8fba5af2 | Python | 5,469 | 153 | """
This script adds manually recorded temperature values to single trial data from original data for F1509
There are two ways to achieve this:
- Start from scratch (i.e. go through all data)
- Label only those trials that were previously manually selected (i.e. where only cooled trials were included in the data, whic... |
d5a500caeeabd600123324a9ed310bee74393907be787206f3677effa093070f | Python | 5,469 | 132 | # Copyright 2020 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... |
986c31c30c3c45b134ff8b656c023ca5e4ec0141edb9f3f600d0b85494870ff4 | Python | 5,470 | 162 | import logging
import pickle
import sys
import warnings
from dataclasses import asdict
import chika
import numpy as np
import pandas as pd
from hyperopt import STATUS_OK, Trials, fmin, hp, tpe
from imblearn.metrics import geometric_mean_score
from sklearn.metrics import cohen_kappa_score, roc_auc_score
from spikebench... |
1d9bd732b6c2d6794d8a19dfcfc4bf4d3fecb418847a2e8cc4eeb290bc6c0e32 | Python | 5,472 | 121 | # basic imports
import numpy as np
import pickle
import matplotlib.pyplot as plt
def load_and_prepare(prefix: str, modes: list, use_recency: list) -> (dict, dict, dict):
'''
This function loads and prepares the number of detected replays for different parameter combinations.
Parameters
----------... |
c5ebf38f37c7e6bb0514374321787fdbd28e908335e8aed4d99b72bb46dd507d | Python | 5,473 | 235 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import List, Dict
import numpy as np
import pandas as pd
from tmkit.db.biogrid.Reader import Reader as biogridreader
from tmk... |
f44f45d8103bbeab5bbbaa202b455713c61e60fb55f9e938de3e1ecb9a41db87 | Python | 5,473 | 189 | """
Refer to https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py
"""
import os
import torch
from torch.autograd import Function
from torch.utils.cpp_extension import load
module_path = os.path.dirname(__file__)
upfirdn2d_op = load(
"upfirdn2d",
sources=[
os.p... |
a0ef55a95a1509d79b5df270917e59f8f4c47ce23d165561c2ff8b4338bac6ec | Python | 5,475 | 121 | """Phase 3c rigor experiment: extinction.
After CS+/CS- acquisition, present CS+ without reward. A faithful RPE rule
should extinguish (m_hat -> 0) — this requires signed weights, which is why
we removed the w >= 0 clip in the rigor pass. The AIF agent's posterior over
class identity will adapt as the reward contingen... |
06fe587afcb5cb996af4498be0cc3e5925878a4cbe6afbf9954db1a6924465ef | Python | 5,477 | 113 | import itertools
import numpy as np
import pandas as pd
from scipy import stats
from statsmodels.stats.multitest import multipletests
DATASETS = {'herff_2014_nb': ['1-back', '2-back', '3-back'],
'shin_2018_nb': ['0-back', '2-back', '3-back'],
'shin_2018_wg': ['baseline', 'word generation'],
... |
56abe4ced91672dcfaefc434172a71b84fce5286f8d5e3ba7da1f93f25bbecdd | Python | 5,477 | 189 | '''
Figure 10.
First part, Paramecium bumping into a 'wall', modeling as an instantaneously depolarizing stimulus.
'''
from brian2 import *
from pylab import *
import matplotlib.font_manager as fm
from plotting import *
from matplotlib import gridspec
from behavior import *
import imageio
import numpy as np
fontprops ... |
e6fdb5c40372940cd9d15146873b967893cafb09f1579c6070223372e925011c | Python | 5,479 | 120 | # basic imports
import os
import numpy as np
import pickle
import pyqtgraph as qg
# framework imports
from cobel.agents.sfma import SFMAAgent
from cobel.interfaces.gridworld import InterfaceGridworld
from cobel.misc.gridworld_tools import make_gridworld
# store experiment directory
cwd = os.getcwd()
# shall the system... |
237897c2b4c258e64a03efd7ef3c7a8acf2b85a75eaacfe274e2fb70fc72048f | Python | 5,483 | 111 | import torch
import numpy as np
from torch.nn import functional as F
# Implementation of ResNet module
class ResNet(torch.nn.Module):
# Parameter initialization
def __init__(self,
num_channel,
num_chunks,
name,
inorm = Fals... |
9952e6669374fd3a584c9fa5c0e2d78107ea8766ed0ee42feec1e3e0c9150f44 | Python | 5,483 | 104 | import numpy as np
import pandas as pd
import random
# Load raw dataset by channel:
def load_channel_raw(filepath):
# Take columns five onward to include only the measurements.
# Expand dims to include a channel dim (i.e., to form shape (N, C, L)):
sigs = np.expand_dims(pd.read_excel(filepath).fillna(0).... |
0bca04a99e4596de5bb69d26a19a39e61d1a91bd9772429b1a55de3eaf9662c6 | Python | 5,484 | 149 | import numpy as np
import h5py
import matplotlib.pyplot as plt
from time import perf_counter as pc
from skimage.metrics import structural_similarity as ssim
from os import listdir
from icecream import ic
def mean_absolute_percentage_error(y_true, y_pred, eps=1e-5):
'''
Calculate the mean absolute percentage e... |
99b135c2a93b2c9a10302045e3d1ae85d1b0796c8babc313bb3224744ab588ca | Python | 5,486 | 120 | import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing
import h5py
import nibabel as nib
from nilearn.image import resample_img
import re
import numpy as np
from scipy.ndimage import ... |
339965108f194a34a3518ece15e6d52bd4bec1a76f2588e31234bfb61743603e | Python | 5,487 | 160 | import os
import torch
import numpy as np
from collections import defaultdict
def batch_by_size(batch_size, *lists, n_sample=None):
if n_sample is None:
n_sample = len(lists[0])
start = 0
while(start < n_sample):
end = min(n_sample, start + batch_size)
ret = [ls[start:end] for ls i... |
03540608f0751372b5cadbeca970fdade4cbeb6f13cc54e0b1ac1b861113cdf3 | Python | 5,489 | 159 | import math
from typing import Dict, List, NamedTuple, Optional
import torch
import torch.nn as nn
from accelerate.utils import send_to_device
from torch.nn.utils.rnn import pad_sequence
from transformers import AutoModel, AutoConfig
from hdsc.modules import ClassificationHead, SentenceLevelEncoder
PAD_ID = 0
clas... |
21cb75aa0d017dcb8b8a69ed83da3f1f816e05a3125b3f1a91af86e84920eba9 | Python | 5,489 | 151 | import numpy as np
import pytest
from polychrom import starting_conformations
def Jun_30_2022_create_constrained_random_walk(N, constraint_f, starting_point=(0, 0, 0), step_size=1.0):
"""
Creates a constrained freely joined chain of length N with step step_size.
Each step of a random walk is tested with ... |
7913f774299a9170050cf827ff04d51b2dd705ead9e307bcbda274b8e3b5a262 | Python | 5,489 | 151 | import math
import time
import numpy as np
from mindspore.train.serialization import load_checkpoint, load_param_into_net
from mindspore.train.callback import LossMonitor, Callback
from mindspore.common.tensor import Tensor
from mindspore.common import dtype as mstype
class MyLossMonitor(LossMonitor):
def __init_... |
ec71e267ab78b9627dad0081cbe8db4ce3feb6867f0fd8667617ee2e521427fb | Python | 5,490 | 154 | # 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 a... |
977b6bdde6812c641e3fd2411410b3796778eccde62f8ee6a9cba49b76f5bb3a | Python | 5,492 | 120 | ##########################################################
## ccAF: classifyPrimaryCells_gliomas.py ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ ... |
7a3544ddfd6c16260f2fb3be2b14696e7fbdc90d4a8efe482a8d874b611b2563 | Python | 5,495 | 115 | #! /usr/bin/env python3
"""Python API, end to end: capture a fresh clip from a local CARLA server, then generate.
python api_capture_to_job.py --port 2000 --frames 93 --fps 16 --vehicles 20 \\
--backend transfer2.5 [--rig nvidia_av7] [--results ./cosmos-results]
The Cosmos node is checked *before* CARLA i... |
9ecb544cca8dedaa9d44de73a67e9ddeb849f0276bdb08e89fee5f5200652cb1 | Python | 5,496 | 134 | #
# Copyright (c) 2018 Institute for Basic Science
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... |
b871836a573e8c233e6f8dfc472400f5da2b7475a7d8e6571a9a0db46d63a0c8 | Python | 5,496 | 178 | import os
import pickle
from neuron import h
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from synaptic_metrics import synaptic_metrics
from cell_models import OLMCell
from opt import myinit, mystyle
# Make plots nicer!
plt.style.use("tableau-colorblind10")
plt.rcParams.update(mystyle())
#... |
52320b2d453a2be389362986e74e4a7482cd12adb7116b3144a43a57c1092392 | Python | 5,498 | 117 | import os.path
import os
import glob
import re
import argparse
parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for ENA.')
parser.add_argument('samplesheet', help='ENA samplesheet')
parser.add_argument('fastq_dir', help='path of dir to download fastq files to')
parser.add_argument('outdi... |
9b2c7ae5c1ed0b0c10f6b02037203c519ca498c58e405ee2882155906ec94974 | Python | 5,498 | 170 | # Built-in
import os
import pickle
import shutil
import zlib
from pathlib import Path
import brian2.units as b2u
# Third-party
import numpy as np
import pytest
from scipy.stats import wasserstein_distance
# Local
from cxsystem2.core import cxsystem as cx
cwd = os.getcwd()
path = Path(os.getcwd())
anatomy_and_system... |
47051f54e538d4318bfe89cfd217979bd48ebec366af76ba8923487361c77e85 | Python | 5,502 | 155 | # 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... |
61faf11b45d5e4061d10036ab4e7bc25167f8903e1578ffc2ad13f0a88ae5bac | Python | 5,502 | 178 | import os
import pickle
from neuron import h
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from synaptic_metrics import synaptic_metrics
from cell_models import OLMCell
from opt import myinit, mystyle
# Make plots nicer!
plt.style.use("seaborn-colorblind")
plt.rcParams.update(mystyle())
# I... |
33ba4aedead4bb7d8ea178db85721fcd5058fc5f9789dcf37e011637ee00f16d | Python | 5,508 | 148 | import argparse
import json
import os
import torch
from torch.utils.data import DataLoader
from util.datasets import load_dataset
from lib.models import get_model_class
from time import gmtime, strftime
from train import start_training
import numpy as np
from feature_extraction import extract_features
# Script start... |
7a2e9de4d661c14e2ec2a7f344be7371f5324ba98b0e83f72e6fcaec1bfe0533 | Python | 5,509 | 175 | # Copyright 2020 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... |
109f296a42884aec797d03c222fe3691e2fee79c04a53a352172c49c75c45396 | Python | 5,510 | 137 | """File for accessing YOLOv5 models via PyTorch Hub https://pytorch.org/hub/ultralytics_yolov5/
Usage:
import torch
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
"""
from pathlib import Path
import torch
from models.yolo import Model
from utils.general import check_requirements, set_logging
from u... |
97062c1bb6710610f50dacee40f8b518097a72e266bc2c319ab71de8ad2833d0 | Python | 5,513 | 162 | from itertools import chain
import os
from matplotlib.pyplot import axis
import numpy as np
import pickle
import glob
from numpy.core.fromnumeric import shape
from pandas.core.indexing import _AtIndexer
from torch.utils import data
import utils.dataTrans as dt
import torch
from sklearn.model_selection... |
e4b48b9072104ab952a6b0a2fcd9288a2e640000d42ab0520efe586705e3981a | Python | 5,515 | 156 | #!/usr/bin/env python3
"""
File: visualise_gene_celltype_correlations.py
Created: 2020/09/09
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
th... |
5840de6bc9ffdabbd41e8ffec39d28d83b68edb6728b209c443ab4de62fa3db0 | Python | 5,516 | 139 | """
File: correct_cohort_effects.py
Created: 2020/10/08
Last Changed: 2020/10/19
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, ... |
4519c8cc690799058407afb518409b573cd06e8be49b536c23218778b4a5dba5 | Python | 5,517 | 152 | from __future__ import division
from collections import OrderedDict
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import DistSamplerSeedHook
from mmdet.apis.env import get_root_logger
from mmdet.core import (CocoDistEvalRecallHook, CocoDistEvalmAPHook,
... |
84273a08ddb201c8e96f973a71075bc3c39f51aff0531f029a7a413c926ea0ee | Python | 5,518 | 108 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'rtgraderTemplate.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtC... |
3a48d78cb59b9e22c17da75747abde79554429f052e5cc2bc9cae860b3e161c9 | Python | 5,521 | 139 | """
File: correct_dataset_effects.py
Created: 2020/10/08
Last Changed: 2021/07/28
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,... |
0dd077001f78ca499712ca63d310aa7a1f8f5e2fd430bb549abf61e5c100777a | Python | 5,522 | 154 | #coding = utf-8
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law ... |
e1d54176fe1843b4483c1570e64da634871e44346f7a2734a34431fc802cd338 | Python | 5,523 | 148 | #! /usr/bin/env python
##########################################################################
#plot_gcskew.py plots gcskew values for a given chromosome
#Copyright (C) 2020 Jennifer Lu, jlu26@jhmi.edu
#
#This file is part of SkewIT
#
#SkewIT is free software; you can redistribute it and/or modify
#it under the te... |
5fd1f9dc67fe39637586512a4a2e07152f96ff23709385b7e1e532ff1101f671 | Python | 5,524 | 143 | import numpy as np
import pickle
from sklearn.decomposition import TruncatedSVD
########### MOUSE DATASET FRAME WIDTH
FRAME_WIDTH_TOP = 1024
FRAME_HEIGHT_TOP = 570
# SVD paths
svd_computer_path = 'util/datasets/mouse_v1/svd/calms21_svd_computer.pickle'
mean_path = 'util/datasets/mouse_v1/svd/calms21_mean.pickle'
def... |
71f7688dedf769411802173d9e3eaf6849c32c7963aae7f535fe58ffca37642c | Python | 5,528 | 144 | """
processing
Created by: Martin Sicho
On: 27.05.22, 10:16
"""
import math
import numpy as np
from sklearn.model_selection import train_test_split
from drugex.data.interfaces import DataSplitter
from drugex.logs import logger
from drugex.parallel.collectors import ListExtend
from drugex.parallel.evaluator import Pa... |
152f1e84968540ceb3424d8da6ae95db92dd1f9d50a54ebc5f7837dcdf38930b | Python | 5,532 | 153 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import itertools
import random
import unittest
from torch.utils.data.sampler import BatchSampler
from torch.utils.data.sampler import Sampler
from torch.utils.data.sampler import SequentialSampler
from torch.utils.data.sampler import RandomSampler... |
b9bdd036e43f9836292f6241b85e410a3ab9663858219de662ad7050ed94747e | Python | 5,533 | 165 | import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
import numpy as np
from PIL import Image
from .builder import DATASETS
from .custom import CustomDataset
@DATASETS.register_module()
class XMLDataset(CustomDataset):
"""XML dataset for detection.
Args:
min_size (int | float, optio... |
94b423fcc7a8446643e558992152ca1851bba117503b6f6c0fc16978f3f8db57 | Python | 5,534 | 163 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Main module of AxoID user correction GUI with the main window widget.
Created on Tue Jun 18 17:16:11 2019
@author: nicolas
"""
import os.path
import sys
import shutil
import argparse
from PyQt5.QtWidgets import QApplication, QHBoxLayout
from .multipage import Multi... |
a1891aff02f6a0648d6fdf55b9009b130fdeada454076ccb0bf2e25a5e0103dc | Python | 5,542 | 172 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score, roc_curve
import multiprocessing
n_train = multiprocessing.cpu_count()
n_test = multiprocessing.cpu_count()
ligands = ["ADP", "COA", "FAD", "HEM", "NAD", "NAP", "SAM"]
lig2num = {l:... |
55e888af849ce412e1384e7206af882fd9bbff33aafee1d5de8ed0aae0d9b0d5 | Python | 5,543 | 131 | import numpy as np
import os
import ntpath
import time
from . import util
from . import html
import scipy.misc
try:
from StringIO import StringIO # Python 2.7
except ImportError:
from io import BytesIO # Python 3.x
class Visualizer():
def __init__(self, opt):
# self.opt = opt
self.... |
5fe0b1ae5f874b18907272648fa4b54e2f496f8183dc4f17f35fcaa0a111645b | Python | 5,543 | 160 | #%% [markdown]
## Linking transcriptome and connectome via graph matching
# > A simple attempt to see if one 'ome can be aligned to the other 'ome
#
# - toc: true
# - badges: false
# - categories: [pedigo, graspologic]
# - hide: true
# - search_exclude: true
#%%
import os
import time
from pathlib import Path
import m... |
57381d5268018189ef1fa3c9326b276cdd337713860e775d3bf2be66aa01e110 | Python | 5,547 | 144 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch.nn import functional as F
from maskrcnn_benchmark.layers import smooth_l1_loss
from maskrcnn_benchmark.modeling.matcher import Matcher
from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou
from maskrcnn_benchmar... |
a5001ba50cc7d8a77c9e8d3888f8efc4794eba88a74e466410dfa93f8e25f5d6 | Python | 5,547 | 158 | # 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... |
bd0618ee2ecea7e8e39034ebdc96ee84c403035ee2f34fe2853c3ffd3995fc38 | Python | 5,549 | 149 | # 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... |
d6e604084944ac14edc52f3b20591504e1aca992f4b135bd0fc7d83387473524 | Python | 5,549 | 193 | #!/usr/bin/env python
# -*- coding: latin-1 -*-
#
# Copyright 2016-2021 Blaise Frederick
#
# 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/LICEN... |
a93cf9239708d4fb1a618ce136130a76ecfe9be37cf00b19a93544ac02c74337 | Python | 5,551 | 161 | import pandas as pd
import logging
import numpy as np
import torch
import math
from typing import Tuple
from torch import nn, Tensor
import torch.nn.functional as F
from torch.nn import TransformerEncoder, TransformerEncoderLayer
class PositionalEncoding(nn.Module):
def __init__(self, d_model: int, dropout: floa... |
d5dadc142f00aa7b92b9358b87128bdfb995c65323bede53c8087e11f818a658 | Python | 5,551 | 189 | import numpy as np
from scipy.special import psi
# hutter mutual information per Gershman
# Args:
# tm: 2d numpy array of raw transition counts, assumes rows are states and columns are actions
# alpha: specifies regularization, typical values are between 0-1
#
# Returns:
# I: mutual information between "states" an... |
978d81558051049adfb68566a3dafbaa0643c824c8e72892af97801acfc0980f | Python | 5,553 | 131 | import geopandas as gpd
# pygeos is required to use geopandas spatial indexing
gpd.options.use_pygeos = True
import descarteslabs as dl
import json
from tqdm import tqdm
class DescartesQueryRun(object):
def __init__(self,
roi,
pixel_product_name,
pixel_version,
... |
cb3138cb6b107b6ec5028e980ed6b3ce92eca13e830a72f7d83a0e0a9a9a653c | Python | 5,554 | 139 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.