sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0e4282736d00b38525c7bb281ca661df25ac067cc23fa6de19f651b813220a89 | Python | 12,685 | 317 | """
© 2022, ETH Zurich
"""
from rescoss_logp_ml.utils import (
FOLDER_NAMES,
PROC_DATA_PATH,
NUM_INNER_FOLDS,
HPARAMS,
LEARNING_CURVE_SIZES,
get_output_dir,
)
import os
import numpy as np
import itertools
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
imp... |
95316eb57daf030c79b227eeed9315ce7cb078283e7cbb9d91a90c5b3905cb8d | Python | 12,696 | 364 | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class FastSal(nn.Module):
def __init__(self, classes=2, aux=False, pretrained='ShuffleNetV1_pretrain.pth'):
super(FastSal, self).__init__()
self.context_path = ShuffleNetV1(pretrained)
if... |
dbe5113f5da2846da0a59767a90407cfcc30f25515d045cb8714ae493b4285e8 | Python | 12,698 | 333 | import numpy as np
from pathlib import Path
from configparser import ConfigParser
import shutil
from tqdm import tqdm
import imageio
import cupy
import cupyx.scipy.ndimage
import skimage
import scipy.ndimage
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from flexdata import display, data
from flextomo impo... |
5de5ebc33714837b234523d7560a53f62b7e9a09c9aa4ccb6242c90278eb2454 | Python | 12,712 | 433 | # notes
# ask michael if we can get the locations of the different cells
# this thing (LSE) but on the whole brain
# compare to the omni one
# bic curves for both
# compute ARI
# slides for tomorrow
# when we present (seems like it should be obvious)
# then show the result, know whether it is what they would have exp... |
53f329e5f5fcd5f5c85408d4eba4d296e529c2222ee824f78277502b479899ae | Python | 12,723 | 304 | import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
import numpy as np
import copy
import utils
from utils import device, Vocabulary
from encoder_decoder import EncoderCNN, DecoderRNN
import operator
class AdaptiveAgent():
init_encoder_params = None
init_decoder_params = None
... |
a817253055ed606e3ac1ca60dcd5fefde5246858a4d99e298584c6a34d9e907b | Python | 12,730 | 368 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
import pandas as pd
import numpy as np
import torchvision
import torchvision.transforms as T
from torchvision import models
import pytorch_lightning as pl
from pytorch_lightning.loggers import ... |
ea02aef2bb7574543cc57bf141cbee7a16c117f5d4d1f924b67a46076b2a62cb | Python | 12,744 | 325 | import tkinter as tk
from tkinter import font
from tkinter import filedialog
import torch
from os.path import join, splitext, split
import glob
import mne
from gssc.infer import EEGInfer
from gssc.utils import output_stages, inst_load, graph_summary
def add_files():
files = filedialog.askopenfilenames()
if len... |
649f6e4b143c5ccc5a48675ab5f028008790a4ac5f75517ec73264d01758087b | Python | 12,748 | 310 | from .typing import Optional
import sys
from ctypes import CDLL, byref, c_char, c_int, c_int64, POINTER, c_float, c_double
import numpy as np
import scipy.sparse as sp
from typing import Tuple
libname = {'linux': 'libmkl_rt.so', # python3
'linux2': 'libmkl_rt.so', # python2
'darwin': 'libmkl_... |
f7a1122f11d5df08b67f7fed195bc438cffa34385f0f52e0afc156d3cb5b3e52 | Python | 12,757 | 401 | #%% Load
from operator import itemgetter
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 KMeansCluster
from graspy.embed import LaplacianSpectralEmbed, OmnibusEmbed, AdjacencySpectralEmbed
from graspy.models import DCSBMEstim... |
410d8c2ec6dc3aa57286e3d53e4b58c6254b45eb89b3c2159204d87f9a449639 | Python | 12,770 | 299 | #!/usr/bin/env python3
"""Regenerate the static demo.
The demo is a copy of the platform's own frontend serving one frozen competition. This
script produces the two generated pieces:
* js/demo-data.js — the canned replies the demo shim serves in place of the Flask
endpoints, including the competition's leaderbo... |
4a228c23abbc1e78a2fddf6f0bc25667f71ee9a737765a9942c73be9b7e16713 | Python | 12,771 | 354 | # Built-in
import os
import pickle
import shutil
import zlib
from pathlib import Path
# Third-party
import brian2
import brian2.units as b2u
import numpy as np
import pytest
from scipy.stats import wasserstein_distance
# Local
from cxsystem2.core import cxsystem as cx
cwd = os.getcwd()
path = Path(os.getcwd())
anato... |
16b2b3a694588d407c2070afb82e0fa073dbb733c2b3ba15fbce16b65a2fd49e | Python | 12,779 | 313 | import base.backend.cli as base_cli
import os, argparse, glob, pathlib, zipfile, sys
import backend.settings
import backend.training
import backend.evaluation
import backend.root_detection
from base.backend.app import get_cache_path, setup_cache
class CLI(base_cli.CLI):
#override
@classmethod
def create... |
751180c96bb1c1c3261801dbfee841a571c1edcdb96e28856673c8aeb976de58 | Python | 12,786 | 292 | import mne
from .utils import (epo_arr_zscore, permute_sigs, check_flip_chan,
loudest_vote, prepare_inst)
import torch
import numpy as np
import warnings
from importlib_resources import files
class ArrayInfer():
"""Class for sleep stage inference on a set of EEG data.
Parameters
-------... |
5e343bb8b183b8d36f8305ef051d7699c024d3c31eccbc414e38557837600b32 | Python | 12,788 | 330 | #%%
import os
import sys
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
# %%
import sys
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
fr... |
8976e8c4fe6bdc075d26ebf52d489a5e858448f220a50dfd5dd6b1d450166e6a | Python | 12,790 | 325 | # 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... |
7c83d67fe0f156019b263661dba4a21d9bc9b55b4cab1c82c071c4f60149940e | Python | 12,793 | 307 | #!/usr/bin/env python
# coding: utf-8
import json
import csv
import PredysUtil5ans as pu
import numpy as np
import os
from sklearn.svm import SVC
from sklearn.svm import LinearSVC
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score
imp... |
4b0f5dbf72c2adcfb9d8ca9d474e5091484bd876fa0bfc20edbe8d6a8537d98f | Python | 12,794 | 282 | # ruff: noqa: RUF012
class ReceptorModel:
"""
Receptor models are added to neuron unit membrane equations.
"""
############################################################
### SYNAPTIC EXC/INH MODEL COMPONENTS ###
############################################################... |
0382c8eaf256354750eb1e406ef49e4c54573952aa37f333491ee9edce75312c | Python | 12,796 | 249 | from heapq import merge
import numpy as np
from sklearn.metrics import mean_squared_error
from torch.utils.tensorboard import SummaryWriter
import wandb
class WandbLogger():
"""
Before the learning process starts, initialize the logger:
logger = WandbLogger(project_name='project_name',
... |
52fa2911d8cd5fa5ec6c62dfa9f875d30ae071b3258b53dbd5b14063ecbdb90c | Python | 12,797 | 323 | from time import time
from brian2 import Network, NeuronGroup, StateMonitor
from brian2.units import Quantity, ms, mV, mvolt, nS, pA, pF
from matplotlib.pyplot import draw, rcParams, show, subplots
from matplotlib.widgets import Button, Slider, TextBox
class Playground:
"""
A class that creates a graphical u... |
6663857015d23ccec99c7d24e8a818e6801524cca6c715c33e770e8ab20d26bc | Python | 12,803 | 334 | #!/usr/bin/env python3
"""
File: direction_test.py
Created: 2020/05/22
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... |
17896391ee2e5c70b4de166023e9f077a2c5ae707567612a8d993fcfeb158c30 | Python | 12,814 | 408 | __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
import argparse
import time
from tmkit.seqnetrr.combo.Length import length as plength
from tmkit.seqnetrr.combo.Pos... |
43967160ee7096174f66fc8bcc84dd4d9ca9d9816f6bae38ac81ba032d1428ab | Python | 12,852 | 290 | nC = 5 # number of channels / colors
# nR = 5
# nR = 13 # number of rounds (except the last dT labeling)
# nR = 10
roundRef = -1 # round containing the cell reference; use -1 for the last round
cellch = 3 # channel containing cell reference
# cellch = 1
# nC = 3 # smHCR (211112)
# nR = 1
# r... |
783d6bb2634ae6b6168dd808cd93a7a7a778cf9e87af7f3fe086d3a94bebc733 | Python | 12,857 | 351 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
##################### IMPORTS #######################
import os
import sys
from keras.models import model_from_json
from matplotlib import pyplot as plt
import numpy as np
from keras.callbacks import ModelCheckpoint
from rdkit.Chem.Draw import IPythonConsole
import os,... |
42522d276f0f295a51656e7c2098f24c6be2d690306d8906a1edb7a619081b12 | Python | 12,862 | 241 | """Compose a carla-cosmos image in a registry from a code image plus weights-only layer images.
python tools/compose_image.py --registry localhost:5000 --repo carla-cosmos \
--code nano-nomodels --layers nano-layer1,nano-layer2,nano-layer3 --variant nano --tag nano
python tools/compose_image.py --regis... |
54d552e1c178e976f206b9712884905f362b2fe8b2a08467dfe81b500d53dbe8 | Python | 12,865 | 409 | import pandas as pd
import numpy as np
import logging
from tqdm.auto import tqdm as pbar
from tctx.analysis import simbatch as sb
from matplotlib import pyplot as plt
from tctx.util import plot
def _get_colors():
style_aliases = {
'only_a': ['a', 'a_and_not_b_and_not_c', 'a_and_not_b', 'a_and_not_c'],
... |
2c7d3615ac81ccb05efd745ecbaf5027de60c92948c5634eaa6982a0b1735981 | Python | 12,867 | 303 | """
This benchmark trains two models, one trained on half the labeled data then retrained on the other
half, and one only trained on the second half. This acts as a positive control showing that
pretraining has a positive effect on model accuracy under ideal conditions
"""
import argparse
import copy
import gc
import j... |
a380988788331c807130efc9f2054d48ce10611bb2c2d6f71f60d6933b5f99c2 | Python | 12,871 | 333 | ###################################################################
####
#### Version: 1.1.7
#### Date: 6/24/2023
#### Description: This file contains the class definition of the experiment object
#### Author: Evan Cobb
####
###################################################################
import globvar as gv
impo... |
e57e2643354794222e339294583da9a1b2ad99bcc63ec8dccd9934c725ca05cb | Python | 12,878 | 338 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
##################### IMPORTS #######################
import os
import sys
from keras.models import model_from_json
from matplotlib import pyplot as plt
import numpy as np
from keras.callbacks import ModelCheckpoint
from rdkit.Chem.Draw import IPythonConsole
import os,... |
5c2650f3ee23a1fbd19ce6419d838deaec4686ec24110b3dbf9bd8c0ba9786bc | Python | 12,886 | 305 | #!/usr/bin/env python3
"""
File: plot_cell_fraction_per_cohort.py
Created: 2021/02/06
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 b... |
9cdd35b6c66d517c10ac08eccf07c1b69cfbde34a29f16fe282e0bd24867bb83 | Python | 12,892 | 339 | # 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... |
07e0cd88b8bea7c53bd340cb715207b1a3a415181219853fa51e37220aa9cff5 | Python | 12,893 | 329 | import tensorflow as tf
import numpy as np
class MaSIF_ppi_search:
"""
The neural network model to classify two patches into binders or not binders.
"""
def count_number_parameters(self):
total_parameters = 0
for variable in tf.trainable_variables():
# shape is an array ... |
ab0fea9d68d49b2d05d1f4eb4c23112c37d89edc735c8f9f50012d0f78551150 | Python | 12,895 | 465 | import torch
import numpy as np
import pickle
from scipy.ndimage import gaussian_filter1d
import math as mh
from copy import deepcopy
from util.datasets import LabelFunction
FRAME_WIDTH_TOP = 144
FRAME_HEIGHT_TOP = 144
# Our dataset has 21 frames.
# TODO: Make this more flexible.
MIDDLE_INDEX = 10
EPSILON = 0.000... |
47ab3e9e3515eb101184418cdeee8ad5d67f1c80c554c63ec183f00d55c5d596 | Python | 12,899 | 316 | from __future__ import division
from builtins import range
from past.utils import old_div
from builtins import object
# Unit tests for sima/extract.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 bu... |
06d52e77d68ab7b90b21322548d7c8270e0086668b1c365b535ab42e7fba4981 | Python | 12,902 | 405 | """
Analysis tools used in multiple parts of the project
TO DO:
- Add binomial test
Created:
2021-07-20: Stephen Town
"""
from datetime import datetime
import pandas as pd
import numpy as np
# PREPROCESSING:
def filename_to_sessiondate(s):
"""
Strip datetime from behavioral results file name
... |
a102f9001fcd3e256a856f5e284973f290bddf6ec1ff7295cd8eb16f32bc42b4 | Python | 12,902 | 372 | ####################################################################################################
# Copyright (c) 2019 - 2022, 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 ... |
f06532eea6fc7c10c80be8466b1ed65b0fb0828c160216a5698c11c5bf358eeb | Python | 12,907 | 303 | import os
import sys
import tempfile
import subprocess
from pathlib import Path
import numpy as np
import textwrap
from io import StringIO
from collections import Counter
import ase
import ase.units
import ase.build
import ase.io
import torch
from nequip.data import AtomicDataDict, from_ase, compute_neighborlist_
fr... |
d7e9d8345c762f0bd2599621647dc24a6ff36ae19a8766462826d3a5d62fdd4e | Python | 12,912 | 277 | #!/usr/bin/env python3
"""Builds topology_preserving_rings.ipynb (run once; the .ipynb is committed)."""
import nbformat as nbf
nb = nbf.v4.new_notebook()
md = nbf.v4.new_markdown_cell
code = nbf.v4.new_code_cell
cells = []
cells.append(md(r"""# Topology-preserving ring melt simulations
This notebook shows how to ... |
1477f3f9d11ff0621a697a6d76e5d791b9c273bf37805ae9b1e3a8fef6050b8b | Python | 12,917 | 353 | """
The graph of traversed connections
"""
import numpy as np
import pandas as pd
import numba
from tctx.util import conn_check
from tctx.util.profiling import log_time
import collections
Binning = collections.namedtuple(
'Binning', # numba-friendly version of time-binning spikes
[
'tbins', # np.n... |
02925a0c06f315eb0c64519436396e1b24ae870b363a5ed44616c2095a5e8953 | Python | 12,920 | 510 | import logging
from collections.abc import Generator
from pathlib import Path
from typing import Any
import numpy as np
from ppqm import chembridge, constants
from ppqm.calculator import BaseCalculator
from ppqm.chembridge import Mol
from ppqm.utils import linesio, shell
_logger = logging.getLogger(__name__)
MNDO_C... |
fb2be53bec5bd2e58f3c6057e2fe074ca171f5e365ca2e6d41b3315ea6227868 | Python | 12,924 | 186 | """Exposure calibration of the path-traced CARLA layer against the neural scene.
The CARLA layer is lit from the probe (sun direction + panorama sky light), so the only free radiometric scalar
left is the sensor exposure: `sensor.camera.rt_lens` under `exposure_mode=manual` applies `exposure_compensation`
(EV) before ... |
867d08b9dd5254addb4070291086f5fc0890aa80b43c32ceecd54781dbf020bc | Python | 12,933 | 304 | import os,re
import sys
import shutil
import json, csv, glob
from tqdm import tqdm
import numpy as np
import random
from sklearn.model_selection import StratifiedShuffleSplit
sys.path.append("..")
def prepare_data_corpus(base_dir = '../FakeHealth'):
"""
This method reads all the individual JSON files of both... |
7fd5e26245bbf61312cd2b74b6e5b6e1625630e11f8c7e856a715c1074ab65e5 | Python | 12,949 | 356 | #!/usr/bin/env python
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Script that render multiple sensors in the same pygame window
By default... |
d63a5d0ff7c529b444514e565eb4f60805d21b36ea4730149bc267f7aaff66b2 | Python | 12,961 | 319 | ###################################################################
####
#### Version: 1.1.7
#### Date: 6/24/2023
#### Description: This file contains the class definitions for the i-step, synaptic and custom weight objects
#### Author: Evan Cobb
####
###################################################################
... |
c63940c09d45c37ed29ec8531f337ea85f70b890e679e2cfa88f0ac8381b19ae | Python | 12,977 | 426 | from abc import ABC, abstractmethod
import numpy as np
from typing import Literal
import torch
from torch import nn
from drugex import DEFAULT_GPUS, DEFAULT_DEVICE
from drugex.logs import logger
class ModelEvaluator(ABC):
"""
A simple function to score a model based on the generated molecules and input fra... |
d0efb3990c78d793f04ce55d96d41cbbb5314969b8dd01743008ac0b8d5a1feb | Python | 12,977 | 386 | #%% Load data
import networkx as nx
import numpy as np
import pandas as pd
from graspy.plot import degreeplot, edgeplot, gridplot, heatmap
from mpl_toolkits.axes_grid1 import make_axes_locatable
from src.data import load_networkx
from src.utils import meta_to_array, savefig
#%%
graph_type = "Gn"
graph = load_networ... |
99ae5352ebaed5e399e86325387354c29d7c8ae946d22cc97c47a70f245795fe | Python | 13,006 | 391 | import os
import torch
import clip
import argparse
import torch.nn.functional as F
import random
import numpy as np
import torch.nn as nn
from torch import optim
from tqdm import tqdm
from utils import differentiable_clip_preprocess_from_stylegan
from model.stylegan2.model import Generator
from dataset.celebahq impor... |
6c6789149fe1eae73cb40ee05f4b65bbb184ee2945bafb64407f342602ea03b1 | Python | 13,007 | 263 | from dash import Patch, ALL
from dash_extensions.enrich import Serverside, Output, Input, State, callback, ctx, no_update
from dash.exceptions import PreventUpdate
import numpy as np
import torch
import RV.constants as c
from RV.callbacks.utils.annotation_utils import get_annotation_label_radioitem, merge_annotations... |
fc5ecf627db0f4483c81563b4f88c5418da1afe418f4f5ea24bac895775e5d9d | Python | 13,011 | 378 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Variational Animal Motion Embedding 1.0-alpha Toolbox
© K. Luxem & P. Bauer, Department of Cellular Neuroscience
Leibniz Institute for Neurobiology, Magdeburg, Germany
https://github.com/LINCellularNeuroscience/VAME
Licensed under GNU General Public License v3.0
"""
... |
315127e53a1bbdd800893d03e7b6c3f902e7d0603b61419f64cab208d064e57d | Python | 13,017 | 403 | #!/usr/bin/env python3
from multiprocessing import Process
from multiprocessing import Queue
import argparse
import logging
import pickle
import shutil
import os
import sys
import time
import hashlib
import glob
import re
import gc
import uuid
import numpy as np
from tqdm import tqdm
import tempfile
import functools
... |
0520b059f3ea4391b4a2ca7b917a4e95222281687f3de4989ecf40b00c73f090 | Python | 13,024 | 238 | """Cosmos Transfer 2.5 ``auto/multiview`` worker (7-camera world scenario -> video).
The model runs context-parallel over the GPUs given to the worker (NVIDIA ships 7 views
on 8 GPUs; ``context_parallel_size`` is the number of ranks and independent of the number
of views — 1 GPU is just single-GPU inference). This wo... |
8524e2156a25aa561e57b639a2211e57ae2bce8a8b5e531d2a74d8b1f1084b82 | Python | 13,024 | 457 | #%% [markdown]
## Embedding graphs with covariates
# > Some experiments on a real dataset of interest using CASE and MASE
# - toc: true
# - badges: true
# - categories: [pedigo, graspologic]
# - hide: true
# - search_exclude: true
#%% [markdown]
### Preliminaries
#%%
# collapse
import os
from pathlib import Path
impo... |
6dc5fd2537caa5fc4fef8d4a358c7fc1c690a98ee5c2c7fa6ac323e9aae29c31 | Python | 13,029 | 332 | # 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... |
31b72fd93bf55c71592f7cb6966d4cee32b9e69a72409008cf6dc61f89488ed8 | Python | 13,030 | 264 | # MIT License
# Copyright (c) 2018 Philip Popien
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
fc78677df912812ed4e8702322046668bc3d92220b09dd7ebeb0e7a04c4977d6 | Python | 13,033 | 261 | import os.path
from datasets import load_file
from datasets import get_survival_y_true
from datasets.basic_dataset import BasicDataset
from util import preprocess
import numpy as np
import pandas as pd
import torch
class ABCDataset(BasicDataset):
"""
A dataset class for multi-omics dataset.
For gene expre... |
21e1d98d38b89bc89a48f12e87444f7073c42b9a52150b8e34cb7978e4c0649c | Python | 13,036 | 479 | # %%
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspy.cluster import AutoGMMCluster, GaussianCluster
from graspy.embed import AdjacencySpectralEmbed
from graspy.plot import pairplot
from graspy.utils import pass_to_ranks
from sk... |
0b23eccebae6f9031b881e7b38835c962d8d978eec61868355cece7bfd1aad5f | Python | 13,046 | 336 | #!/usr/bin/env python3
"""
File: plot_cell_fraction_per_cohort2.py
Created: 2021/11/29
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... |
ab4175c56ab7ddbef2da78e9d2472af7685828fafb500fdd83bfb8717781a0a4 | Python | 13,050 | 353 | import torch.nn as nn
import torch
import math
import torch.utils.model_zoo as model_zoo
from torchvision.ops import nms
from retinanet.utils import BasicBlock, Bottleneck, BBoxTransform, ClipBoxes
from retinanet.anchors import Anchors
from retinanet import losses
model_urls = {
'resnet18': 'https://download.pytor... |
ca661b2613add4853a6ad3f57466534cad9f48a5fa0700483e81405031f6985b | Python | 13,050 | 188 | """Add modeled construction detail to the reviewed surface master.
All additions are artist reconstructions, not manufacturer tooling geometry.
"""
import bpy,bmesh,math,json,os
import numpy as np
from pathlib import Path
from mathutils import Vector
P=Path(os.environ.get('CARLA_MODEL3_WORKDIR',Path(__file__).resolve()... |
e0ffc2ef6e10a7f05bd59c559660fbc19b0257c6b41720e114741e6384af6b99 | Python | 13,052 | 308 | #!/usr/bin/env python3
"""
File: compare_reference_profiles.py
Created: 2021/09/01
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 Sof... |
2bcc3f89fadfecd8a17dfe72e6afbcdb5b5c654329c80e7b1e1e882dbf477839 | Python | 13,056 | 339 | """Long statement strings and other space consuming data definitions for testing are declared here.
This is done to avoid clutter in main test files.
"""
from typing import Dict
from typing import List
from typing import Tuple
import pytest
from _pytest.fixtures import SubRequest
from fi_parliament_tools.parsing.dat... |
66cd4bdc435eda231f6e95ce37e8d1154c93cf2dcdabc6f4e91a40db3af0689f | Python | 13,067 | 248 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 25 14:25:48 2019
@author: RJovelin
"""
import time
from debarcer.version import __version__
def GetConsData(consfile):
'''
(str) -> dict
:param consfile: Path to the consensus file (merged or not)
Returns a dictionary with consensus fil... |
f961210711a8381d6c30ff53585ec3b26523cc88436a06a22eccafc65f156151 | Python | 13,076 | 266 | #!/usr/bin/env python
from locale import D_FMT
import os
import os.path
from pyexpat import model
import sys
import json
import random
import optuna
import argparse
import numpy as np
import pandas as pd
from xgboost import XGBRegressor, XGBClassifier
import torch
from sklearn.ensemble import RandomForestClassifier... |
b5924733a5a50743cc4f7f5190b5d923eb314bbd5d9dafcbbfcbd970a8104795 | Python | 13,077 | 451 | # IMPORT MODULES
from __future__ import division
import pickle
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
# CREATE MiniDetector CLASS
class MiniDetector(object):
"""Class for detecting mEPSCs or mIPSCs in Recording objects or similar arrays.
"""
def __init__(
... |
591dafc231770376da17b21820e9a43f4f3aa679efa7ad2054b1e8b0d7725a7b | Python | 13,088 | 386 | from __future__ import print_function
import os
import sys
import re
import fnmatch
import argparse
# avoid Python>3 rewrite newline on different platforms
os.linesep = "\n"
EXCLUDE_FILES = ['kenlm.h', 'kenlm.cc', 'kenlm-test.cc']
# earily parse, will refernece args globally
parser = argparse.ArgumentParser()
parser... |
0b6c3bda249439312983a6ee79ea3947461137dc48b337cbe1e04adc4b9acbaf | Python | 13,090 | 323 | #!/usr/bin/env python
"""Imports and registers props from inside UE4Editor. Not an entry point.
Run by ../import_prop.py, never by hand:
UE4Editor CarlaUE4.uproject -run=pythonscript -Script="<this file>"
The job description is read from the file named by $CARLA_PROP_SPEC. Arguments
go through the environment ra... |
63147fa3d2b5ad38f7d2fcc3018e368e93e608a3316164ddeeb3c55c05dc935f | Python | 13,090 | 261 | ####################################################################################################
# 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 ... |
83d6e87b10e1fdaec31d0b1d9d05202cc0d21992eed5486e2fc028439946495c | Python | 13,091 | 350 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
##################### IMPORTS #######################
import os
import sys
from keras.models import model_from_json
from matplotlib import pyplot as plt
import numpy as np
from keras.callbacks import ModelCheckpoint
from rdkit.Chem.Draw import IPythonConsole
import os,... |
69f401db56b50ebaf9475fd06b43551cf6ed3682efc59e2662e66d709473d837 | Python | 13,092 | 412 | #%% 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/... |
8c680a9bc893d912b1358ba4520e05079f4b0ac673698cc8f6066501c73c9ee1 | Python | 13,096 | 329 | from abc import abstractmethod
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init
from mmdet.core import force_fp32, multi_apply
from ..builder import HEADS, build_loss
from .base_dense_head import BaseDenseHead
@HEADS.register_module()
class AnchorFreeHead(BaseDens... |
91197b0362671a2fdbae4932c570b33a60ba328b3b40f32944bc00762b2a64ee | Python | 13,098 | 257 | import os
import subprocess
from debarcer.utilities import CheckRegionFormat, CheckJobs
import uuid
def ExtractRegions(bedfile):
'''
(str) -> list
:param bedfile: Path to bedfile. Positions are 1-based included
Returns a list of regions extracted from the bed file
Precondition: The 1st 3... |
a000e636959c4e5fc77f323e3667a42b254b3ed83230c97add4432412a56d45a | Python | 13,100 | 343 | import numpy as np
import torch
from torch.nn.functional import one_hot
from torch.nn import (Module, Sequential, Conv1d, LeakyReLU, Linear,
ModuleDict, ModuleList, GroupNorm, AvgPool1d, Identity,
LogSoftmax, GRU, Dropout)
class ResBlock(Module):
def __init__(self, in_fe... |
d57423ebf0d966e6dd41444812f67061e792418fdac35d48360d99e0991e9859 | Python | 13,100 | 320 | from operator import itemgetter
from pathlib import Path
import pickle
import os
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
import community as community_louvain
from sklearn.metrics import adjusted_rand_score
from brainNetwork.util import util, path
d... |
03ddd58ddb4a52e1de550f01e86c1c9a21ed56c56e85b5dd7c541f594f0a0b83 | Python | 13,102 | 329 | import numpy as np
from scipy import interpolate
import pylab as pl
import pandas as pd
import os
from tensorflow import keras
import numpy
import matplotlib.pyplot as plt
import time
from sklearn.preprocessing import MinMaxScaler
import math
from sklearn.metrics import mean_squared_error
from tensorflow.keras.models... |
df9e4a992d23394e18c89b6f35679147caebca4f43569030f2176a6728e84ef7 | Python | 13,105 | 334 | from PrognosAIs.Model.Architectures.UNet import Unet
from tensorflow.keras.layers import Concatenate, BatchNormalization, Conv3D, GlobalAveragePooling3D, Dense, Activation, ReLU, Conv3DTranspose, GlobalMaxPool3D
from tensorflow.keras import Model, Input
import tensorflow as tf
import tensorflow_addons as tfa
import num... |
b9dc95c58cfb0da5dab52b276c6410896ecb9e4a848bb97db6b29b53d47d4600 | Python | 13,106 | 327 | """Modified from https://github.com/pytorch/pytorch."""
import numpy as np
import torch
from torch.nn.modules.utils import _pair, _single, _triple
from torch.onnx.symbolic_helper import parse_args
from torch.onnx.symbolic_registry import register_op
from .onnx_utils import symbolic_helper as sym_help
def _interpolat... |
002a81dd35a61de022ea46b2aa36df49a6ac6d296eb1e00d19f7f03ac1847160 | Python | 13,112 | 267 | # 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... |
ebbb09ae765294579a5a08dc6539cb47a56c21d62f50b78fe4efaf9946e5ab8a | Python | 13,116 | 384 | import numpy as np
from scipy.stats import unitary_group
import scipy.sparse as sp
from pydantic.dataclasses import dataclass
import jax.numpy as jnp
from typing import Tuple, Union, Optional
from copy import deepcopy
import xarray as xr
from scipy.special import beta as beta_func
from .typing import List, Callable, ... |
c5569e0bd9d78f7c090963d9deab323a43b2892769068a0234ecd4fe2740238d | Python | 13,128 | 281 | #!/usr/bin/env python3
"""Turn a scenario spec into a valid .scenic file, then prove it constructs.
The natural-language -> spec step is the agent's job; this script owns the part
that must be exact: the boilerplate, the placement idioms, and the validation
loop. Every emitted idiom is lifted from a scenario that runs... |
add2070b3da6ccc6811ffa58d72a6c2207e7de83be19cef04b2de99b0cd67ed2 | Python | 13,136 | 315 | #!/usr/bin/env python3
"""
This script groups fasta reads by their length, and output them as new files.
Although being first developed as processing only fasta files, it can take in
fastq files as well, but the final output will always be a fasta file.
Usage:
python group-fasta-readlen.py reads.fasta
"""
import ar... |
19d1a8cd8f0dc5fce0153396e860c16299bc71c90fcfcde610da31cd779df624 | Python | 13,138 | 297 | #!/usr/bin/env python3
"""Show-only render mode check for the scene-capture cameras.
Spawns a vehicle in front of a fixed camera pose and captures, in the same
tick:
ref plain rgb + semantic (everything)
cars rgb + semantic + depth with show_only_tags=Car and
shadow_catcher_tags=Roads,Si... |
c9ce81f9362874aee1d527de762faee15457e5b1a4025792e0e0c3fe7aee1bd0 | Python | 13,150 | 312 | # This script is part of navis (http://www.github.com/navis-org/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... |
52c406aa85739c88a135856b4d61c80208e7d5096cfb7a7a7a0111ffd3cfcd5d | Python | 13,156 | 240 | #%%
from pymaid_creds import url, name, password, token
from data_settings import pairs_path, data_date
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
# allows text to be editable in Illustrator
plt.rc... |
7bab41e5269433c3d16824d43e6a5848f10b0c7364f7f0e43e9681dcd62c5b84 | Python | 13,157 | 357 | # Copyright (c) Open-MMLab. All rights reserved.
import os
import os.path as osp
import pkgutil
import time
import warnings
from collections import OrderedDict
from importlib import import_module
import torch
import torchvision
from torch.optim import Optimizer
from torch.utils import model_zoo
import mmcv
from ..fil... |
54f9999871a78315fe6f7b397d87e8122be650663353ab3f602f0d3fa5c03d05 | Python | 13,159 | 259 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import connectome_tools.celltype as ct
import connectome_tools.process_graph as pg
import connectom... |
df30ed0e7f44d94529de14e54bacdbeb1189f002ef191d8206ab40250682c32f | Python | 13,167 | 396 | #!/usr/bin/env python
"""
Creates a frame with a toolbar and graph for plotting
"""
import os
import pdb
import sys
import getopt
import optparse
import wx
from optparse import OptionParser
# Used to guarantee to use at least Wx2.8
# import wxversion
# wxversion.ensureMinimal('2.8')
import matpl... |
9eb6a0626b591009e9571e6dafe71e60b3b06319868980a87bb3dd700e4e5b9f | Python | 13,180 | 265 | from typing import List, Union, Tuple
from functools import reduce
import numpy as np
from rdkit import Chem
import torch
import torch.nn as nn
from chemprop.args import TrainArgs
from chemprop.features import BatchMolGraph, get_atom_fdim, get_bond_fdim, mol2graph
from chemprop.nn_utils import index_select_ND
from c... |
ccdbef57c9fad6b890fa5f1093670d3629ac771a94f479840f2047653c059f90 | Python | 13,180 | 317 | # 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... |
32b287640f65bda0cae58d500e7fb798e709d9fdde7f4afb126ed8a4e822610c | Python | 13,197 | 338 | import numpy as np
import scipy.special as special
from collections import namedtuple
from scipy.stats import chi2
def chisquare(f_obs, f_exp=None, ddof=0, axis=0):
"""
This is the chisquare function of scipy 1.5.2.
Reference: https://github.com/scipy/scipy/issues/13362
Calculate a one-way chi-squa... |
fe629bf6304fd991315c9a822d51813a80384e0db15cf404a220129552f19432 | Python | 13,199 | 358 | import numpy as np
import logging
from time import time
import dipy.tracking.streamline as dts
from dipy.utils.parallel import paramap
from dipy.segment.clustering import QuickBundles
from dipy.segment.metricspeed import AveragePointwiseEuclideanMetric
from dipy.segment.featurespeed import ResampleFeature
from dipy.io... |
ecd0b4380e027a37b13db1e34aea92a1f3f5334dcda8d5a9af8315bfff911819 | Python | 13,203 | 353 | ## System
import os
import gc
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... |
40ce25896f46da598f2229c9071770ec546d10e4872eaf868ae71fd3961dc722 | Python | 13,206 | 398 | ####################################################################################################
# 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 ... |
ffa6e12431895f0c664a0b43bf05bfe5de22609674e9fe205e63fcb79b63ee31 | Python | 13,217 | 419 | #!/usr/bin/env python
"""
runtests.py [OPTIONS] [-- ARGS]
Run tests, building the project first.
Examples::
$ python runtests.py
$ python runtests.py -s {SAMPLE_SUBMODULE}
$ python runtests.py -t {SAMPLE_TEST}
$ python runtests.py --ipython
$ python runtests.py --python somescript.py
$ python... |
76ac3c021ff1fff77123dbe2ecb290fd470f358f7e8ee92fae7d60d17412e1fa | Python | 13,224 | 307 | import re
import numpy as np
import pandas as pd
import torch
from rdkit import Chem
from drugex.data.corpus.interfaces import SequenceVocabulary, Vocabulary
from drugex.logs import logger
from drugex.molecules.converters.standardizers import CleanSMILES
class VocSmiles(SequenceVocabulary):
"""The class for han... |
19bc614e257ebc873b12a82f2426a9ca3e208879273fe4401e280407283c3510 | Python | 13,233 | 325 | # -*- coding: utf-8 -*-
"""
Variational Animal Motion Embedding 0.1 Toolbox
© K. Luxem & P. Bauer, Department of Cellular Neuroscience
Leibniz Institute for Neurobiology, Magdeburg, Germany
https://github.com/LINCellularNeuroscience/VAME
Licensed under GNU General Public License v3.0
The Model is partially adapted fr... |
840b7868e1cb1bd5ef4582ea6f0eefda5d507527f9582a5d8070e96b75bcdd63 | Python | 13,234 | 325 | #####################################################################
# Dependencies
#####################################################################
# Default packages
from visualize import plot
from models.lstm import basic_lstm
from models.lstm_ae import lstm_autoencoder
from models import lstm_vae, cnn_vae
fr... |
853e3544f462d1565a8a037532700032c26643b0be65cf1db761983b4311ec7d | Python | 13,234 | 388 | from PIL import Image
import torchvision.transforms as transforms
from symspellpy.symspellpy import SymSpell, Verbosity
import csv
import time
from pycocotools.coco import COCO
import torch
import numpy as np
import nltk
import string
import spacy
data_dir = "data/preprocess/"
data_type = "val2014"
coco = COCO("{}/ann... |
a8a5cdb1afaa981ce5c76b5f7037e7dfae7daf4c21923e99d9eb6031cf67e6a7 | Python | 13,235 | 445 | import allel
import numpy as np
import pandas as pd
from pybedtools import BedTool
from SVRecords import SVAnnotator
from pathlib import Path
from datetime import date
# based on Dennis Kao's SVGrouper module: https://github.com/ccmbioinfo/crg/blob/master/SVRecords/SVGrouper.py
sv_counts = [snakemake.params.mssng_man... |
11734581b4312e4ca3a7305bea76284eede35b330eb050ce021ddd5a5aa39d1e | Python | 13,241 | 428 | import os
import platform
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from toolz import merge
from os.path import join
from collections import namedtuple
COLORS = {
"green": (0.21647058823529414, 0.64, 0.28),
"gray": (0.5077342149936128, 0.5077349468656874, 0.5077399378226443)
}
... |
f3e1caadb26bf11b15e24b65e3a2872c5943285e10b73d7739930be2f32a9d0e | Python | 13,241 | 312 | """
Copyright 2020 - by Jerome Tubiana (jertubiana@gmail.com)
All rights reserved
Permission is granted for anyone to copy, use, or modify this
software for any uncommercial purposes, provided this copyright
notice is retained, and note is made of any changes that have
been made. This softwar... |
ee327adcbdb0b11a50dee80e5f41e05c1643a8c25ab7789f5a716d99b2c9a8e4 | Python | 13,244 | 300 | from typing import List, Union
from functools import reduce
import numpy as np
from rdkit import Chem
import torch
import torch.nn as nn
from .attention import MultiBondAttention, MultiBondFastAttention, MultiAtomAttention, SublayerConnection
from chemprop.args import TrainArgs
from chemprop.features import BatchMolG... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.