sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b77272e5cde3e18072ebecc3b35fd5a9bb17502b4ce54d11d1af10e6738ee69f
Python
3,712
91
import torch.nn as nn from .shuffle_blocks import ConvBNReLU, ShuffleNetV2BlockSearched, blocks_key, FC class ShuffleNetV2DetNAS(nn.Module): def __init__(self, model_size='DETNAS-300M'): super(ShuffleNetV2DetNAS, self).__init__() print('Model size is {}.'.format(model_size)) n_class = 100...
b82ff373e74b2966ba15a5b23902bc9c5f4fe2a676c918894349b9918560d44e
Python
3,714
122
import os import types # internal imports from slideflow.clam.utils.file_utils import save_pkl from slideflow.clam.utils import * from slideflow.clam.datasets.dataset_generic import Generic_MIL_Dataset from slideflow.clam.utils.core_utils import train from slideflow.clam.utils.eval_utils import * # pytorch imports im...
e03f4354bd5a65716f09b33cba314613072d204e82a30c3d9db415ceffb4a979
Python
3,715
85
# Copyright (c) Open-MMLab. All rights reserved. from collections.abc import Mapping, Sequence import torch import torch.nn.functional as F from torch.utils.data.dataloader import default_collate from .data_container import DataContainer def collate(batch, samples_per_gpu=1): """Puts each data field into a tens...
fcea61cfc6583d39a4fe9265a92403f5e690d73cfbc581a36ee360e21dd23274
Python
3,716
129
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from .bounding_box import BoxList from maskrcnn_benchmark.layers import nms as _box_nms def boxlist_nms(boxlist, nms_thresh, max_proposals=-1, score_field="scores"): """ Performs non-maximum suppression on a boxlist, with s...
130d6ad049fd26e13c8d9dbe6b555302223598c3d5f6c7d90bfe7a458d01bf1a
Python
3,717
129
import logging from typing import List, Optional, Union from pydantic import BaseModel from oaklib import BasicOntologyInterface from oaklib.datamodels.vocabulary import HAS_PART, PART_OF from oaklib.interfaces import OboGraphInterface from oaklib.query import Query, ancestor_of, descendant_of, subclass_of from oakli...
0d28ef4d2c79dc6f304d7ef458a9b2a82b24ba251329941fce99969ebf09b10a
Python
3,719
116
from __future__ import division from builtins import object # Unit tests for sima/spikes.py # Tests follow conventions for NumPy/SciPy available at # https://github.com/numpy/numpy/blob/master/doc/TESTS.rst.txt # use assert_() and related functions over the built in assert to ensure tests # run properly, beardless of ...
1ed988ac64d2dc196ebd6b59b6893d9329dea4d6aa84ff194cfa0367fa986622
Python
3,719
108
import os import numpy as np from IPython.core.debugger import set_trace import importlib import sys from default_config.masif_opts import masif_opts from masif_modules.MaSIF_ligand import MaSIF_ligand from masif_modules.read_ligand_tfrecords import _parse_function from sklearn.metrics import confusion_matrix import te...
e129876ccfe3a54b21f268e72695433529e9d105a6fb14a734b9393275748c4b
Python
3,719
109
#!/usr/bin/env python ####################################################################### ####################################################################### ## Created on January 23rd 2019 to get autosomes from samtools FAI file ####################################################################### #########...
f9f567b818c35f995dc4977059673ccf4b6771e6420d48eaf3c3fd37cc2db33b
Python
3,719
103
#!/usr/bin/env python3 import glob import itertools import os import pytz import click import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.signal as sg from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, mean_absolute_error SRC_DATA_DIR =...
81a694fea836419de3312a1f28f8cb8bddb7ad7818ac7becbec1dde1465d957d
Python
3,720
107
""" Entry script redirecting all command line arguments to a specified script from the utime.bin folder. Usage: ut [--help] script [script args]... [--seed] """ import logging import argparse import os import sys import importlib import pkgutil import psg_utils from utime import bin, Defaults from utime.version impor...
c4da75d42e37af5f341a78e8397a5c0c9d700fc35d2dd86b874109d336516389
Python
3,720
118
""" An example model that has double the number of convolutional layers that DeepSEA (Zhou & Troyanskaya, 2015) has. Otherwise, the architecture is identical to DeepSEA. We make no claims about the performance of this model. It is being stored in `utils` so it can be easily loaded in the Jupyter notebook tutorials for...
5e4f6e980936dc604e8d11dad006debc6257409dad5d64b1dc3af061844e2010
Python
3,722
124
# SCSCSCSCSCSCSCSCSCSC # CSB Lab | Indian Institute of Science, Bengaluru # Chinmay K Haritas # Toggle Triad in 2D with Diffusion # %% print("\nSpatial GRNs - Toggle Triad in 2D\n") # Import Block import helpers from tt_vars import * from helpers import hill, p_i np, pd, plt, tqdm, time, njit, prange, animator, ma...
ee1f3bbf65928b46844b44419deae7a30f579df2c80faf0e0956a6cbbeacd813
Python
3,722
83
import tempfile masif_opts = {} # Default directories masif_opts["raw_pdb_dir"] = "data_preparation/00-raw_pdbs/" masif_opts["pdb_chain_dir"] = "data_preparation/01-benchmark_pdbs/" masif_opts["ply_chain_dir"] = "data_preparation/01-benchmark_surfaces/" masif_opts["tmp_dir"] = tempfile.gettempdir() masif_opts["ply_fil...
f8b69bab4522338e368a8b5f1f09a4b20eaaa061bf70c8513fe04dcf4b21d434
Python
3,722
124
# SCSCSCSCSCSCSCSCSCSC # CSB Lab | Indian Institute of Science, Bengaluru # Chinmay K Haritas # Toggle Triad in 2D with Diffusion # %% print("\nSpatial GRNs - Toggle Triad in 2D\n") # Import Block import helpers from tt_vars import * from helpers import hill, p_i np, pd, plt, tqdm, time, njit, prange, animator, ma...
507639b431a0e6e038d18c42f3721c8a434d33e92f01ff5584e1f65282ec216e
Python
3,723
247
##behavior behaviors=[ 'forward_walking', 'backward_walking', 'pushing', 'rest', 'eye_grooming', 'antennal_grooming', 'foreleg_grooming', 'hindleg_grooming', 'abdominal_grooming', 'proboscis_extension', 'CO2_puff' ] ## Joint_pos = Leg + joint + joint_angle, for example, LF_leg coxa x list_legs=[ 'LF_leg', 'LM_leg...
6082f4dd11a9bcfc1e61cd4050fc0657dd6d3902021e581813858b31d7563522
Python
3,723
96
#!/usr/bin/python from __future__ import print_function import sys import os import codecs import argparse import unicodedata def process_transcripts(transcripts_dir, transcripts_list): ''' This looks through each transcript file, and collects the words. Arguments: transcripts -- file with list o...
c38a14e447f74ddf5d1d75c43aff46389b3cbb764676d500c7c1f0672fd3a31e
Python
3,723
98
''' Author: Naiyuan liu Github: https://github.com/NNNNAI Date: 2021-11-23 17:03:58 LastEditors: Naiyuan liu LastEditTime: 2021-11-24 19:00:42 Description: ''' import cv2 import torch import fractions import numpy as np from PIL import Image import torch.nn.functional as F from torchvision import transforms from mode...
5d213fd4e42ef7bc5faa2e351d657d62f13a0b49684af7fa56329cfe64475760
Python
3,725
80
from dash_extensions.enrich import Input, Output, callback, clientside_callback, ctx from dash.exceptions import PreventUpdate def register_shortcut_callbacks(): # Switch modebar buttons with keyboard clientside_callback( """ function(id) { document.addEventListener('keydow...
d1fc872cd4415002e23088ad8017ad39fa1003624b9702ff780dd9848e4d6c6e
Python
3,725
146
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import os import time import nibabel as nib import numpy as np import warnings import scipy import nibabel as nb from nipype.interfaces.base import ( TraitedSpec, File, ...
c1d79fe786d11975d16f9427d1f1cf0f3fc2bf65f1f8d99e065072a205c72f62
Python
3,726
128
import argparse import sys import tempfile from pathlib import Path import cog sys.path.insert(0, "base") from utils.inverter import StyleGANInverter from utils.visualizer import load_image, resize_image, save_image class Predictor(cog.Predictor): def setup(self): # get default args first self....
549c20708f95cc0f463d79799cbbce103ee2d0b4582aeeb28eb439f420bba2f0
Python
3,728
113
# 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 a...
2c204f66e9127d0220b81b5f0e7aa6c6f9a7d68f1ec478a722fcfc746b18019b
Python
3,730
96
#%% import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from tqdm import tqdm import pymaid from pymaid_creds import url, name, password, token rm = pymaid.CatmaidInstance(url, token, name, password) from data_settings import data_date, pairs_path from contools import Promat ...
7fff41f8eb2410af5993c191cdd89271092b5fec4a17cc925c27471c2a215dd7
Python
3,730
86
# 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...
f7793a16d754405695966861c0e76192c73eb0faa49064fc006533545cbfab03
Python
3,730
112
"""Controller file for the behavioral classifier """ from distutils.command.install_egg_info import to_filename from dark_ships.behavioral_classifier.transformation_pipeline import process_data, parse_sample, parse_sample_auto, parse_tfrecord, parse_sample_RF, parse_tfrecord_rf from dark_ships.behavioral_classi...
033b74f6945faea2c0b35f71ea2f1ebb38f4e7d2687a989b865c79f937028bad
Python
3,732
112
""" Title ----- Membrane time constant Description ----------- In this example, we show how to calculate a neuron's membrane time constant ``τm``, a metric that describes how quickly the membrane potential ``V`` decays to its steady-state value after some perturbation. In simple RC circuits, ``τm`` is calculated as th...
3e3b09806a8709d3459ea1939524e2783d0d3a15e51ecc54cb6b0f625a9eefef
Python
3,732
112
import logging from anndata import AnnData from scvi._compat import Literal from scvi.core.data_loaders import ScviDataLoader from scvi.core.models import ArchesMixin, BaseModelClass, RNASeqMixin, VAEMixin from scvi.core.modules import VAE from scvi.core.trainers import UnsupervisedTrainer logger = logging.getLogger...
4e656c1dfa08cefa7f9758a466546c3e95b814d52ebb7fcba69b5578eac31a65
Python
3,734
129
import numpy as np import joblib from scipy.special import logsumexp, gammaln from tqdm.auto import tqdm def get_obs_parameters(arhmm): from pybasicbayes.util.general import inv_psd sigs = [inv_psd(o.sigma, return_chol=True) for o in arhmm.obs_distns] obs_parameters = {} obs_parameters["As"] = np.stack([o.A[:, :-...
e5ba27b934ab8d32fae6d2c61d42e50c617e0873f0a4e71d9fc013a55523c985
Python
3,734
101
import time from typing import Dict, Tuple import loguru from nilmtk import MeterGroup from numba import njit import numpy as np from pandas import DataFrame from datasources.datasource import SITE_METER from utils.logger import TIMING, debug, timing def create_multilabels_from_meters(meters: DataFrame, meter_group...
073fa9dbc186ca7a2c1e27a6d641782b0b326acea1e86fb87a10134d883e4e9c
Python
3,736
96
# Builtins from pathlib import Path import pdb from typing import Type from context.context_module_base import ContextBase class Context(ContextBase): ''' Set context (paths, filenames, etc) for the project. Each module orders self.context.property name from context by calling set_context() Paths and...
af5f6558bf83590808e0c8bfb5c5f52d3415a4708ecb85d134e2b1e2eecb4f25
Python
3,738
101
import pytest from jax import vjp import jax.numpy as jnp from jax.config import config import jax.test_util as jtu import numpy as np import scipy.sparse as sp from scipy.sparse.linalg import spsolve as spsolve_scipy from simphox.primitives import spsolve, TMOperator np.random.seed(0) config.update("jax_enable_x64",...
e146a9e11db2929684f4bf0d4aec46da184903ad87b38b7c9cd955d21b260508
Python
3,739
112
# Copyright (c) Open-MMLab. All rights reserved. from pathlib import Path from ..utils import is_list_of, is_str from .handlers import BaseFileHandler, JsonHandler, PickleHandler, YamlHandler file_handlers = { 'json': JsonHandler(), 'yaml': YamlHandler(), 'yml': YamlHandler(), 'pickle': PickleHandler(...
e28edb84f3910ea3021fc72eab92e8c14c86c1c57cc55e1539ef6aa163bd8e0a
Python
3,739
93
# 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...
8ad8139ba63e4be6cda14b2c2fd83e49e747df0acc09c438b645981900aba080
Python
3,740
106
#!/usr/bin/env python # Apache 2.0 # # This script truncates the rttm file using UEM file and writes it to a new rttm file. # We use some utility functions from the dscore toolkit. from __future__ import print_function from __future__ import unicode_literals import argparse import sys from dscore.scorelib.turn import...
9ad93779b78558736de4f34b65ac8f78a4505bb089ffacb40ce4387c4bfcdbca
Python
3,743
137
# %% [markdown] # ## import datetime import os import time from pathlib import Path from tqdm import tqdm from src.data import join_node_meta import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import pymaid import seaborn as sns from giskard.plot import dissimilarity_cluste...
fef79a4528081c8f8d02973c6326fa0e7099ca422ba7ba13667076a95dd1b42d
Python
3,744
114
from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import models import traceback import numpy as np import imlib as im import tflib as tl import tensorflow as tf import argparse from glob import glob img_size = 128 parser = argparse.ArgumentParser...
2e3b8434f3a8fc0149d6e47c1d96d9051a6cf2b50e78a384c9d44e2d626d1555
Python
3,745
132
#!/usr/bin/env python import numpy as np import pandas as pd import copy from collections import defaultdict from sklearn.cluster import DBSCAN from scipy.spatial.distance import pdist, squareform from scipy.optimize import curve_fit from sklearn.metrics.pairwise import nan_euclidean_distances def calc_med_dist_mat(...
5d1772603b249c743984d35dd2d90794528827ea582c0828e6e552918179b5ff
Python
3,745
78
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'graderTemplate.ui' # # Created by: PyQt5 UI code generator 5.12.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): ...
15631f01359e1cfe466dcd9ef52aa5ba2d2ce605df2329e765d0d81db85ca02e
Python
3,746
113
"""Train models using pytorch lightning.""" import logging from datetime import datetime from pathlib import Path import hydra import mlflow from dotenv import find_dotenv, load_dotenv from hydra.utils import instantiate from omegaconf import DictConfig, OmegaConf from pytorch_lightning import Trainer from pytorch_lig...
525208f6d2ac388cfb6b702412d95fd4d33f3bec04e85fabfda6f3bed248b8a2
Python
3,746
121
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # 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 applicab...
3461f563ca83f9fb158108365bb394f10376b057abebe5c1f0ddcdb9f5782cd9
Python
3,747
152
# chemistry.py: Chemical parameters for MaSIF. # Pablo Gainza - LPDI STI EPFL 2018-2019 # Released under an Apache License 2.0 import numpy as np # radii for atoms in explicit case. radii = {} radii["N"] = "1.540000" radii["N"] = "1.540000" radii["O"] = "1.400000" radii["C"] = "1.740000" radii["H"] = "1.200000" radii...
13816a9eaf7088d7e26dbe7fe0aed6cfa779013760aa1fbfbbeb91f3583be2d5
Python
3,748
103
#!/usr/bin/env python "Pre-emptive caching of commonly used TemplateFlow templates" import templateflow.api as tf def fetch_MNI2009(): """ Expected templates: tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz tpl-M...
5670153f4145c0db8dc51a485df4b4ca2cd48c783c3483b7f5394029573d38a9
Python
3,749
95
""" This file runs ridge regression encoding model on all labels and all non-food labels and outputs the improvement in R2 by including food labels. Example run: python food_label_R2_improvement.py -s 1 -v voxel_path.npy -t stim_id_path.npy -c coco_prop_path.npy -o output.npy -s : subject -v : path to preprocessed v...
fda788989ee4c23100596e8a92a39e75bd00a78af3e260636df1885ae9add030
Python
3,750
94
import argparse def main(): parser = argparse.ArgumentParser() # dataset parser.add_argument('--dataname', type=str, default='TripletData') parser.add_argument('--trainroot', type=str, default='data_IO/triplet.csv') parser.add_argument('--testroot', type=str, default='data_IO/test_pairs.csv') p...
ef034ebbceb566e271dca994a99624a8ec2be0b4f0eb8860365b01e743ab3f9d
Python
3,751
108
### reference code from https://github.com/quark0/darts/tree/master/cnn --- Differentiable Architecture Search import torch import torch.nn as nn from .conv_ws import ConvAWS2d from .registry import CONV_LAYERS import torch.nn.functional as F OPS = { 'skip_connect': lambda C, stride,affine,groups: Identity() if...
1d571bde97973c0fb9b010106fb6ec512aa202bd445d7326930ffbb94edae29a
Python
3,752
108
import pandas as pd #read pdb by cols """ COLUMNS* DATA TYPE FIELD DEFINITION ------------------------------------------------------------------------------------- 1 - 6 Record name "ATOM " 7 - 11 Integer serial Atom serial number. 13 - 16 Atom name ...
231d5f48e3c252ef968c433f8f920c2d26e5fd7f4d55acbe5eef8b940d318f11
Python
3,754
114
import os import re import argparse import copy def statistics_module(path, fc=False): files = os.listdir(path) layers = [] for f in files: if fc: if "power" in f: with open(path + "/" + f, 'r') as rpt: lines = rpt.readlines() ...
75d57dcf13fa0484484bd196fd310b172a31ab64d6f4cf5a976e1abcaee1367c
Python
3,755
103
import numpy as np import os from os import listdir from os.path import join, isfile, isdir # GET DATA def getData(tmp, cutoff=0, bertpath=""): data = np.load(tmp) # 3D coordinate information idx = data["idx"] val = data["val"] # 1D information # angles = np.stack([np.sin(data["phi"]), # ...
f5ab4e88436726981f191a45a5b862ea05ec8788efa3050cf3680189f338059d
Python
3,756
129
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # 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 argparse import contextlib import sys from collections import Counter from multiprocessing im...
1ab87ca865b91b06804224204f014fb1b9399979230765fa07677ce4464df329
Python
3,757
107
''' Helper functions for loading and preparing data. ''' from typing import List from pathlib import Path from dataclasses import dataclass, field import pandas as pd import numpy as np def name_wrapper( filename: str, savepath: str = '', fileextension: str = '') -> Path: ''' Prepends the filename wi...
7213329042c86ea51f666d15373fb9927ea3587689563ed863da03cb138e7c8f
Python
3,757
105
# 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...
54158738a854f2f5adec999eff811c593840945fd23187af6c9d9a830bdeec56
Python
3,759
118
from abc import ABC from typing import Iterable, List, Optional from oaklib.datamodels.search import SearchConfiguration from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface from oaklib.types import CURIE __all__ = ["SearchConfiguration", "SearchInterface"] class SearchInterface(BasicOntolo...
694bfe8196c511a839a8f50d9dbdaed6aa4a5934a5504d4549a6ba44b0954e36
Python
3,759
125
# # calculation of synthetic accessibility score as described in: # # Estimation of Synthetic Accessibility Score of Drug-like Molecules based on Molecular Complexity and Fragment Contributions # Peter Ertl and Ansgar Schuffenhauer # Journal of Cheminformatics 1:8 (2009) # http://www.jcheminf.com/content/1/1/8 # # seve...
1633fdcca71e47f242899524354cadb16f477f5dda59349773940abfe0556d43
Python
3,760
99
# 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...
524ff21b3d4f6694e27de8a5c2b2931c429de4aca393f69df13b66a596c0b2a3
Python
3,760
125
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ Miscellaneous utility functions """ import torch from torch import nn from torch.nn import functional as F from maskrcnn_benchmark.config import cfg from maskrcnn_benchmark.layers import Conv2d from maskrcnn_benchmark.modeling.poolers import P...
3219623a637ff2db6b79da289674e0e511a582b77d2035cbc393e38efef6c74a
Python
3,761
131
import torch class Sampler(object): """Base class for all Samplers. Every Sampler subclass has to provide an __iter__ method, providing a way to iterate over indices of dataset elements, and a __len__ method that returns the length of the returned iterators. """ def __init__(self, data_sourc...
782c15d416e9fdabb89d083de0e84610e75b391bb0c14afe2211093cc71b5246
Python
3,762
103
""" ========================== Callosal bundles using AFQ API ========================== An example using the AFQ API to find callosal bundles using the templates from: http://hdl.handle.net/1773/34926 """ import os.path as op import matplotlib.pyplot as plt import nibabel as nib import plotly from AFQ.api.group impo...
dccf260b9e0aa7fa100b54b80fdb5c9d0b6fb55aee5ab2c0caaaf0d323f1ec09
Python
3,763
108
from __future__ import print_function, division import csv import functools import json #import you import random import warnings import math import numpy as np import torch import os from torch.utils.data import Dataset, DataLoader from torch.utils.data.dataloader import default_collate from torch.utils.data.sa...
f3b1bf5362397d5ccc0352e446ac727927665e727c096d20ab51f4bb902a766e
Python
3,763
116
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
083d8b7dbfed758fc44f2ce6e56e920eda35529fb15d8ff05ef65b8a123e6cbf
Python
3,767
66
# Form implementation generated from reading ui file 'graderTemplate.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 clas...
80a31cb92c062b624f91caace8103697df4479d17a317cb6851916bd082d0706
Python
3,768
86
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 PYCHARM_EXEC = os.getenv('PYCHARM_EXEC') == 'True' import tensorflow as tf from tensorflow.keras.callbacks import ModelCheckpo...
7e159de84bb38614e91d59406b824414c17c2f8fcac9eb0ddb61f0b6c49e8351
Python
3,769
128
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Take in 32x32 size squares """ from keras.models import Sequential import keras.layers as layers import keras.optimizers as optimizers from keras.utils import Sequence import keras import unetsl.data import unetsl.model import unetsl.cli_interface import os,sys impo...
4cc684f677b2f9fcf43498382ec8d16fb21222bcd240e5fc72fb10449c2fdd83
Python
3,771
95
''' Fitting ciliated cells, simultaneously to electrophysiology and particle flow angle. With multifitting to enforce resting calcium concentration. Note: - for nans: debug with numpy.seterr(all='raise') (and numpy code generation) ''' from file_management import * from brian2 import * from brian2modelfitting import M...
132f164bc7cde9a046e976d232f40f49c1f1447d637f27a66aecc8a1ad1c6bdc
Python
3,772
88
"""MobileNetV1 for Semantic Segmentation""" import torch import torch.nn as nn import torch.nn.functional as F from models.baselines.base import BaseModel class EfficientNet(BaseModel): def __init__(self, classes=2, aux=False, backbone='efficientnet', pretrained_base=False, **kwargs): super(EfficientNet,...
163ece6d42849ec7d18aa0186ea6e4630a394e44b0287434f0166675f87b1834
Python
3,773
98
import concurrent from tqdm.auto import tqdm from drugex.parallel.interfaces import ParallelException, ParallelProcessor class ParallelSupplierEvaluator(ParallelProcessor): """ Class implementing parallel evaluation of `MolSupplier` instances on input data (see `ParallelSupplierEvaluator.apply`). """ ...
d61c185d76de5eda39274aa5498c1687d727d9629c1a529b2414f433e30f254c
Python
3,773
117
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """I/O for wave files""" import os import numpy as np from .._data_obj import NDVar, Scalar, UTS from .._utils import ui FILETYPES = [("WAV files", "*.wav")] def load_wav(filename=None, name=None, backend='wave'): """Load a wav file as NDVar Parame...
5da2cd29dedce6bf47d72b3c6572893103c50305e4fd719cb8b39a88b1b3edac
Python
3,774
58
"""Reproducible surface revision; preserves the straight wheel-detail master. Run in Blender. Artist material estimates; not measured manufacturer BRDFs. """ import bpy, bmesh, os, json from pathlib import Path from mathutils import Vector P=Path(os.environ.get('CARLA_MODEL3_WORKDIR',Path(__file__).resolve().parents[4]...
16b14f6b85b99c5aedb9fc79bf58f6686bae6c76e280a447cb1c02ae1c0d6ede
Python
3,775
100
import torch import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES def ae_loss_per_image(tl_preds, br_preds, match): """Associative Embedding Loss in one image. Associative Embedding Loss including two parts: pull loss and push loss. Pull loss makes embedding vectors from sa...
b6b293bf02d0fc6e3f7eb1f420608a87148fe5e7a5fb60c3ae3c89624835319f
Python
3,775
80
import torch.nn as nn from maskrcnn_benchmark.modeling.backbone.shuffle_blocks import ConvBNReLU, ShuffleNetV2BlockSearched, blocks_key class ShuffleNetV2DetNAS(nn.Module): def __init__(self, cfg): super(ShuffleNetV2DetNAS, self).__init__() model_size = cfg.MODEL.BACKBONE.CONV_BODY.lstrip('DETNAS-...
f5fb756e1164349643d85b6115f63993d326cfb0780a57fa0d05a98831f421c0
Python
3,775
88
# 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...
8cb636460fb9c893bec5a9b5bf38c05c6b034d2d7438356de078457b385994d1
Python
3,779
109
""" Extract, for each sequence, metrics about its: - How far it goes (distance to furthest follower) - How long does it go for (delay to latest average follower) """ from tctx.analysis import simbatch as sb from tctx.util import spike_trains as spt import pandas as pd import numpy as np DESC = 'extent' def get_f...
984547022ffcebb25ee438e7b333a3c9c64d0e11f864ef032eae321c9bc6ce68
Python
3,779
99
# 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...
d0519d9ff005985885f1ee0764bf3446e1fedbdaefc1d763bf189ccef5fb0806
Python
3,779
105
"""Regression tests for the ``is_mask`` argument of ``load_resample_itk``. ADC/HBV (and T2W) are intensity images and must be resampled with B-spline interpolation, i.e. ``is_mask=False``. A prior bug passed ``slice_number`` positionally into ``is_mask`` (a truthy int -> ``True``), so intensity images were resampled a...
8d2c3b3c9fd1d0b7f83154da802bc4ccdebe3778fa691192bebe12ec7b7feb8c
Python
3,781
90
import mne import numpy as np import pandas as pd import matplotlib.pyplot as plt import os ## logging info ### import logging from datetime import datetime logname = './logs/' + datetime.now().strftime('log_%Y-%m-%d.log') logging.basicConfig(filename=logname,level=logging.INFO, format='%(asctime)s - %(l...
5a50aded6a3a402e68ce1bae4e76da0c9d169a3ca84c69acf7087badfd6f4d5a
Python
3,783
89
"""Bennett et al. 2021 MV reinforcement-prediction-error mushroom-body model. Single-valence reduction: KC sparse code from PN->KC connectome MBON rate output m = ReLU(w @ kc) DAN d = r - m_hat (prediction error from valence-opposing MBON feedback; single-valence...
1011f1576416f04bbd797a6907de614a75fbb8982542ca25e3155ea7afe0111d
Python
3,784
135
import time import itertools import scipy import scipy.stats import numpy as np import math from PIL import Image as PIL_Image from keras.preprocessing import image from keras.models import load_model from utils.image_and_text_utils import index_to_char,char_to_index from utils.config import * from bayesian_agents.rsaW...
21fb2cdb86943466f62662630fecd2f64bf514c32449d669d177c2c9651f9671
Python
3,787
125
""" Makes summary data tables for supplementary ferrets not tested with cooling Created on 2021-10-10 by Stephen Town """ from dataclasses import dataclass import os, sys from pathlib import Path import pandas as pd sys.path.insert(0, os.path.abspath( os.path.join(os.path.dirname(__file__), '../../..'))) from Resu...
778eef945f6708bf03781be82afed5c667aacb8e79645a434a9dfe70ca3e2642
Python
3,788
109
"""Build a table with basic info on members of parliament.""" from logging import Logger from pathlib import Path from typing import List import pandas as pd from lxml import etree from fi_parliament_tools import MPID_FILTER from fi_parliament_tools.parsing.documents import MPInfo from fi_parliament_tools.parsing.que...
f4da99e61e0c98a8f456e2a6bfea91001a28e5c2517672f2ae84743af5bc14e2
Python
3,788
138
import ast import json import pathlib import subprocess import time from glob import glob from pathlib import Path import os from bokeh.client import pull_session from bokeh.embed import server_document from flask import Flask, request, session from flask_cors import CORS, cross_origin from lib import segmentation, u...
8aa1655fe3502124d8cd296d7a444f42f099a651ab7dbc4eeb713c86f965ddd8
Python
3,789
142
''' Fig. 11. Collective behavior. Simulation of trajectories with breathing paramecia. ''' from brian2 import * from behavior import * import imageio from plotting import cell_mask, cell_indices from brian2 import * from behavior import * import imageio from plotting import cell_mask, cell_indices movie = True C = p...
1b1c320ea1a307db175e894894419a384b9795599657231d08ab645c49524315
Python
3,790
111
import pandas as pd import torch from dataset import ViscosityDataset from torch.utils.data.dataloader import DataLoader import argparse import glob import os import numpy as np from model import ViscosityNet from utils import seed_everything from utils import generate_esp_grids, get_esp_grids from utils import DEFA...
55923fd42c0795ce2ab9c9d7ea9ae251ee1b521a6ca34b7524ca790effa85fdb
Python
3,791
105
# 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 a...
a719242f05c7f9d89737ad66d0abcff149f2cc4546c468c4f29fec2462f19a89
Python
3,792
124
# %% [markdown] # ## import numpy as np import pandas as pd import pymaid from src.data import load_metagraph from src.pymaid import start_instance from tqdm import tqdm mg = load_metagraph("G") meta = mg.meta start_instance() splits = pymaid.find_treenodes(tags="mw axon split") splits = splits.set_index("skeleton...
d4bc9da7ebb45a30a2e1dc29dffd6fda62da1de630d1fa452ee5a2b940375cea
Python
3,793
98
import torch from sklearn import metrics from .vae_basic_model import VaeBasicModel from . import networks from . import losses class VaeRegressionModel(VaeBasicModel): """ This class implements the VAE regression model, using the VAE framework with the regression downstream task. """ @staticmethod ...
c7891bf845ecec91d8ea695376c92c632179fecf19a476bf167334b951d3d9c7
Python
3,796
109
import tensorflow as tf from tensorflow.keras.layers import * from tensorflow.keras.optimizers import Adam from tensorflow.keras.models import Model def Dense_layer(prev_layer,num_filter): eps = 1.1e-5 #dense layer 1 batch = BatchNormalization(axis=1, epsilon=eps)(prev_layer) conv = Conv2D(num_filter...
07c4ede9ada4cd3fb7106dbe027faa3e7d864e0ce8a96ec88a949e103e8c370b
Python
3,798
104
# 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...
390ad14b1cf60fcaf00c22e415d64bdd7e3fc3475b8a5fb69a7510543e1a7248
Python
3,799
125
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init def conv_block(in_ch=1, out_ch=1, threeD=True): if threeD: layer = nn.Sequential(nn.Conv3d(in_ch, out_ch, kernel_size=3, padding=1), nn.BatchNorm3d(out_ch), nn.ReLU() ) else: layer = nn.Sequential(nn....
a96b4f953a722e3d917e086ad732a31d6813eb6f81b20b99687154cfd43cfe0c
Python
3,799
121
import sys import h5py import logging import warnings from pathlib import Path import torch import numpy as np from scipy.ndimage import zoom from unet3d import Basic3DUNet warnings.filterwarnings(action='ignore', category=UserWarning) log = logging.getLogger(__name__) PAD = 64 def segment_mitochondria(input_path,...
5d4c286a13791ca3f51eba2b2fc09e4db5e03a60d28283081f1a0ba519c88152
Python
3,804
94
from numpy import random from train import train from tqdm import tqdm from model import Unquantified_2layer_CNN from utils.dataTrans import get_dataloader from sklearn.model_selection import train_test_split from experiment import setup_seed, mfcc_general_data, stft_general_data BATCH_SIZE = 64 LR = 0.003 E...
633ad175d4fcfd606e078db68a5e9e0583d5cee756619c091a12f598ad39bef7
Python
3,806
105
import itk from subprocess import call import sys def combine_transforms(transforms_arr: list): composite = itk.CompositeTransform[itk.D, 3].New() for i in transforms_arr: t = itk.transformread(i)[0] composite.AddTransform(t) return composite def resample_from_comp(image, transform, out...
aa44a5662f06333eb2ba590fbdcdb4c2490337c87ef7a08f93d30a7430112356
Python
3,806
97
from .vehicle_wheel_smoke_test import VehicleWheelSmokeTest import carla import math import os import tempfile RECORD_DELTA_S = 0.05 REPLAY_DELTA_S = 1.0 / 60.0 ROLE_NAME = "wheel_replay" # How far the replayed spin may stray from the body's travel in a tick. SPIN_TOLERANCE = 0.3 class TestVehicleWheelReplay(Vehic...
c1e6e2013cd0d139fcce586071423370c8a9f7de5306e59737ce82c2fac740d0
Python
3,807
104
# 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 a...
9dde4005f11d4738550c9e83a17a20bf97f23b8e05cca5375c38dd6963a96d12
Python
3,808
110
import sys import argparse from pathlib import Path import logging import numpy as np import pandas as pd import tifffile as tf from cenfind.core.data import Dataset, Field from cenfind.core.loading import load_foci from cenfind.core.visualisation import visualisation, create_vignette from cenfind.core.statistics impo...
d67c2bede075806e59fbef959a5890839e579e68fe79ef977dc34cc0948bc6b6
Python
3,810
102
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # 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 applicab...
ea8395e43871fc13e5ca3a2ae53b6b30dd069649b8dadebc6b3c33ddf5e28273
Python
3,812
103
import torch import torch.nn as nn from .resnet_updated import resnetbank50all as resnetbank50 from .globalNet import globalNet class Model(nn.Module): def __init__(self, n_kpts=10, pretrained=True, output_shape=(64, 64)): super(Model, self).__init__() self.K = n_kpts channel...
bfa0f294be6ac0e717a5afaa1a05cd98b40bfe5b3f95c4543153133eda15ec7b
Python
3,813
146
# -*- coding: utf-8 -*- import json import os import sys from pathlib import Path SUPPORTED_FTYPES = ('acq', 'txt') # 'mat', ... def check_input_dir(indir): """ Checks that the given indir doesn't have a trailing '/' """ if indir.endswith('/'): indir = indir[:-1] return indir def ch...
c83f0e77a074b047e7f3e3d60c9182256fce03da233b595948de16baae0b5c88
Python
3,813
90
import ctypes import numpy as np import os import sys import torch import pdb class _gnn_lib(object): def __init__(self, args): dir_path = os.path.dirname(os.path.realpath(__file__)) self.lib = ctypes.CDLL('%s/build/dll/libgnn.so' % dir_path) self.lib.GetGraphStruct.restype = ctypes.c_voi...
e29d35a338f402529bfd08ac1912f4852bb2c6e0025d0ad2b84def29366499aa
Python
3,814
110
import random import torch from torch_geometric.data import Data from torch_geometric.utils import degree from torch_geometric.utils.subgraph import subgraph from torch_geometric.utils.random import erdos_renyi_graph from torch_geometric.utils.convert import to_scipy_sparse_matrix from IPython.display import SVG from...
094aa4b77f9f16ae8a51b60a818b666e799c679c991a60e5c63b068e8caf8745
Python
3,815
127
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os from keras.applications.inception_v3 import InceptionV3 from keras.preprocessing.image import ImageDataGenerator from keras.models import Model from keras import layers fro...
62afc1a6a2354e6b83ee0cd1d4a9d591eaa6ed00e517ed9d0de0922f80721af8
Python
3,815
78
import os import torch import argparse import numpy as np from feature import create_feature from network.resEGNN import resEGNN, resEGNN_with_mask, resEGNN_with_ne if __name__ == '__main__': parser = argparse.ArgumentParser(description='Predict.') parser.add_argument('--input', type=str, required=True) p...
a7396c5db60cde74a19e37ff2f98e8cf1f8cb0df8bf6a3b766f03d4b77ed1d0e
Python
3,815
92
# basic imports import os import pickle import numpy as np # framework imports from cobel.agents.sfma import SFMAAgent from cobel.interfaces.gridworld import InterfaceGridworld from cobel.analysis.rl_monitoring.rl_performance_monitors import EscapeLatencyMonitor def single_run(world: dict, trials: int = 20, trial_ste...