sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b9ab662323c2c2bc9cf7ce075ac4a92904fca27c6c8b526b29a44cd00320f10d | Python | 4,916 | 124 | #!/usr/bin/python
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the gradunwarp package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
import argparse as arg
import os... |
6ec2fb4da37368da49ec9c046fc46f319fab47b690b850c5c7a348b57769f9fb | Python | 4,920 | 124 | #!/usr/bin/env python
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the gradunwarp package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
import argparse as arg
impor... |
8af0b1eb289a94f4bbf4b3ff46f479c4034ef8e14e7f6e0f22d45d0a4a454c2f | Python | 4,922 | 133 | import os
import time
import logging
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
from .data.data_handler import kfold_split
from sklearn import metrics
d... |
a78c7d649424ba3129c742288703d7bd3e80420cce37bdec2f7ce693cd9e9ac8 | Python | 4,925 | 178 | # -*- coding: utf-8 -*-
"""
Spyder Editor.
This is a temporary script file.
"""
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import find_peaks
from cell_models import VIPCRCell
from opt import myinit, mystyle
# Make plots nicer!
plt.style.use("seaborn-colorblind")
plt.rcP... |
d48621ac33b7e1a8fd1db73be9982e3171d3efe8e43cf9605701b85f0da9180a | Python | 4,925 | 88 | """Build M_LensRain from the versioned RainLens.ush shader.
Run with UnrealEditor-Cmd <project> -run=pythonscript -script=<this file>
-nullrhi -unattended -nosound. Keeps the old M_screenDrops for comparison.
"""
import unreal
DEFAULTS = [("Coverage", 1.0), ("DropScale", 1.2), ("Refraction", 0.75),
("Soft... |
6df2fd6d9cfebd3a390afdaad33f3f032d12d2bf041b911757e7919ecc2ae520 | Python | 4,928 | 187 | import cv2
import numpy as np
import numbers
import random
import collections
def get_2dshape(shape, *, zero=True):
if not isinstance(shape, collections.Iterable):
shape = int(shape)
shape = (shape, shape)
else:
h, w = map(int, shape)
shape = (h, w)
if zero:
minv = ... |
120f0903e37d52a10838c5bd27caa4528387d52432e5e494646ddd74fe9f13f5 | Python | 4,929 | 124 | #!/usr/bin/env python3
"""
File: preprocess_matrix.py
Created: 2020/11/03
Last Changed: 2020/12/01
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 So... |
8e41d1f6d87f9424cbe1d9855c55b3571ef68a16006bfc043a3c284ee378b190 | Python | 4,930 | 157 | # 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... |
02c683e764ac2e4946ead9f0f836ee23d48152a7bc6392e80e857129a8e5a0a8 | Python | 4,931 | 125 | ####################################################################################################
# Copyright (c) 2019, 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 softwar... |
bd9264c9a53edfc1281fd3599638d1b75b3735d629b05d019f6b19e8ace19b68 | Python | 4,931 | 148 | '''
Integrates trajectory for many cycles
- tries to load previously computed cycles; starts from the last point available
- saved result in a separate file (e.g. phi_0_pt1.npy)
- finishes early if a trajectory almost converged to a fixed point
- IF integrated for many thousands of cycles - may want to uncomment `phi... |
1680af7b8b701061a6ac4a322bb7dd2601a14cd988252c2438ee4cada7993c32 | Python | 4,932 | 119 | """Paper Figure 3: novel-odor signaling and the AIF / Bayesian-observer channel.
Layout (1 x 3):
A — |DAN| comparison: familiar vs novel for RPE and AIF
B — Distribution of AIF DAN responses across novel odors (reaches log 2)
C — Habituation curve on repeated novel-odor exposure (Hattori signature)
This figure ... |
0884d67ed3faebf6d4587d6b9e4dd68dfd2219500d8b30e24140989ffd27b497 | Python | 4,933 | 135 | import gc
from dipy.io.streamline import load_tractogram
import numpy as np
from dipy.io.stateful_tractogram import StatefulTractogram, Space
import os.path as op
try:
from trx.io import load as load_trx
has_trx = True
except ModuleNotFoundError:
has_trx = False
from AFQ.utils.path import drop_extension,... |
955caac41d125888a34d64cba908b205e39055e06e13d921646eaee4d989da18 | Python | 4,936 | 159 | import os.path as op
import logging
from AFQ.utils.path import drop_extension
logger = logging.getLogger('AFQ')
__all__ = ["Definition", "find_file", "name_from_path"]
class Definition(object):
'''
All Definitions should inherit this.
For a given subject and session within the API, the definition is ... |
d645864aec6a8dd088ec0233bf558be7bfbb07a684f48bdd7fbc5b6bcd041ab0 | Python | 4,938 | 179 | # -*- coding: utf-8 -*-
"""
Spyder Editor.
This is a temporary script file.
"""
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import find_peaks
from cell_models import VIPCRCell
from opt import myinit, mystyle
# Make plots nicer!
plt.style.use("tableau-colorblind10")
plt.r... |
e0f3e3279bde1720e118eddc3b06dc8f44a14650a17c8e05ebf6be986b5e1b65 | Python | 4,938 | 149 | """
DeepCT architecture (TODO: Add our names).
"""
import numpy as np
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
class DeepCT(nn.Module):
def __init__(
self,
sequence_length,
n_cell_types,
sequence_embedding_length,
cell_type_embedd... |
f278f218ed717d804cf74e4108ce3ffc94b7125a92adee776688f26048daad07 | Python | 4,939 | 149 | # 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... |
09cdc2e6384a537e98df4f1380e5a14f08072e34a151aa49b5424d9928481b6d | Python | 4,941 | 145 | # This script performs transfer learning
# input files: sm_seas_cycle.pkl, amsr_3dm.pkl, smos1020_out_short_2002-2010_JULY_for_HOVEMOLLER.pkl
# input preptained NN: amsr_smap_residual_v1.h5
# output files: new NN amsr_smap_transfer_1.h5, transfer_output_short_ver1.pkl
# auxiliary: amsre_3dm_seas_cycle.pkl
import s... |
96632f7faa5baff0fd010b957fbb0746d74c8cf3fa44e900dabf749e03b3516a | Python | 4,942 | 140 | import json
from random import randint
from subprocess import Popen, PIPE
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.metrics import accuracy_score, matthews_corrcoef
from sklearn.model_selection import train_test_split, RepeatedStratifiedKFold, RepeatedKFold
from sklearn.da... |
268ff3e5815c88db7888aaae6300d74b3602e334e412dce4642d8c38e4348c0e | Python | 4,943 | 147 | # 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... |
227c7b495a03a210e196159618c12fda0b20f9eed5581af500d7c33db91fe2a3 | Python | 4,944 | 138 | '''
@author: Mahbub Ul Alam (mahbub@dsv.su.se)
@version: 1.0+
@copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se)
@license : MIT License
'''
import torch
from transformers import AutoTokenizer, AutoModel, AutoConfig
import pandas as pd
import pickle
import sys
device = torch.device("cuda:0" if torch.cuda.is_av... |
69add3dc650714dea0be0cb352c0b4be65d0ce1b232d155a06f13cd2612608a8 | Python | 4,948 | 135 | # 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... |
c1f4bc6a371699416983fa043d5d58b491b4c50357c4addc51da833c7a7ae22c | Python | 4,949 | 126 | import random as rnd
import numpy as np
import csv
def write_header(filename):
fieldnames = ['source', 'target','index', 'start_x', 'start_y', 'start_z', 'rotate', 'rotation_plane', 'rotation_degree_idx', 'coverage']
with open(filename, mode='w', newline='') as csv_file:
writer = csv.DictWriter(csv_fil... |
88b447883f39a869c1eaae6b3162b949cdcd3fb55ab44f5db49d3d4bc1fa37f5 | Python | 4,950 | 116 | #%%
from pymaid_creds import url, name, password, token
import pymaid
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
from contools import Promat, Celltype, Celltype_Analyzer, Analyze_Cluster
# allows text to be editable in Illustrator
plt.rcParams['pdf.fonttype'] = 42
plt... |
a526680809799659aac78bc7c0584a0cbd22849ed8c0406a26678bc491911e0b | Python | 4,951 | 148 | #!/usr/bin/env python
# Author : Gaurav Kumar (Johns Hopkins University)
# Gets a report on what the best word error rate was and which iteration
# led to it. This is needed both for reporting purposes and for setting
# the acoustic scale weight which extracting lattices.
# This script is specific to my partitions and... |
e83069f5867a537e3ee15742c076a32be63238198dd1b24e1748597b9e7b3846 | Python | 4,951 | 155 | from abc import ABC, abstractmethod
from drugex.logs import logger
from drugex.molecules.interfaces import MolSupplier
class Vocabulary(ABC):
"""
Definition of the vocabulary interface. All vocabularies contain "words" that are used for encoding and decoding molecules.
"""
def __init__(self, words):... |
f5f8ec7175add5a7c1d35a6280f88101676f7f7c0b3797d2a0a17f89047df72f | Python | 4,951 | 118 | """
File: inter_clustermap.py
Created: 2020/03/16
Last Changed: 2020/06/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, either... |
f648607e2a3e7074a2e501595dc69c914050b1f8b545398fe1b284dc9cce2246 | Python | 4,953 | 145 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
import time
class Pair:
"""
window.pair class offers methods to perform a sliding
window op for each of central residue pairs f... |
40d3b81e8dbfd049b1ba13b0205316224488c2e4aba40b13c89f4d2925904a7a | Python | 4,954 | 162 | import os
import copy
import tensorflow as tf
import numpy as np
import pandas as pd
import math
import random
import matplotlib.colors as colors
from sklearn.model_selection import train_test_split
from sklearn.decomposition import PCA
from siVAE.data import data_handler as dh
from siVAE.util im... |
bb24d21af585f27a406b872abe0696c37e5d21992a2237287d17fadc6e985378 | Python | 4,954 | 107 | """
This file contains functions to interact with an s3 bucket. Specifically read a feather file, save a dataframe as a
feather file, and convert a json file to a feather on an s3 bucket.
Taken from https://gist.github.com/sminot/a82ad01eb28bd2114bf34fd6c7d99f6e
@author rdalrymple@riversideresearch.org
"""
impo... |
1f0cde92673df747cfac98077f0d142d8492a83dcc710663174e252215b67998 | Python | 4,956 | 112 | import argparse
parser = argparse.ArgumentParser(description='Merge psychEncode with eQTLs from Sieberts et al.')
parser.add_argument('Sieberts_eqtls', help='eQTLs from Sieberts et al. study')
parser.add_argument('psychEncode_eqtls', help='eQTLs from psychEncode study')
args = parser.parse_args()
def parse_sieberts... |
63b291b558a8485b5e3d433062ebe10635554a4dbc3969d277f1fbaac91c43e1 | Python | 4,956 | 139 | """
File: inter_pvalue_boxplot.py
Created: 2020/05/12
Last Changed: 2020/06/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, ei... |
1a6aa4c37c97652ec59985f83a106c2bd4b682be4149aabe14ae29be19e9a275 | Python | 4,957 | 124 | """
File: cmd_line_arguments.py
Created: 2020/10/15
Last Changed: 2020/10/27
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, eit... |
852238a4b09183cf2f69833b44e2069455e869cbd8b87758c8af8a88906e768b | Python | 4,959 | 149 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import Dict
import pandas as pd
from tmkit.util.Reader import Reader as greader
class Reader:
def __init__(self) -> None:... |
bb4dcd49eeed6a27a30a33c3ee017bcebdf51fc66601fd15bbd900d2fb04f0de | Python | 4,959 | 136 | # 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... |
cdac490b9cf7827758ac6a06658d18ac89c3240db121ff0cc358e1e515e50005 | Python | 4,961 | 142 | # Takuya Ito
# 11/29/2018
# Balloon-Windkessel model for hemodynamic response modeling
# Equations and default parameters taken from:
# Friston KJ, Harrison L, Penny W (2003) Dynamic causal modelling. Neuroimage.
import numpy as np
def balloon_windkessel(z, sampling_rate, alpha=0.32, kappa=0.65, gamma=0.41, tau=0.9... |
d6c413e9fb332f35202ef3432e1f682c6dc60d46a0c8da7e154ea35108cb12a1 | Python | 4,961 | 181 | # -*- coding: utf-8 -*-
"""
Spyder Editor.
This is a temporary script file.
"""
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import find_peaks
from cell_models import VIPCCKCell
from opt import myinit, mystyle
# Make plots nicer!
plt.style.use("seaborn-colorblind")
plt.... |
ebf5e170d5760da3892ba410b12475676609f0b93e16ef01ebeae449eee6972e | Python | 4,961 | 162 | # -*- coding: utf-8 -*-
import keras
import keras.engine as engine
import keras.layers as layers
import keras.optimizers as optimizers
import unetsl.cli_interface
import unetsl.model
import unetsl.data
import random
import sys
import numpy
from keras.models import load_model
from skimage.external.tifffile import Tiff... |
fda8c806437a8c8f8dd9d603a237a7162daf0f959edfdf0f582fe6ff695733c6 | Python | 4,961 | 162 | """
compute Multiply-Adds(MAdd) of each leaf module
"""
import torch.nn as nn
def compute_Conv2d_madd(module, inp, out):
assert isinstance(module, nn.Conv2d)
assert len(inp.size()) == 4 and len(inp.size()) == len(out.size())
in_c = inp.size()[1]
k_h, k_w = module.kernel_size
out_c, out_h, out_w ... |
42970f2b16a5488ef3344f669447ff9f927d36d7cd959885caba10d7767ddef6 | Python | 4,962 | 148 | #!/usr/bin/env python
# Copyright (c) 2024 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>.
"""Top-down view of a Hybrid Solid-State LiDAR point cloud.
The HSS LiDAR (`... |
e573e31aab8a1614d571024e169a6127aed862664e98831194a773812f616211 | Python | 4,962 | 168 | # -*- coding: utf-8 -*-
"""
compute Multiply-Adds(MAdd) of each leaf module
"""
import torch.nn as nn
def compute_Conv2d_madd(module, inp, out):
assert isinstance(module, nn.Conv2d)
assert len(inp.size()) == 4 and len(inp.size()) == len(out.size())
in_c = inp.size()[1]
k_h, k_w = module.kernel_size... |
442d7cbe499e2dd7e97256263c29edeb47210c43b37d951ca966477e80e0a3c1 | Python | 4,963 | 181 | # -*- coding: utf-8 -*-
"""
Spyder Editor.
This is a temporary script file.
"""
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import find_peaks
from cell_models import VIPCCKCell
from opt import myinit, mystyle
# Make plots nicer!
plt.style.use("tableau-colorblind10")
pl... |
72d6bb44e4c7c39c279dce18b3612556c37dc015e1fe721fb20a568e06038b10 | Python | 4,963 | 124 | #!/usr/bin/env python3
"""
File: preprocess_matrix.py
Created: 2020/11/03
Last Changed: 2020/12/01
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 So... |
9e02182039df7e580c7532554bb454a76cc568ae9926a12ccbbed6ed35105fb0 | Python | 4,964 | 138 | # 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... |
7e13e5695ba6d521575b8b9026bed90b0755a1ab4eb1f44f829c933c956f750f | Python | 4,966 | 158 | from joblib import Parallel, delayed
from typing import Callable, Optional
from tqdm.auto import tqdm
import pandas as pd
import numpy as np
def apply_parallel_joblib(
group_obj: pd.core.groupby.generic.DataFrameGroupBy,
func: Callable,
n_jobs: int = 10,
verbose: int = 10,
backend: str = "loky",
... |
89143af6428a5820859458ff6145fb39366746564c4c8b9c982419f60fe22e32 | Python | 4,971 | 160 | #%% Imports and file loading
from pathlib import Path
import pandas as pd
import networkx as nx
import numpy as np
from graspy.plot import gridplot
from src.data import load_networkx
data_path = Path(
"./maggot_models/data/raw/Maggot-Brain-Connectome/4-color-matrices_Brain"
)
data_date = "2019-09-18-v2"
graph_t... |
b22d528a74c41d85d219f6202a148cff377f0cecc1cf6fd1ae7241440399e0a8 | Python | 4,971 | 120 | """
A collection of models we'll use to attempt to classify videos.
"""
from keras.layers import Dense, Flatten, Dropout, ZeroPadding3D,Activation, SpatialDropout3D,TimeDistributed,GlobalAveragePooling1D,GlobalMaxPooling2D,Input,concatenate
from tensorflow.layers import batch_normalization
from keras.layers.normalizati... |
6272a35f4f9574a5c1417230282fb88cd3e99a509b1e143b95ae8c1ec6d01f34 | Python | 4,974 | 144 | #!/usr/bin/env python3
# Copyright 2017 Hossein Hadian
# Apache 2.0
""" This script finds a set of allowed lengths for a given OCR/HWR data dir.
The allowed lengths are spaced by a factor (like 10%) and are written
in an output file named "allowed_lengths.txt" in the output data dir. This
file is la... |
02b9b40bb79161ad4303003ce8240034e4cfcaf90e2133240992ed91c157b0b2 | Python | 4,975 | 168 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import Any, Dict, List, Optional, Union
from functools import wraps
import pandas as pd
class Reader:
def __call__(self, ... |
7d35c7306ff495fe8f4336d7c156cacbe3e6ed003a61514bb2ef3c4a0c34d873 | Python | 4,980 | 138 | #!/usr/bin/env python3
"""Draw a CARLA pedestrian navmesh in the server viewport, colour-coded by area.
UE4's navmesh view shows nothing for CARLA (see references/maps.md), so this
decodes Nav/<map>.bin and renders its polygons with world.debug.draw_line. The
file is parsed locally, so the server need not have it load... |
78a77173e88774bfae6341938230cef17cb2519e2637bce572a5ec5a9fa8f3bd | Python | 4,981 | 151 | import logging
import pickle
import sys
import warnings
from dataclasses import asdict
import chika
import numpy as np
import pandas as pd
from imblearn.metrics import geometric_mean_score
from sklearn.ensemble import ExtraTreesClassifier, RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from... |
4931195c3572ae3ef7581fd18db6361b4f07f61a28812321667301b414e76bb9 | Python | 4,984 | 142 | # Copyright (c) Open-MMLab. All rights reserved.
import cv2
import numpy as np
from mmcv.image import imread, imwrite
from .color import color_val
def imshow(img, win_name='', wait_time=0):
"""Show an image.
Args:
img (str or ndarray): The image to be displayed.
win_name (str): The window na... |
0899f481468d184d57ebe102ae0193099cf90bba73f893cc549f2c5800b03086 | Python | 4,988 | 114 | # 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... |
d399cef8a20a6e349abce1816accb0eccf86cb7f1942addc884f0c0a93009c5c | Python | 4,992 | 115 | import pandas as pd
import numpy as np
import functions_basic_sak as funsak
import import_AIS
from tqdm import tqdm
import os
import inspect
import pathlib
import re
import AIS_parameters
pd.set_option('display.max_columns', 20, 'display.width', 1500)
fname = os.path.split( inspect.getfile(inspect.curren... |
2baa936491af7ec9a7af4617cfb00592a5865ffdcdf7f93c4f3d2131cfa8620d | Python | 4,994 | 133 | import os
from os.path import join
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (mean_absolute_error, mean_squared_error,
... |
32b74c178b9e44e9189d116bbabf59ac0acf6f7d32beaeaa16e3457dbf168e85 | Python | 4,994 | 145 | """Poincare ball manifold."""
import torch
from manifolds.base import Manifold
from utils.math_utils import artanh, tanh
class PoincareBall(Manifold):
"""
PoicareBall Manifold class.
We use the following convention: x0^2 + x1^2 + ... + xd^2 < 1 / c
Note that 1/sqrt(c) is the Poincare ball radius.
... |
2e6f4b2b67302d2b6f487bba8ff51a6ea2669a2b3c924e290192d872add34056 | Python | 4,995 | 122 | # Merge FeatureCount count files (counts per sample) to matrix with rows genes, columns samples
# NOTE: Needs Python version 3.5+
import glob
import argparse
import gzip
import sys
parser = argparse.ArgumentParser(description='Merge multiple FeatureCount count files into a matrix. Uses featureCount_directory in which f... |
d45ebaabe4365d3c68f1b354af4b34c121d88476af96dfbdf03ea55cc732eb5d | Python | 4,995 | 164 | import os
import torch
import torchvision
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import torch.optim as optim
import torchvision.transforms as standard_transforms
import numpy a... |
fb6aed8f9434992f5072a33613b54990e1b07ab1aa8ef9a6860ed298d703b3ae | Python | 4,998 | 117 | # 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... |
d1e41be96fc0b37ea937752990ad8e4944f9655f519aa600e1f9fa829c1e2bf0 | Python | 4,999 | 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... |
b2e68f92ed13154e6159d93f7dd2cb8e15527667cee82d3ef6fca33bd5a4a236 | Python | 5,002 | 156 | from operator import index
import numpy as np
import csv, torch, os, pickle, math
from torch import nn
from torch.nn import functional as F
import torch.optim as optim
import torch.utils.data as Data
import pandas as pd
# from tqdm import tqdm
# from random import random, sample
# from model import Model
class T... |
f193b6f2109b82836a9d8330808ab3c3cde78cb900c6bd8064aef191761ad54e | Python | 5,002 | 121 | # 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... |
8c8ad562e91f08b35158d7b3c2ed3193161df8d033290ab13ecb1e74f3dc6df1 | Python | 5,004 | 129 | #!/usr/bin/env python3
"""
File: compare_inter_matrices.py
Created: 2020/04/06
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 Softwar... |
fa714b3a9f34587df1565043b3d8894bc2cd795a621d513286c807f9754d470f | Python | 5,005 | 151 | '''
Integrate with Euler method with noise
- starts from an initial condition
if not found raises an error
- If finds previous parts of trajectory
Prolongs existing trajectories until some total number of cycles ncycle_total.
- `phases_to_interval` is used -> after each cycles phases are mapped to [-2pi,2pi] ... |
2dde13451740c2e53e1124d66212381c841c7d7988cd9a1af27e107571695260 | Python | 5,006 | 215 | #import packages
import networkx as nx
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from pytorchtools import EarlyStopping
from scipy import spatial
from scipy.spatial import cKDTree
import scipy.sparse as sp
import time
import json
from networkx.readwrite... |
edd011295c21fed7edd6dcfc553386f729f02deaf4c2f4531f329706d4a1312b | Python | 5,012 | 155 | import pprint
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
import M2TR.utils.checkpoint as cu
import M2TR.utils.distributed as du
import M2TR.utils.logging as logging
from M2TR.utils.build_helper import (
build_dataloader,
build_dataset,
build_loss_fun,
build_model... |
56351102b2e897f2f75f00f63daee676077d52885e5b2888c3c4ebc97fe88e07 | Python | 5,014 | 142 | # -*- coding: utf-8 -*-
"""Preview
Code for 'Inf-Net: Automatic COVID-19 Lung Infection Segmentation from CT Scans'
submit to Transactions on Medical Imaging, 2020.
First Version: Created on 2020-05-13 (@author: Ge-Peng Ji)
"""
import os
from PIL import Image
import torch.utils.data as data
import torchvision.transf... |
eec7f0b93a269754c7c9b616adadd0dfa632fdd59ea3ca785fae558081d36b74 | Python | 5,016 | 155 | import ast
import json
import os
import numpy as np
import pandas as pd
import requests
import streamlit as st
def init_page():
st.set_page_config(layout="wide")
def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum(axis=0)
@st.cache_data
def mscoco_image_url(image_id):
data = {"image_... |
11faa4fa0a119007645d537a0c00de02935523eff857b1654d97a3cb3ce857ee | Python | 5,017 | 143 | import inspect
import torch.nn as nn
from mmcv.utils import is_tuple_of
from mmcv.utils.parrots_wrapper import SyncBatchNorm, _BatchNorm, _InstanceNorm
from .registry import NORM_LAYERS
NORM_LAYERS.register_module('BN', module=nn.BatchNorm2d)
NORM_LAYERS.register_module('BN1d', module=nn.BatchNorm1d)
NORM_LAYERS.reg... |
157ea7938ed231dc133bd43ed2918bcdb081302f6b71c9599fa997ee363661f2 | Python | 5,018 | 146 | """One test per finding of the new-user walkthrough of 1.0.1, fixed in 1.0.2."""
import contextlib
import io
import random
import numpy as np
import pandas as pd
import pytest
import pyoxynet
from pyoxynet import utilities
_cnn = []
def cnn():
if not _cnn:
_cnn.append(utilities.load_model('CNN'))
r... |
f4c2cab8c29c6642e9686621c26cacf8ab9e47c4fe71a136272e2e34b2cd25e1 | Python | 5,019 | 142 | #!/usr/bin/env python3
"""Ground-truth OpenDRIVE surface evaluator (lines+arcs, elevation, lateral shapes).
For a query xy point and a road id, finds the road-frame (s,t) and returns the
surface z with and without the lateralProfile/shape contribution. Used to check
whether crossing roads' surfaces reconcile once shap... |
bf6c1791f2fdea338823365abc33336f623b7ee59e755536bb6e500ef289872f | Python | 5,020 | 166 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 10 12:39:31 2021
@author: Fuyuki Asano
"""
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.colors import Normalize
from matplotli... |
41ede262ac88b85cb593bdb457984e7bf53d37f880643f2d6a32dcfcb3f26261 | Python | 5,021 | 175 | #! /usr/bin/python
# -*- coding: utf8 -*-
import argparse
import os
import re
import numpy as np
from sklearn.metrics import confusion_matrix, f1_score
from deepsleep.sleep_stage import W, N1, N2, N3, REM
def print_performance(cm):
tp = np.diagonal(cm).astype(np.float)
tpfp = np.sum(cm, ax... |
dabb294186968927893e101d725b02ece1580a321cff8fef61361f1507a77528 | Python | 5,022 | 154 | from omegaconf import DictConfig, OmegaConf
import logging
import torch
import pytorch_lightning as pl
from typing import Dict, Optional, List
import numpy as np
import pandas as pd
from pathlib import Path
from hydra.utils import instantiate
from collections import OrderedDict
from torch.utils.data import DataLoader
... |
29074cd71fe2947bee9854e16714657d343216d231145fa63ac0bccab99e6249 | Python | 5,023 | 196 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import scipy
import seaborn as sns
from joblib import Parallel, delayed
import pandas as pd
from graspy.match import GraphMatch
from graspy.plot import heatmap
from src.cluster import get_paired_inds... |
44df353ec310e45a0acd9f0f5412ffcb72d1d158be81ea09c10854601b0b788b | Python | 5,023 | 129 | import argparse
import os
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
from tensorflow import keras
from tensorflow.keras import layers
from tqdm import tqdm
from scripts.get_s2_data_ee import get_history, get_pixel_vectors
def normalize(x):
return (np.array(x) - 0) / (3000... |
7b0bf4005d722e653db16936806b2c43d744f9f50550cd1464859d6dd70c59b2 | Python | 5,023 | 143 | import SimpleITK as sitk
import numpy as np
import pandas as pd
import torch, os, random, imageio
from torch.cuda.amp import autocast
from tqdm import tqdm
import torch.nn.functional as F
def seed_torch(seed):
random.seed(seed)
os.environ["PYTHONHASHSEED"] = str(seed)
np.random.seed(seed)
torch.manual... |
69fe0942ba59e17b2577f094eee0b9a40c2d228f68b457027a6d93b623598601 | Python | 5,028 | 133 | """
File: create_variance_explained_plot.py
Created: 2020-07-08
Last Changed: 2020-07-08
Author(s): H.H.Wiersma
Code to create distribution plot and a mask image used in the research plan
Copyright (C) 2019 H.H.Wiersma
This program is free software: you can redistribute it and/or modify
it under the t... |
b45f43c002ed10ba246e5029a9aa35dc8b55f1b31b809829cc4ef024bfbaacee | Python | 5,029 | 119 | import math
import torch
import logging
import torch.nn.functional as F
from torch import nn
from ..retinanet.loss import make_retinanet_loss_evaluator
from ..retinanet.inference import make_retinanet_postprocessor
from ..anchor_generator import make_anchor_generator_retinanet
from maskrcnn_benchmark.utils.comm impor... |
20ba1664735fbfd7a04c183343766eb42849d899f642a58230851f9a0793f53a | Python | 5,030 | 136 | # -*- coding:utf-8 -*-
from tensorflow.keras.models import Model as KerasModel
from tensorflow.keras.layers import Input, Dense, Flatten, Conv2D, MaxPooling2D, BatchNormalization, Dropout, Reshape, Concatenate, LeakyReLU
from tensorflow.keras.optimizers import Adam
IMGWIDTH = 256
class Classifier:
def __init__()... |
27dbad05e3ee0c44cfb1780cf92d55b061ee06f4bbec3bfe7ed63102909e64a2 | Python | 5,031 | 137 | # 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... |
08db0304b1f154e741b7792b27d45801b21f5cbb4c00f5732c9cead17b91b316 | Python | 5,034 | 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... |
449afa7e9157a593bc4466b278b4d065c3c94eb8ed7865f80278008335299ba1 | Python | 5,035 | 91 | """Same frozen scene through every camera profile, and through weather presets.
python3 looks.py OUT --pose x,y,z,yaw[,pitch] --mode profiles|weather [--profile Cinematic]
"""
import argparse, os, queue, sys
import carla
sys.path.insert(0, os.path.dirname(__file__))
import scene
PROFILES = ["AutomotiveHDR", "Automotiv... |
577a6bba923d259901eff409485115bae4fa2b5527899fb06a5d12d7886200d4 | Python | 5,036 | 126 | """
===============================================================
How to add new bundles into pyAFQ (Acoustic Radiations Example)
===============================================================
pyAFQ is designed to be customizable and extensible. This example shows how you
can customize it to define a new bundle bas... |
39ab3b8dbc9ddfa611c46382c83543ca21266ecfaf163cd791e7e5e24a7176fe | Python | 5,037 | 150 | __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
from tmkit.chain.PDB import PDB as cpdb
from tmkit.visualize.component.Color import Color as libcolor
from tmkit.vis... |
2c9965bbd0f9d029b9676147967fda27d95b8a4b22882109d9e9d469634a2519 | Python | 5,043 | 127 | # 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... |
33b2bcd811456fe419877f4416f797d061724927ce1a451f156bfd859513f3e1 | Python | 5,046 | 141 | """
File: normal_transform_matrix.py
Created: 2020/10/27
Last Changed: 2020/10/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,... |
37319501bfbe51adc92e588ef252b7008c8e20c9b4b7606e82a66a2398545623 | Python | 5,046 | 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... |
8be019e5f7329ed06edd34d3203cf6e27aaf991915e924f24285e78d80baaad5 | Python | 5,047 | 130 | # -*- coding: utf-8 -*-
# Clase para la posicion y comparación V 1.0
# Autor: José Miguel Ramírez Sanz
# imports
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()
import pandas as pd
import pickle as pk
import numpy as np
import cv2
from matplotlib import pyplot as plt
import gc
from... |
38669483f41e2ad465b62d5a50f79a2de724a8a99fbc32471825464bae94223e | Python | 5,049 | 153 | import os
import sys
from types import ModuleType
from typing import Optional, Tuple
import numpy as np
from ..base import DatabaseBase, ALL, load_fids
########################################################################
class Database(DatabaseBase):
""""""
fids = load_fids(os.path.join(os.path.dirname(... |
052205fb17211bcd9a4c811a8939b3141a9310148cd9866fb149bb8aceb2152c | Python | 5,050 | 143 | import pandas as pd
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../scripts/PTFunctions"))
from report_reshape_upload import *
from PTQuery import *
logfile = snakemake.log[0]
logging.basicConfig(
filename=logfile,
filemode="w",
level=logging.DEBUG,
... |
3da38562d86ea5e47eb55d8b2cd09c4e3689fe90b0c663462d65921182baeaca | Python | 5,051 | 154 | import sys
import os
import shutil
from modeller import *
from modeller.automodel import *
seq = sys.argv[1]
ssd = sys.argv[2]
pdb = sys.argv[3]
name = sys.argv[4]
ali = sys.argv[5]
outdir = sys.argv[6]
# set working directory
dir = os.path.join(outdir, name + "_modeller")
if not os.path.exists(dir):... |
4c76d8e4efc656786607a95af3b807797bc3e18d1f0940b1b8c07fc1b01e77b5 | Python | 5,051 | 114 | import h5py
import nibabel as nib
from nilearn.image import resample_img
import os, sys
import re
import numpy as np
from scipy.ndimage import zoom
from tqdm import tqdm
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir) # PYTHON > 3.3 does not ... |
f4105b7dd297f47965d6b2f6da69b5019368b7ca2b680df671252d86560be22d | Python | 5,052 | 132 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import json
import argparse
import numpy as np
import torch
from src.loader import load_images, DataSampler
from src... |
5c6d7fe379d4c541661f272a5c74c4f8613f0cc429ff582ea344b9ecb95489b0 | Python | 5,054 | 141 | ###
# #%L
# Triangulated surface for deforming in 3D.
# %%
# Copyright (C) 2013 - 2023 University College London
# %%
# 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, incl... |
56bfdc19f6143e5fbb7b9aced61b3394cb5fda95593267490c53b8161c0d0251 | Python | 5,055 | 123 | import numpy as np
import sys
import time
import shutil
import subprocess
import os
import pyflann
from IPython.core.debugger import set_trace
from Bio.PDB import *
struct_dir = "/home/gainza/lpdi_fs/masif_paper/masif/data/masif_ppi_search_ub/data_preparation/01-benchmark_pdbs/"
benchmark_list_fn = "../benchmark_list.... |
71652372e3d85281a808f0efd14c22ec61ce398468937a97549750f16444dc9b | Python | 5,055 | 121 | # 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... |
eabeeb2a42fb3a5c55abb4aef7c14416761889fb5cb708226ba4005a169fd676 | Python | 5,055 | 140 | import os
import sys
import numpy as np
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from .uuuuuu import hsv2rgb, gamma_line, get_qhsv_from_czi_hsv, make_hist_data, read_qss_file
class BWSpin(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self)
# ... |
24d9770e05dfd1361de83b4d1173511ba9e315fda45a0823f1174a0adeb72ee3 | Python | 5,058 | 154 | import os, inspect, numbers
import numpy as np
from itertools import zip_longest
from scripting.spectrum.io.readers import readers
from scripting.spectrum.io.mixins.view_instance import ViewInstance
class EEG(ViewInstance):
"""A memory map object with data accessor returning numpy ndarrays.
Attrs:
... |
aef4c95aff61f128b6f1c4a244165757629a2821bbb099e85bc554a83ce69b60 | Python | 5,058 | 138 | """
File: create_cohort_matrix.py
Created: 2020/10/08
Last Changed: 2020/11/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, ei... |
37a1a40246fba257bd3f1b400a377405101bc0dca67c0af210ff3bfe51658af6 | Python | 5,059 | 139 | import sys
import os
from collections import OrderedDict
"""
Expected format for the input file:
#Id #Real value #Guessed value [...]
0 1 0 0.000000 0.000000 0.000000 0.000000 1.000000 1.000000 0.000042 0.000042
"""
ID_ROW=0
REAL_ROW=1
GUESS_ROW=2
def main(path):
file_name = path.split('/')[-1].split('.')[0]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.