sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
98a5a00f178636866b2e59a905a994f76c7a0015ad1d2101009ffbfa75c77f94
Python
10,804
216
# This code contains minor adjustments to the original code that is available on https://github.com/mircare/Porter5/blob/master/Porter5.py import argparse, configparser import os, sys import time ## check Python version if sys.version_info[0] < 3: print("Python2 detected, please use Python3.") exit() ### se...
085743df2746758a7ac0682279dc8906a5f0ab2fa695d138f152aae40f17d2ca
Python
10,806
252
# 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...
6d652569182a6fbe35d73477ada0898d9046a8adbd395adf15a3d26c004d93b2
Python
10,808
283
#!/usr/bin/env python3 """ File: plot_pca.py Created: 2021/06/30 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, e...
d23c230084625833f50cf4ec3f7fe03f208a7ee4d370fa368f8fcb1689554db8
Python
10,808
177
''' behavioral classification for hourly time resampling I know these loitering distances (5 km) may not be the best - will change in future versions! successive loitering 5E+03 m: successive mean waypoints are within 5E3m and within the hour window the excursion (from the mean lat/lon) is also less than 5E3m p...
6216ac886935a32ef2012c12b2588c3cab101daa2b3c61b2b1057ba903494cc3
Python
10,821
340
"""pytest tests/test_forward.py.""" import copy from os.path import dirname, exists, join import numpy as np import pytest import torch def _get_config_directory(): """Find the predefined detector config directory.""" try: # Assume we are running in the source mmdetection repo repo_dpath = di...
49fc11e9b51a7174f93cf1c95eac69e39d16845cc23c90674b4d580178c394da
Python
10,826
287
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...
bb1f1b24647be0038ac37d72d02545688d4e6b66818561ac6e102e0fe60285a1
Python
10,827
290
import os import sys import torch import argparse import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as datasets import cv2 import numpy as np import PIL from PIL import Image import time import logging import argparse from detnasnet import ShuffleNetV2DetNAS from utils import...
f888382603e7d454bf10990dd7e43d63b450a606b5cb2c326873fbcb8805db64
Python
10,827
282
""" Unit testing second order matrix vector product. """ from __future__ import (division, print_function, unicode_literals) import numpy as np import tensorflow as tf from tensorflow_forward_ad import logger from tensorflow_forward_ad.fwgrad import forward_gradients from tensorflow_forward_ad.second_order import ( ...
58ea3ea36ca6927b83baaaac0644315bd5abbb07cf30bc68e500f2586fce9ae8
Python
10,830
300
# import cProfile import os import time from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, as_completed import numpy as np import pandas as pd import pyBigWig TARGET_LENGTH = 1 SAMPLE_FILES = True N_PROCESSES = 23 N_THREADS = 16 N_CONCURRENT = 30000 DATA_FOLDER = ( "/mnt/datasets/DeepCT/datas...
d9e94d73bf205a20f6ba254838f561c8483527af5e9a9fdb45c7ea86a6a87bbc
Python
10,832
319
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2017 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 o...
69cb24a70dd41b41f071aa9110ce1033639f0af71a26deda9ba5f4081087db38
Python
10,835
294
#%% import sys sys.path.append('/Users/mwinding/repos/maggot_models') 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 src.data import load_metagraph from src.visualization import CLASS_COLOR_DICT, adjp...
75d48577ee902e60949e10c7c6ae8c676826eb061d4fef8e17643ce4b37fc34b
Python
10,835
365
#%% Imports and file loading from pathlib import Path import glob import json from os import listdir from operator import itemgetter import pandas as pd import networkx as nx import numpy as np from graspy.plot import gridplot from src.data import load_networkx # File locations base_path = Path("./maggot_models/data/...
b58f2d06e96c4d82fbe4873e47509686ac699cc24863a0e99755506dfd95adbf
Python
10,843
278
# 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 numpy as np import torch from torch.autograd import Variable from torch.nn import functional as F from logging...
ddd975a54d317aad2c6c54bff93ef9d049d9ddd409be28a20718083e1fb1b088
Python
10,843
218
import os import numpy as np import pandas as pd import scipy.stats as stats import matplotlib.pyplot as plt from lmfit import Model from lmfit.models import LinearModel def rss_fit(mod_y, data_y): return np.sum(np.square(mod_y - data_y)) def chow_test(data_y1, data_y2, data_c, bestfit1, bestfit2, bestfit_c): ...
7116a541fd381077082a322a932e8844fbec3ac59410cfb6e76d2690223975ac
Python
10,847
268
####### # This code was written by Nino Verwei and Niek van Hilten at Leiden University, The Netherlands (23 August 2022) # A convolutional neural network (CNN) is trained on MD data (data.txt) of helical peptide sequences with respective relative free energy values as a measure for lipid packing defect sensing # Th...
5fec9828c79b6675afc7285680e602419c944b258a43a35176f746bf5279452e
Python
10,848
275
""" File: main.py Created: 2020/10/08 Last Changed: 2021/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, either version 3 ...
a8f9bf225aa27ece4ab188a3e646cecbf298d3b8ab5ee42240e678fa6005c8ad
Python
10,850
278
#!/usr/bin/env python3 """ File: compare_pvalues.py Created: 2022/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 Software Founda...
768ce55b7eb87a188606a523615702b47e5c6549540f8e5b847652e9e16ebeda
Python
10,852
252
import logging import sys import torch from mmdet.core import (bbox2roi, bbox_mapping, merge_aug_bboxes, merge_aug_masks, multiclass_nms) logger = logging.getLogger(__name__) if sys.version_info >= (3, 7): from mmdet.utils.contextmanagers import completed class BBoxTestMixin(object): ...
e7eb5af176f2f461a9e2d4a3be8243f9f23cf83a68c57c61dd9c4cfed026f53a
Python
10,854
388
""" Utility functions for scHumanNet analysis. This module contains helper functions for loading data, network operations, and other utilities. """ import numpy as np import pandas as pd import networkx as nx from typing import Dict, List, Optional, Tuple, Union import pickle import os def load_humannet_v3(data_pat...
fff2acbf5aac6460b88cba4df4f884bad357dbc81157dc6e217696a6f4b1eae7
Python
10,858
252
#!/usr/bin/python #################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # Thi...
69986072c1fece27b5b03cc68f722d07af4d86188886e414dce42a83e59da4f7
Python
10,860
274
import tensorflow as tf import numpy as np import h5py class PatchHandler3D(): # constructor def __init__(self, data_dir, patch_size, res_increase, batch_size, mask_threshold=0.6): self.patch_size = patch_size self.res_increase = res_increase self.batch_size = batch_size self.ma...
d22cc412ed80be56fbf028798330c951bfc09a2dc44ca8cc16e16c49a0c4b648
Python
10,860
298
import tempfile import torch import torch.nn as nn from torch import optim from torch.nn.init import kaiming_normal_ from tqdm.auto import tqdm from drugex import DEFAULT_DEVICE, DEFAULT_GPUS from drugex.data.fragments import SequenceFragmentEncoder, FragmentCorpusEncoder from drugex.data.datasets import SmilesFragD...
9fb1bc7572fee43b1459b9d8bd4f417afc06a7acf638ad3a62b498a8522a5fcc
Python
10,863
310
## System import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # no debugging from TF os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3' import time import copy ## sklearn from sklearn.decomposition import PCA from sklearn.manifold import TSNE ## Maths import math import numpy as np import pandas as pd impo...
126fc4d930c8adfc5ea6c96df4c4a6575377e56acb34cbac42b86cc45f28252a
Python
10,864
199
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'picachooserTemplate.ui' # # Created by: PyQt5 UI code generator 5.15.7 # # 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 ...
65177ce9b2d96fdc1aa08c75f0f1710a58e65a8b9cdf95c61be29a830ab81ddd
Python
10,864
277
# 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...
f5c9b7982f2ea9fc33b86c53e4237d4224327d9264f8b7752efd966e9f63f5e8
Python
10,864
258
import pandas as pd import boto3 from shapely.geometry import shape, Point, MultiLineString, LineString import json EU_COUNTRIES = ["Austria", "Belgium", "Bulgaria", "Croatia", "Cyprus", "Czech Republic", "Denmark", "Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Ireland", "Italy...
860bd0362cac08c15a861dcb50985b358d7e742b3ec9b94b057519390092c03a
Python
10,872
375
# %% [markdown] # ## 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 pymaid import seaborn as sns from src.graph import MetaGraph from src.io import savecsv, savefig from src.pymaid import start_instance from src.vi...
92a00307f4b679cf48094c8e43c0b822300277d8eb68cc6bf3c0f8bb63ff072f
Python
10,882
244
""" Copyright Dejan Kostyszyn 2019 This method trains the network. """ import ReadData as rd import numpy as np from matplotlib import colors import torch, os, nrrd, time from model.UNet import UNet import matplotlib.pyplot as plt from options.train_options import TrainOptions import utils, csv, sys from os.path impo...
76c79f165519d27f9ef58e304aa2a07103112127e7a5791bc099f225bdf682c7
Python
10,886
281
import torch import torch.nn as nn from .resnet_updated import conv3x3 from .resnet_updated import resnetbank50all as resnetbank50 from .globalNet import globalNet import math class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, upsample=None, norm_layer=None): ...
bcec95021243068be456e1bc4c74cd3d5e13c613b6381f7d4eb8216e475c5642
Python
10,886
258
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.analysis import characterize_...
8d754d67271db2a2b53dd63f3def9cae87585bfce6672028d7eb2a2d567b3a6e
Python
10,890
324
#!/usr/bin/env python3 """ Phys2bids is a python3 library meant to set physiological files in BIDS standard. It was born for Acqknowledge files (BIOPAC), and at the moment it supports ``.acq`` files and ``.txt`` files obtained by labchart (ADInstruments). It requires python 3.6 or above, as well as the modules: - `n...
926265f9ea940a26c3627b59170d05bfdab594a933550a453f5f25fe5666ae1d
Python
10,895
272
# 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...
33d25ffe1d81dd46a98b52468fb6d340b1540d162c1bc802873dab43c46547e4
Python
10,896
224
import streamlit as st import pandas as pad import numpy as np from joblib import dump, load from PIL import Image import sklearn import tensorflow as tf from tensorflow import keras import time ## TO DO ####### ## PCA and TSNE representation ## def main(): """ fonction principale de prédiction d...
aed835b95eeaa77f97469ec510aa187ba8752424978e0f5c014f504faf0bcbc3
Python
10,897
294
#!/usr/bin/env python3 """ File: plot_cell_fraction_vs_IHC.py Created: 2022/01/25 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 Softw...
54355dd7347c8f820f3b8355fa8f3898f3867f0db5cb6892eab33b0c39f6355d
Python
10,898
246
import os import errno import shutil import numpy as np from scipy.interpolate import griddata, Rbf, LinearNDInterpolator, NearestNDInterpolator from skimage.measure import regionprops from ddmr.layers.b_splines import interpolate_spline from ddmr.utils.thin_plate_splines import ThinPlateSplines from tensorflow import ...
3248a141b038c3db771c2bea32cfea27e34341a370d50bc8d08f372221d8e3f7
Python
10,903
355
#%% [markdown] ## Maggot embedding alignment # > Investigating alignments of the maggot data embeddings # # - toc: false # - badges: false # - categories: [pedigo, graspologic, maggot] # - hide: false # - search_exclude: false # %% # collapse import os import time import matplotlib.pyplot as plt import numpy as np imp...
e43d53c080fb41492f940efa5b007118c8ec24ad93d98cd57fb8113dfe54a3ab
Python
10,906
265
"""Base class and socket server for workers. Subclass :class:`Worker`, implement :meth:`Worker.load`, :meth:`Worker.run` and optionally :meth:`Worker.smoke`, then call :func:`serve` from the worker's ``__main__``. ``run`` executes in a thread so a blocking inference loop does not stall the socket; it must poll ``ctx....
eb713934ad8b7fb801699ffbcdb38d7ac6d35ee3fdd9144651b298ff7c6eedc0
Python
10,914
397
# %% [markdown] # # import os from itertools import chain import colorcet as cc import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import seaborn as sns from graspy.cluster import AutoGMMCluster from graspy.utils import pass_to_ranks from src.data import load_metagraph from s...
4f213064f02c8a34ab4db241fb7fc9d850331f084a9f01d449e2f22de4a284ce
Python
10,918
257
import shutil from unittest import TestCase import os from os.path import exists import pandas as pd import numpy as np import torch from torch.utils.data import DataLoader, TensorDataset from drugex.environment.neural_network import STFullyConnected from drugex.environment.data import QSARDataset from drugex.enviro...
2c9af974bb62f0d6828c44dc1d37d4f62af6b0552e54f129387d69d87d010ee9
Python
10,919
295
#!/usr/bin/env python3 # # 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 u...
0f9f9333b2530bf317190f5c6b467d2cd1b994b41f9a607d15ab8e673549cc80
Python
10,924
306
import torch import torch.nn.functional as F from torch import nn, cuda from torch.autograd import Variable from torch.nn.modules.batchnorm import _BatchNorm from torch.nn.parameter import Parameter class Conv(nn.Module): def __init__(self, in_ch, out_ch, K=3, S=1, P=1, D=1, activation=nn.ReLU(inplace=True)): ...
ed19b7e3e803b2dd72de215baa00eb0c891bac7c8c1757ab118f61debb076cd2
Python
10,924
444
# %% [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 graspy.match import GraphMatch from graspy.plot import heatmap from graspy.simulations import sbm from src.data import load_metagraph from src.graph import pre...
a1b5341a0db3d203b6d4857c213f8cd08b1b4281c793b8a45b427c6a9f16a73c
Python
10,931
256
# 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...
9e0d26bd5bfa7665b4ee80e675d44fd70ef04bce6303132c03d49fd9ee1bd505
Python
10,942
175
#!/usr/bin/env python3 """ File: check_preprocessing_step.py Created: 2021/07/08 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 Softwa...
a3c080b9ba37c3574e22d0b43f6331baa04800a9918d8eb4654265c608f0b61f
Python
10,942
270
import csv import os import sys from sklearn.cluster import KMeans import numpy as np # Court to circuit mapping, which maps from SCDB codebook to the actual Circuit number # http://scdb.wustl.edu/documentation.php?var=caseOrigin # http://scdb.wustl.edu/documentation.php?var=caseSource court_circuit_map = {1: 13, ...
648f52e496292d87e7e4d20a35aeb03de37bde4b8446086d2c2507242173dced
Python
10,946
327
"""Cancellable implementation of the released RootDetector matcher. The released tracking package owns descriptor extraction, while this module owns the deterministic point-matching loop. Version 1 intentionally preserves the released 2022 algorithm and constants, adding only progress and cancellation checkpoints. """...
05e051ff515e51cfd28f6811e195ee4a32cfd17213e770d8e647244c0b6b4512
Python
10,947
311
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import math import numpy as np import torch from torch import nn from maskrcnn_benchmark.structures.bounding_box import BoxList class BufferList(nn.Module): """ Similar to nn.ParameterList, but for buffers """ def __init__(self...
e54e6af18a681ea42f9cb8491822b7eb1ff07ce896fe4d731c039f9142fd4406
Python
10,947
294
#!/usr/bin/env python # Copyright (C) 2011 Genome Research Limited -- See full notice at end # of module. # Smith-Waterman aligner with fixed gap penalty. NOTE: This is not # going to be fast! It's intended for small jobs like finding # adapters. We need a C version for the heavy lifting. # To use, create the aligne...
37419b3fb9dadd61aea8d922aaf9cf8e8dcf6992453cb32c3933eb0eb12d3a24
Python
10,953
240
# 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 agre...
75823ea2572237a14d5dbe096ead51c4725e77de70fca214566e469326092877
Python
10,956
290
import os, shutil import unittest import numpy as np import numpy.testing as nptest import FBEM import mesh import mesh.shapes as shapes from angle_area import is_angle_satisfied, is_area_satisfied basic_test_folder = 'data/triangulation/test/' basic_expected_folder = 'data/triangulation/expected/' rtol = 10 ** - 8 a...
faa158859709f84f18e0df494c18ed52a387f39159de5194374ac8244b3e54d6
Python
10,962
312
## System import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # no debugging from TF os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3' import time import copy ## sklearn from sklearn.decomposition import PCA from sklearn.manifold import TSNE ## Maths import math import numpy as np import pandas as pd impo...
adae71300c160a7a0369b4c1540cf6faa2fe379331294e25cee08d7846adf499
Python
10,964
305
from abc import ABCMeta import torch import torch.nn as nn from ..utils import constant_init, normal_init from .conv_module import ConvModule from .registry import PLUGIN_LAYERS class _NonLocalNd(nn.Module, metaclass=ABCMeta): """Basic Non-local module. This module is proposed in "Non-local Neural Netw...
2f973dede6d2fb56648ac42a363a5a7df5690629583a1e8785858ad9e324bcb5
Python
10,966
286
"""Patient/case-level train / validation / test splitting for CROPro. Splitting is always done at the **patient** level (one unit = one patient) so that all crops from the same patient end up in the same subset. This prevents data leakage between training, validation, and test sets. ``split_level`` (on :class:`Split...
8f323682451029a1240d3bd7ab4f91739dc21b5674031ef39a03aa1b63548230
Python
10,967
265
import torch import torch.nn.functional as F from mmdet.core import bbox_overlaps from ..builder import HEADS from .retina_head import RetinaHead @HEADS.register_module() class FreeAnchorRetinaHead(RetinaHead): """FreeAnchor RetinaHead used in https://arxiv.org/abs/1909.02466. Args: num_classes (int...
7f6f8cf9775d43fe63bc1490e3c7e7bda7da233eea5af9319f3cdbb6387bacf7
Python
10,969
289
""" Visualzie using `vedo` (a.k.a. `vtkplotter`) package - I don't define my own MeshViewer class, because vedo.Mesh class is already very functional # In jupyter: # vedo.embedWindow(False) #embedWindow('2d') # for a static image """ import vedo import FBEM import numpy as np def get_colors(num, cmap, endpoint=Tru...
03276ff0f6f200317d713e1cc77e1fb65a2b0f1e0a8648c0017fa18daa19f0f9
Python
10,986
325
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 8 16:13:47 2021 @author: Hiroshi Yokoyama """ fdir = __file__ from IPython import get_ipython from copy import deepcopy, copy get_ipython().magic('reset -sf') #get_ipython().magic('cls') import os current_path = os.path.dirname(__file__) os.chdi...
91d9e7b9c37db9e31be467373171a79ff888aa815a1f3dbf170717ce423a9084
Python
10,989
280
from __future__ import print_function import numpy as np import os import matplotlib.pyplot as plt import torch def compute_overlap(a, b): """ Parameters ---------- a: (N, 4) ndarray of float b: (K, 4) ndarray of float Returns ------- overlaps: (N, K) ndarray of overlap between boxes...
b83aaf22e45aa4c48d0df680bb5a15430600ca065249ff33f9ef3d826462a662
Python
10,991
262
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
1cbfef645239e2de5cc77fab5b4cac13d417e535d34b1133660a8e602ed93357
Python
10,994
266
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import xavier_init from mmdet.core import (build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, multi_apply) from ..builder import HEADS from ..losses import smooth_l1_loss from .anchor_head imp...
49503d90e733fedd8f3211371d09b1e70e442e580b76138d465fe867f894ecc3
Python
11,002
248
import math import time import unittest import numpy as np from oaklib import get_adapter from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.interfaces.embedding_provider_interface import ( CLOSURE_IC_MODEL, CLOSURE_MODEL, EmbeddingProviderInterface, ) from oaklib.utilities.embeddings.clos...
b017bdf63e9d78d1ce6935901c33f26e7bd93441601eb217831a8712ccb391fa
Python
11,010
204
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') except: pass from pymaid_creds import url, na...
75b24919a01cd5dc8e0ae23dcde7392727cf4225653f93542fd56b058ecd98a9
Python
11,015
287
import ee import geemap from multiprocessing.dummy import Pool as ThreadPool from tqdm import tqdm from datetime import datetime from functools import partial import json import os import numpy as np import pandas as pd ee.Initialize() # Sentinel 2 band descriptions band_descriptions = { 'B1': 'Aerosols, 442nm', ...
1b90fcca7cacdbf465bfcecaa11e41ddac48c79728ffedf06df4369e304de8cf
Python
11,024
189
import os, sys import shutil import h5py import matplotlib.pyplot as plt 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 tensorflow as tf # tf.enable_eager_execution(config=config) ...
4807f917894519f6bc473447686b7acceb3f78c1e78ffe71dd49a89ffa2bf5f9
Python
11,025
284
import pytest from typing import List, Tuple, Union, Optional from simphox.typing import Shape, Size, Size2, Size3 from simphox.utils import TEST_ZERO, TEST_ONE, Box from simphox.grid import Grid, YeeGrid import numpy as np @pytest.mark.parametrize( "size, spacing, eps, expected_cell_sizes", [ ((2.5...
b18b7073fb2175dd91e6aee8285c74bc14654884f07b8452dcc4410db96d4287
Python
11,027
222
# 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...
5d1bf005d9679faf7c3efe5e269d7b92682bf2ab8f5a911f5c92ddaff3f29e9b
Python
11,030
301
"""Contains the SensorServiceDriver class definition. SensorServiceDriver is an abstract class used by the SensorServiceItemModel to interact with different classes of sensing devices. Typical usage example: class MyCustomDriver(SensorServiceDriver): ... """ import enum from typing import Any...
5a707c5e556b8eea013c4051ada7b1902fdcb49c48b7515c8f1f88abb96084bb
Python
11,034
212
# 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 # change directory cwd = os.getcwd() # shall the system provide v...
d1bca822d8380595f3e966a0cbf6e40f36bfe0bd90b9e2e26d97380b7b2c804d
Python
11,039
280
#################################################################################################### # Copyright (c) 2019 - 2023, 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 ...
b1933a21c4d0d38b5be1b994848d34df1f6a8a3b8804738975e1dd2aea8b4a2a
Python
11,045
380
# Import Python SINGLE implementation from OLM import OLM_Single # Import hoc interpreter (for SINGLE and FULL) from neuron import h import numpy as np # Import FULL model recording functions from multicompartment.record import record_V_cai_ica_dend,\ record_V_and_Cai, record_soma # Import SINGLE model recording fu...
1ece593dcacacb6d5336cf912fb23b1ab7ec9d9ee30cdd39948bcfacff4871ec
Python
11,079
291
import random import tqdm from torch import nn import torch import torch.optim as optim import copy import numpy as np import rulenn.feature_config as fc from base import BaseModel import math import os import json class RuleNet(nn.Module): def __init__( self, num_variables, num_conjunctions, names, conf...
c51c278d04fbb6223a5607cd84e224d395cc0436e0948196ce98daf589ea366d
Python
11,080
303
import functools from collections import OrderedDict, abc from inspect import getfullargspec import numpy as np import torch import torch.distributed as dist import torch.nn as nn from torch._utils import (_flatten_dense_tensors, _take_tensors, _unflatten_dense_tensors) def cast_tensor_type...
4ff999b7a2398529c1fecf614544392d77a7dfd02639dd8efc64cb634f0e78b7
Python
11,081
402
#!/usr/bin/env python """ quot/read.py -- image file readers """ # ndarrays import numpy as np # File paths import os # Read config files in TOML format import toml # Underlying file readers for each file format def read_config(path): """ Read a config file. args path : str returns...
9e9ca0f3c8586d6fcf3fe918550e8a46b13cfd3224c17da88f95da48d1503948
Python
11,081
261
import torch from mmcv.ops import nms_match from ..builder import BBOX_SAMPLERS from ..transforms import bbox2roi from .base_sampler import BaseSampler from .sampling_result import SamplingResult @BBOX_SAMPLERS.register_module() class ScoreHLRSampler(BaseSampler): r"""Importance-based Sample Reweighting (ISR_N),...
db8fbf6426dc2b9cbf00d6dbc3420657782434b752b40c1dde2b25a57ab81e11
Python
11,083
342
__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, List, Union import numpy as np import pandas as pd from sklearn import metrics from tmkit.contact.Reader import Re...
41f38abb8f66da6ab6ad90b72fcd68a346fe656e06a5b49194aa751a1f51af8a
Python
11,085
334
#!/usr/bin/env python #title :Utils_model.py #description :Have functions to get optimizer and loss #author :Deepak Birla #date :2018/10/30 #usage :imported in other files #python_version :3.5.4 #Modified by Zifei Liang. 2022/06/06 from keras.layers import Lambda import ten...
96653c2d7864a30c5752dc0dc455fa1d2ce206d7c846dd8bd1c7313852e38db0
Python
11,086
253
# This file is part of me-features-to-mol-ID-mapping. # # # Copyright © 2021-2022 Blue Brain Project/EPFL # # # This program is free software: you can redistribute it and/or modify # it under the terms of the APACHE-2 License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANT...
5e1bbaed9c5c79b9607a59d5e5d08cc152891eda08b795a7c71e1564e4d3d4e0
Python
11,090
298
# 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...
bcf42d1b064096ae0178c4dd2f59dfbb73ac112ad203693373a46118e849ed31
Python
11,094
315
# -*- coding: utf-8 -*- """ Created on Tue Nov 7 15:10:06 2023 @author: H.Yokoyama """ fdir = __file__ from IPython import get_ipython from copy import deepcopy, copy get_ipython().magic('reset -sf') #get_ipython().magic('cls') import os current_path = os.path.dirname(__file__) os.chdir(current_path) current_p...
a2a20ae102fdb30216593ab18462ecea4345c12ec01d4dce84b3d0e7c64f5e95
Python
11,097
289
#!/usr/bin/env python3 """ File: dim_reduction_plot_visualise.py Created: 2020/12/04 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 S...
70cea4c5dbd0a96fd77e846fd58149dd7f73eb9895cfbc405ec82e4cafe4b939
Python
11,100
280
""" Plot main sound localization figures For each subject, show: - Bilateral cooling results as: - Bubble plots of response counts (normalized for total trial count) for each stimulus and response location, for control and bilateral cooling - Bar charts of performance (% correct) during contr...
44da20d469fb7a7f14bcb20f5ddf8ef19452bbc557900d05c7a218df797e2522
Python
11,102
305
#!/usr/bin/env python # coding: utf-8 import math import numpy as np from scipy import stats from scipy.stats import zscore, pearsonr, mannwhitneyu from random import sample import matplotlib.pyplot as plt from common_functions import * from plotting_functions import * filename = input("Enter file name containing th...
090392406c4bb82d6de1fb372fd05a7c2c7a1f263f22c03cf2504dfd7e9ae86b
Python
11,103
285
#!/usr/bin/env python3 # # 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 u...
a778b71ee4b23ea1596b5b9a53da2f25c6252453b360ec984741a39ea33fd10c
Python
11,103
246
import torch from torch import nn import math from torch.nn.init import xavier_uniform_, zeros_ class AttentionKernelIntegral(torch.nn.Module): """Kernel integral transform with attention Computes \\int_{Omega} k(x, y) * f(y) dy, where: K(x, y) = \\sum_{c=1}^d q_c(x) * k_c(y), q(x) = [q_1(x...
61ee85b4b6a280191b43e94bd3f6c219972f71482bbecc4e16afd08fd93426c4
Python
11,109
283
import numpy as np import time import os import matplotlib import argparse import csv import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.backends.cudnn as cudnn import nibabel as nib import matplotlib.pyplot as plt from skimage.metrics import structural_similari...
110b1d82799bbbe047178cb2f04ca134ff8d89f7d657053ab8d9466381b44f9f
Python
11,110
265
# 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...
a2e040bbb900e229fd7faeb5e2e150ea03eec96070274197fafdf722b0141417
Python
11,114
289
""" Lexical Utilities ----------------- Various utilities for working with lexical aspects of ontologies plus mappings """ import logging import re from collections import defaultdict from typing import List, Dict, Optional, Tuple from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.loaders import yaml...
2d6b6e765cb3902d381418caacf4b88940b2238f489c177272ee3c5a1f979414
Python
11,118
265
import logging from dataclasses import dataclass from typing import Dict, Iterable, Iterator, List, Optional from oaklib import BasicOntologyInterface from oaklib.datamodels.obograph import LogicalDefinitionAxiom from oaklib.datamodels.ontology_metadata import OMOSCHEMA, DefinitionConstraintComponent from oaklib.datam...
d8785edc165529d902e3dddc92758fbeb3a7ce913f7ec8361cdf108a1e3e6a43
Python
11,118
254
#! /usr/bin/env python3 """Build the comparison videos for a :mod:`showcase` run. Reads ``<results>/showcase.json`` (written by ``demos/showcase.py``) and, for every row that finished, produces * ``sheet_<row>.mp4`` — ``input | control(s) | output`` side by side, one tile per stream, each tile labelled; * ``grid_<r...
d039e26f29f3cf0202f4a5df5f22adb743a516059be69d3f9fd32b6c68dd6fb7
Python
11,119
363
############################################################################### # Author: Bernard Hernandez # Filename: # Date: # Description: # ############################################################################### # Import scikits preprocessing from sklearn.preprocessing import MinMaxScaler from sklearn.pr...
a1d815d06488875a760c2486f8fbaf56c9eae276e657876b4b83024d0f1b2e2f
Python
11,124
291
# 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 tests for the Traffic Manager control loop: pull-away and cornering comfort (synchronous, f...
68c112f8a6c8a97e15e71514bb69f8c093488c3b11ed859528e5d38c1d4acda6
Python
11,125
308
""" Written by Nathan Neeteson Segment images using a trained U-Net and optionally, compare to reference segmentations. """ import numpy as np import torch from torchvision.transforms import Compose from torch.utils.data import DataLoader from models.UNet import UNet from dataset.SamplePadder import SamplePadder from...
a64a33eca4610173f9d95b621440efa6db9c4f0064b615d7ec0bacda0a632a69
Python
11,125
287
from argparse import ArgumentParser import descarteslabs as dl import json import numpy as np import os from tqdm import tqdm def deploy_tpa_nn(dlkey, product_id, model_name): from datetime import datetime from dateutil.relativedelta import relativedelta import descarteslabs as dl import numpy as np ...
b66a53c395538d4e6c1a69e3c958671e28c87e81aaf40364f94f2991c731ab99
Python
11,125
349
# -*- coding: utf-8 -*- # # palmari documentation build configuration file, created by # sphinx-quickstart on Thu Oct 1 00:43:18 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
326ef4585bf459be07f593d41acff237622e769cf1a373d9bed4f69653d37dc0
Python
11,127
293
#!/usr/bin/env python3 """Export live CARLA traffic-light states keyed by Lanelet2 relation ID. This process is deliberately a non-ticking CARLA client. It matches each live traffic-light actor to the generated map's regulatory element by stop-line center, then atomically writes a small JSON snapshot for the ROS-side ...
d64ef3591ad89c5abf2976603ca37f4cf1299dbef724ed268d7069baf1c68bee
Python
11,127
300
import random import numpy as np import networkx as nx from functools import partial from typing import Optional, Callable, Union from .shapes import house from graphxai.utils import khop_subgraph_nx import matplotlib.pyplot as plt from graphxai.gnn_models.node_classification.testing import * def incr_on_unique_house...
a6e711c41e1c0b007fab5c915795da63f43e3b57c48bbc2d63cccfee7096f499
Python
11,128
290
#!/usr/bin/env python3 """ File: create_decon_upsetplot.py Created: 2020/11/24 Last Changed: 2022/02/10 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 Fr...
3157aaa3fb1d39fcbbee05ee357c9aa89a7ea92b079adb360ea7d7bb2ada6107
Python
11,131
251
""" File: deconvolution_covariate_comparison.py Created: 2020/04/15 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 ...
ba0122362b70a44decab014169c35280af2f7b8c19d3659195476c38e928210e
Python
11,131
270
# 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...
4b3d6fb0433c97e4eda0833a9f5dda92e024e89e96377a5e159b6f81d25b82a7
Python
11,136
334
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ For creating simple keras model that takes in a "large" image and produces a mask from that image. Saves the result as the original image + mask . Input -> (t, c, z, y, x) Output -> (t, c + 1, z, y, x) with 3 labels mask->not-mask->not-...
82420c958c00397e2de5ad2f616b33aaf7a25e8af3748f38daf37ab7a614950b
Python
11,140
247
# 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...