sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8cbded019ac2ee8437effa0877fa4fdf3de0763f61dd16a0c90f247cd68259e5 | Python | 3,109 | 115 | from __future__ import print_function
import argparse
import os
from time import time as t
import ANNarchy
import numpy as np
import pandas as pd
plots_path = os.path.join("..", "..", "figures")
benchmark_path = os.path.join("..", "..", "benchmark")
if not os.path.isdir(benchmark_path):
os.makedirs(benchmark_pat... |
35b10f6e8d4d61a6035184dc6264a71d080497501af9bcb8ba93a6716258bd15 | Python | 3,114 | 109 | import numpy as numx
import pydeep.base.numpyextension as numxExt
from pydeep.base.activationfunction import Sigmoid
import pydeep.misc.visualization as VIS
import pydeep.misc.io as IO
from scipy.signal import convolve2d
from pydeep.dbm.unit_layer import *
from pydeep.dbm.weight_layer import *
from pydeep.dbm.model imp... |
6b6fa514077f7cdf57547e4a1accf7bdecb2fc1de6882aa6e4073a977f048a0c | Python | 3,115 | 105 |
import pandas as pd
import numpy as np
import os
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import *
class cnn3d(nn.Module):
def __init__(self):
super(cnn3d, self).__init__()
self.conv1 = self._conv_layer_set(1, 16)
... |
3c54e5eeb60adcddb8c3b276c59338146acd6b2b8cc06f6106af86162beb9527 | Python | 3,116 | 79 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import numpy.ma
import Stats
import Histogram
import cpgReport
from cgatReport.Tracker import *
from cgatReport.odict import OrderedDict as odict
##################################################################... |
7278158654ce258159c31b662bb6597c4624bbf0772525ae5fd23577b8875b50 | Python | 3,116 | 104 |
import pathlib
import datajoint as dj
import os
import json
import numpy as np
import proplot as pplt
from .datajoint_attributes import pickletype
pplt.rc.update({
'tick.minor': False,
'grid': False,
'label.size': 'small',
'axes.alpha': 0.0,
'tick.labelsize': 'x-small',
'meta.linewidth': 1... |
e145e0162204581a0237ce8392f730c24cf3ee71862c51992fa9695f48e06b4a | Python | 3,117 | 87 | """Tests for model profile types and utilities."""
import warnings
from typing import Any
from unittest.mock import patch
from pydantic import BaseModel, ConfigDict, Field
from langchain_core.language_models.model_profile import (
ModelProfile,
_warn_unknown_profile_keys,
)
class TestModelProfileExtraAllow... |
40b2fbca0f10aa9cdc341ef4335d4df21bdf57b8675a3cf5ad832db214c7c936 | Python | 3,120 | 109 | #!/usr/bin/env python3
"""
Pool/Combine one or more labels within an integer atlas volume
Usage
----
pool_labels.py <input label image> <output label image> <input label numbers> <output label number>
pool_labels.py -h
Example
----
>>> pool_labels.py atlas.nii.gz atlas_1.nii.gz 1 12 13 14
Authors
----
Mike Tyszka, C... |
7cf6c410d18bb87dce9ee15ff1cc93b21d9d40b666e50b5dc4b3191d789f8357 | Python | 3,120 | 92 | import matplotlib.pyplot as plt
import numpy as np
from dliplib.utils.helper import set_use_latex
plt.style.use('seaborn-whitegrid')
set_use_latex()
sizes = [0.0001, 0.001, 0.01, 0.10, 1.00]
ticks = range(len(sizes))
# performance on the different data sizes
learnedgd = {'PSNR [db]': [29.87, 31.28, 31.83, 32.7, 32... |
de2e0e9a66c49fc88c6b64717bb00377c5591d0a65c12b09d9da09bc8df976e9 | Python | 3,121 | 93 | import matplotlib.pyplot as plt
import numpy as np
from dliplib.utils.helper import set_use_latex
plt.style.use('seaborn-whitegrid')
set_use_latex()
sizes = [0.0001, 0.001, 0.01, 0.10, 1.00]
ticks = range(len(sizes))
# performance on the different data sizes
# psnr: 34.67, ssim: 0.8171
# psnr: 34.55, ssim: 0.815
... |
705791cf7cb20200ea8012234b5b6fea722ff1ef822a85d743be5fadfeea10f6 | Python | 3,122 | 78 | # Random Forest modelling of mental flexibility based on Yeo Network data
# load the data - network data and behavioural data
import pandas as pd
network_data = pd.read_csv(r'D:\Neuro\Random_Forest_Marco\Scripting\network_data_yeo17_167pat.csv')
behav_data = pd.read_csv(r'D:\Neuro\Random_Forest_Marco\Scripting... |
071109f0fca123b47c50d4ba92e8704731d4190be20945263e8c77fae675c156 | Python | 3,123 | 111 | #!/usr/bin/env python3
# pylint: disable=line-too-long
'''
Miscellaneous functions that dont necessarily belong anywhere but are still useful
'''
import logging
import subprocess
from itertools import islice
def list_splitter(input_list, chunk_number, chunk_max):
"""
An iterator that separates a list into a nu... |
32a0ee144d22a94b3503bdfd846562d32e4ce310cb084772f6cfe9014dfbf37e | Python | 3,123 | 82 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 7 18:10:46 2022
@author: vandadim
# This script loads a dataset from a CSV file, where the last column is assumed to be the dependent
variable (Y) and the other columns are assumed to be independent variables (X).
# The path to the data file is specified by Data... |
79fdc41b5b22ff61084ea4c286cfd00fd17ec659e30a86748ab630c7c13bd79b | Python | 3,125 | 112 | """
Unpacks pretrained (feature-extractor) darknet-53 weights into checkpoints. Checkpoint files can then be
loaded into the YOLOv3 model for training with transfer learning
Modified version from original YOLOv3 implementation, replacing absl.flags (not a fan!) with
argparse for interfacing with command-line argument... |
8070ff921fd9ba016b87ebdb6e71ccc690719a5d23987106905a47aa4555fb0f | Python | 3,126 | 112 | #!/usr/bin/env python3
"""
Simple intensity clustering segmentation of 3D grayscale image
Usage
----
segment.py -i <Grayscale Nifti image> -o <Segmentation image> [-n segments] [-m kmeans]
Authors
----
Mike Tyszka, Caltech Brain Imaging Center
Dates
----
2016-04-24 JMT From scratch
License
----
This file is part of... |
0f61a81b618f260694f178cbf8f04f6ee6532700fefbfd68bb48b4ee940c3ba4 | Python | 3,127 | 102 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
934a9ea08fd69cee1a9d52124910216e0b2709f6194490310bc1b050613a5ebc | Python | 3,129 | 73 | """Unsupervised DeepMapper: imagify, train a convolutional VAE on reconstruction + KL (no labels),
return the latent embedding. The label-free counterpart to the supervised runner, kept as a first-class
provision so the standard-pipeline comparison can be run unsupervised-vs-unsupervised.
from pydeepmapper.unsuper... |
a24f862079ff51dd109f9b64d4a4d79b8b1ab9e4c4685e5675622e2f50c70ce5 | Python | 3,131 | 88 | import os
import pandas as pd
import random
import cv2
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import yaml
from PIL import Image, ImageDraw, ImageFont
from scipy.signal import butter, filtfilt
def xywhn2xyxy(x, w=640, h=640, padw=0, padh=0):
... |
464de7941d72cc17dad18fdcd49c399e6fca0ba373a15056dc3dad3b0747373e | Python | 3,133 | 106 | import pandas as pd
import pathlib
import yaml
import argparse
import tempfile
import tqdm.auto as tqdm
import subprocess
from typing import Optional
def run_gofigure(data, commandlineargs, outputdir):
if len(data) == 0:
return None
name = data.name
if not isinstance(name, str):
name = "_"... |
65f880a006884a5d9eafc0440408c0265d7934b86ec34bc291fc49e37521d255 | Python | 3,133 | 100 | import torch
import torch.nn as nn
import torch.nn.functional as F
class FC3DDiscriminator(nn.Module):
def __init__(self, num_classes, ndf=64, n_channel=1):
super(FC3DDiscriminator, self).__init__()
# downsample 16
self.conv0 = nn.Conv3d(
num_classes, ndf, kernel_size=4, strid... |
dbb08882ffa4a25e616c539c6ff31c246bb09d041bcfe325000d6527e99091a5 | Python | 3,133 | 96 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
import numpy as np
import torch
import torch.nn as nn
from torch.nn.functional import relu
import lib.utils as utils
from lib.encoder_decoder import *
from lib.likelihood_eval import *
f... |
5bab82c80d8652cc0a76d8ea150779b8e80f56a52131114e4a3c123ec7c1eb64 | Python | 3,137 | 84 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 16:26:06 2020
@author: gritti
"""
import os, tqdm, glob
from skimage.io import imread, imsave
import numpy as np
import scipy.ndimage as ndi
import multiprocessing
from itertools import repeat
from morgana.DatasetTools import io as ioDT
import morgana.DatasetTools.mul... |
82629de8a003aeb14158156693ec8b4432f4860cf66e4a86d303b2f502cd35c8 | Python | 3,137 | 82 | # 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 --------------------------------------------------------------
... |
2269ec7e9892e41f3595e6fedeb09ef97271cd8399d5c196056fb6134ef6a5ff | Python | 3,138 | 84 |
from .context import singlesample as s
import unittest, os, subprocess
HERE = os.path.dirname(__file__)
in_vcf = os.path.join(HERE, "data/example.vcf")
in_bam = os.path.join(HERE, "data/NA12878.target_loci.sorted.bam")
lib_info_json = os.path.join(HERE, "data/NA12878.bam.json")
out_vcf = os.path.join(HERE, "data/out.... |
501b24feff52fc8cedbcb615d95d31036456e7bf723972abb33f34f9aa8a0a21 | Python | 3,138 | 91 | import json
import pytest
from langchain_core.agents import AgentFinish
from langchain_core.exceptions import OutputParserException
from langchain_core.messages import AIMessage, SystemMessage
from langchain_classic.agents.openai_functions_multi_agent.base import (
_FunctionsAgentAction,
_parse_ai_message,
)
... |
098e02602ad6b28e00d5e9c3a76f197161207545f26ec772de0984ce0a5d4a65 | Python | 3,139 | 117 | import pandas
from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField
from openff.toolkit.typing.engines.smirnoff.parameters import (
ConstraintHandler,
ElectrostaticsHandler,
LibraryChargeHandler,
vdWHandler,
)
from openff.units import unit
from packaging import version
VERSION = vers... |
8c60b005ec21153ea24a7524e6feb6fd49c380cf497a16ad93ea1f79274286fa | Python | 3,143 | 76 | # third party packages
import numpy as np
def getVectorAngle(v1, v2):
return np.arctan2(np.linalg.norm(np.cross(v1, v2, axis=1), axis=1), (v1 * v2).sum(axis=1))
def getPPFeatures(mesh, edge_index, edge_attr=None):
# vertex indices of each edge
v1 = edge_index[:,0]
v2 = edge_index[:,1]
# vecto... |
dbb94788c5022704f4437936e0de2bbb72f40c775b5a0c65b5bf3d3908fec0ab | Python | 3,143 | 91 | import pymeshlab
import numpy as np
from pathlib import Path
from rich.progress import track
def find_neighbor(faces, faces_contain_this_vertex, vf1, vf2, except_face):
for i in (faces_contain_this_vertex[vf1] & faces_contain_this_vertex[vf2]):
if i != except_face:
face = faces[i].tolist()
... |
fa3ac966436dab6422e25334e303498c19340c947ffc007f2dd92f4d6a5da676 | Python | 3,143 | 99 | """
tests for acquisition hooks, image processors, image_saved functions, etc
"""
import numpy as np
from pycromanager import Acquisition, multi_d_acquisition_events
def test_img_process_fn(launch_mm_headless, setup_data_folder):
events = multi_d_acquisition_events(num_time_points=3)
def image_proc_fn(image,... |
091923339cbada32b765abf53280b9201d08489adec444233994fc9c53e02637 | Python | 3,144 | 89 | from __future__ import print_function
import argparse
import sys # for commanad line
import os # for file paths
import re
import itertools
import cPickle as pickle
import numpy as np
import rdkit.Chem as Chem
from rdkit.Chem import Draw
np.random.seed(101) # arbitary, but fixed
def main():
'''Read reactions'... |
f289a8a1f79a92ca4a7e3dbd3a07b5f99d5eb2624e973ec3f0e55a5e334090a5 | Python | 3,144 | 86 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
a5bbafcd53cd45773e879de867cc94181c3c0314347c75fd8e824d0b2aa0b5b3 | Python | 3,145 | 87 | """This module defines functions for loading parameter handler and parser classes which
have been registered through the `entrypoint plugin system <https://packaging.python.
org/guides/creating-and-discovering-plugins/#using-package-metadata>`_.
Currently only ``ParameterHandler`` classes can be registered via the plu... |
ed59d09f363b81261d9d801cca17d4bd00a0ec9b67a3e5dbee5eb5b465c01bc3 | Python | 3,145 | 81 | from collections.abc import Sequence
from inspect import signature
from langchain_core.callbacks import Callbacks
from langchain_core.documents import (
BaseDocumentCompressor,
BaseDocumentTransformer,
Document,
)
from pydantic import ConfigDict
class DocumentCompressorPipeline(BaseDocumentCompressor):
... |
fe3c29f007aba98cb55f19db4f5a73a257b43917d785138982a232c897f282c2 | Python | 3,145 | 99 | #Code base from https://github.com/aravindsiv/dan_qa
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.utils import to_categorical
import pickle as pkl
import numpy as np
class PreProcessor:
def __init__(self,INPUT_FILE,WE_FILE):
self.input_file = INP... |
ea4b5fe735fe01f877547d810902e3be184fb8aeeabc965ac94c6840aab47a7e | Python | 3,148 | 65 | """All-non-coding chord on GSE99254 using a GENCODE biotype-defined lncRNA set (Reviewer B/R4.2), instead
of the symbol regex. Confirms whether the antisense/chord result holds under a proper annotation.
Run: conda run -n deepmapper python bench/ncrna_chord_biotype.py
Out: results/attribution_de/ncrna_chord_biotype.js... |
eae655d542cf970bb98a4fa9ca1eec545507f07baeb7b3b47bae95cd46a3c220 | Python | 3,148 | 103 | import logging
import typing
import numpy as np
"""
Revision History:
2023: Created
Amulya Jain, 2023
The Open-Source Electrophysiological Toolbox
https://github.com/alphanumericslab/OSET
"""
def compare_number_arrays(
python: typing.Iterable,
matlab: typing.Iterable,
round_... |
9e1f7fb8ac9843246155648ce596e567793b15e20e10797ec19b500e312d3f0c | Python | 3,150 | 93 | from __future__ import annotations
from collections.abc import Sequence
from typing import Any
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_cor... |
afd2013a535d12c45c0453df3dd98d90ce5da44dd239f7d3b33f0d6034007dab | Python | 3,150 | 98 | import uncertainpy as un
import numpy as np
import matplotlib.pyplot as plt
from prettyplot import *
import os
### FIGURE4 ###
data = un.Data()
data.load(filename='../data/simulation_outputs/UQSA_physiological/phi_msn_5/phi_msn.h5')
sobol_1_nap = data['nr_spikes']['sobol_first']
sobol_tot_nap = data['nr_spikes']['sob... |
fe645e980a7c21ee69bdb682444ed3fa6d89a904170812f72632dfd264797ff8 | Python | 3,150 | 89 | import os
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from tensorflow.keras.utils import Sequence
class EnsembleModels():
'''
To load all ensembled Sinc models.
Note that it is not a keras model, but it has a predict funtion with similar inputs/outputs.
Parameters:
=======... |
0aec4794ad99bf3ed1655e1fd0cc54c8b6945aa7c3143cf56184fc365793ee49 | Python | 3,151 | 82 | import os
from nltk.tag.stanford import StanfordPOSTagger
import re
class POSTagger():
def __init__(self,
stanford_postagger_model=None,
wapiti_postagger_model=None,
jar_tagger_path=None,
jdk_variable_path="C:/Program Files/Java/jdk1.8.0_121/bin/j... |
79d1a14abb8e4bb5c27fec8bef479ec3012cc1070a7726cd46fb1c9ce7b256c4 | Python | 3,152 | 74 |
import numpy as numx
import pydeep.fnn.model as MODEL
import pydeep.fnn.layer as LAYER
import pydeep.fnn.trainer as TRAINER
import pydeep.base.activationfunction as ACT
import pydeep.base.costfunction as COST
import pydeep.base.corruptor as CORR
import pydeep.misc.io as IO
import pydeep.base.numpyextension as npExt
... |
ceb02d9c81832ba31ce912ca7c514d4f742666fdfbfe021e0730643f6984421b | Python | 3,153 | 77 | import sys
import os
import numpy as np
import torch
import torch.utils.data as du
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import util
from util import *
from DrugGene_Network import *
import argparse
from sklearn.preprocessing import MinMaxScaler
def predict_drugCell... |
af119a2b0ce775b017eb09c30b3da81c61059732e89b9ed6d1621f460d97d44c | Python | 3,156 | 75 | """Test device switching for networks."""
import pytest
import torch
from torch.utils.data import DataLoader, Subset
from vulcanai.models import ConvNet, DenseNet
from vulcanai.models.utils import master_device_setter
TEST_CUDA = torch.cuda.is_available()
TEST_MULTIGPU = TEST_CUDA and torch.cuda.device_cou... |
1029e668cf38a52aa515b88fd0e0393a58c59b5f778530f7e9670bd427cfbf8c | Python | 3,157 | 127 | import shutil
from pathlib import Path
from datetime import datetime
import glob
from mako.template import Template
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
import pandas... |
19392702a90cf541ebe73ae5a3afdbafebd23eec85dde061413e95cda1b31c85 | Python | 3,158 | 89 | from __future__ import annotations
from typing import List
import numpy as np
from libs.common.metrics import Metrics
from libs.function.utils import sparse_matrix
from libs.utils.generator import Generator
def simple_cross(graphA: np.ndarray, graphB: np.ndarray, window: int, overwrap: int) -> np.ndarray:
chil... |
9f145aee73257b43b8b6669bfbab91600ec1e20e147705b67f0e69787cd1136e | Python | 3,159 | 88 | # Copyright (c) Meta Platforms, Inc. and 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.
_base_ = [
'../_base_/models/mask_rcnn_convnext_fpn.py',
'../_base_/datasets/coco_instance.py',
'../_base_/s... |
f66113b43096660ce6ffe782541f2e7af8cd388de4fb8b0486943707f13cce91 | Python | 3,159 | 88 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# U... |
49563ac99e06304474958619fb8915e71e5c8116dc52733c170fe39b1d3c368f | Python | 3,160 | 61 | #TO BE UPDATED
from NeuronModel.NeuronClass import neuronClass
import numpy as np
#normal
#parameters = {'spike': True, 'tau': 10, 'R': 10, 'u_rest': -65, 'v_rh': -50, 'u_r': -70, 'Delta_T' : 1. , 'Delta_abs': 3., 'theta_reset' : 0, 'a':1., 'tau_w' : 100, 'b':1.}
#tonic
#parameters = {'spike': True, 'tau': 20, 'R': 0... |
574d4a40b6aca38305188fb66c613faa56a53d8780061c7fed08bad9be453125 | Python | 3,162 | 86 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
bd870fef7b71decc386169c0d49bd5e20d4ec50db41b9d0a5e5cb3dfd9d4587d | Python | 3,163 | 59 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
61eebc5603866a51cd9e70298fb091830ab2253aaa70c2678a43c69bdc983931 | Python | 3,164 | 92 | from torch import nn, Tensor
from typing import Tuple, Optional
import numpy as np
import torch
try:
import sympy as sym
except ImportError:
sym = None
class RBFExpansion(nn.Module):
"""Expand interatomic distances with radial basis functions."""
def __init__(
self,
vmin: fl... |
ae03d9fff0847783aca498b3fa532a6809d8de8e29df604f45bb2479cef0b709 | Python | 3,164 | 105 | import numpy as np
import steps.interface
from steps.geom import *
from steps.model import *
from steps.rng import *
from steps.saving import *
from steps.sim import *
from . import DiffPoint, DiffTubeInflux
########################################################################
# Two separated reactants diffuse tow... |
7dacdd58766dc6ccab6c7c4a711ba91e2590a0b8ab27158657a401a8db94f125 | Python | 3,165 | 103 | import abc
import torch
from .misc import _handle_unused_kwargs
class AdaptiveStepsizeODESolver(metaclass=abc.ABCMeta):
def __init__(self, dtype, y0, norm, **unused_kwargs):
_handle_unused_kwargs(self, unused_kwargs)
del unused_kwargs
self.y0 = y0
self.dtype = dtype
self.... |
88e8bc8a09f883732e813bce88b295dfe9d430bd4bba2f5cff0cc0fabf7cc007 | Python | 3,165 | 74 | # Copyright 2024 Eelke Spaak, Donders Institute.
# See https://github.com/Spaak/rift-phase-and-visibility for readme/license.
# Belongs with:
# Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension
# to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscience,... |
959cad6ff4f4ff15cbd7532f7fb15a214d0cf3c7ba8ef7721d7660bcf0fb4925 | Python | 3,165 | 89 | # Copyright 2022 DeepMind Technologies Limited.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
69d7446ba1f943c972cd8823537ad1f7e9e057c3c85b523d4a3d184b8a4fbade | Python | 3,167 | 114 | import os
import pdb
import copy
sets=[
{'folder':r'M:\BM\AndreasRoschger\FM-TH-OPTIMIERUNG\FM04C-A01\FM04C-A01-fluo','zmin':59,'zmax':200},
{'folder':r'M:\BM\AndreasRoschger\FM-TH-OPTIMIERUNG\FM04C-A05\FM04C-A05-fluo','zmin':40,'zmax':160},
{'folder':r'M:\BM\AndreasRoschger\FM-TH-OPTIMIERUNG\FM38-A01\FM38-A1-fluo','z... |
6bf930396ee41c3a280a369f24292130e4868aa2ed6ad94715e087e24b381ef8 | Python | 3,167 | 73 | """ Statistic Module comprises all statistical tests performed
by OmicScope for differential expression analysis.
Returns:
DataFrame: DataFrame with recommended statistical
analysis performed
"""
from copy import copy
import numpy as np
def imported_stat(self, statistics):
""" If user hav... |
9eda0ecfb39f64b6894eff0dd81db287947248810b29329c211e8e5b7de54e41 | Python | 3,168 | 109 | import sys
import os
import time
import threading
import subprocess
import pygame as pg
import pygame.midi
class MidiPlayer(threading.Thread):
def __init__(self, input_device_id, output_device_id, delay_key, delay_key_cnt):
super(MidiPlayer, self).__init__()
self._stop_event = threading.Event()
... |
ab220ce7fd229b1a8c4c58ae58fba20e590d6903cdf62eb5701a19ee9bb4b651 | Python | 3,169 | 93 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
f1ed01c550685e7d0d6e7d63deacbd34a517a553cc0da1dadad11543447f29c0 | Python | 3,169 | 102 | import argparse
import numpy as np
from scipy.signal import lfilter
def peak_det_matched_filter(x, fs, h, th, fmax) -> tuple:
"""
peak_det_matched_filter - R-peak detector based on a matched filter
Syntax: [peaks, mn, r] = peak_det_matched_filter(x, fs, h, th, fmax)
Args:
x: Vector of ... |
02ac8ec92278e3c04a1f7cb8814860bda15ef892bc4f9bc155bcc8a2c2c0675d | Python | 3,170 | 110 | import numpy as np
import cv2
from math import sqrt
_LINE_THICKNESS_SCALING = 500.0
np.random.seed(0)
RAND_COLORS = np.random.randint(50, 255, (64, 3), "int") # used for class visu
RAND_COLORS[0] = [220, 220, 220]
def render_box(img, box, color=(200, 200, 200)):
"""
Render a box. Calculates scaling and th... |
0c20feffad4cfc45c242e542ecf3fcd1beaaf908a97aa4260e1ff5e7d5a81b80 | Python | 3,172 | 79 | import argparse, importlib, math, types
from data import generate_recog_data_batch
import torch
import torch.nn as nn
import numpy as np
from net_utils import random_weight_init, load_from_file
#script = 'script_recog_decoupled.py'
#argsList = [
# ('--netClass','HebbRecogDecoupledManual', '--Nh',... |
3539c88c504e219706a86fffa6b62384948c5a66f5fff630d46498f9b42d6502 | Python | 3,172 | 96 | # AUTHOR: Sirio Bolaños Puchet <sirio.bolanospuchet@epfl.ch>
# CREATION DATE: 2024-02-15
# LAST MODIFICATION: 2024-02-15
_PROGNAME = 'plot_heatmap'
import logging
# setup logger
LOGGER = logging.getLogger(_PROGNAME)
logging.basicConfig(level=logging.INFO)
# parse arguments early
if __name__ == "__main__":
impor... |
cab5c656c8c69e7783549571036b16a7df6e546711237421dff7cf46139d1dc6 | Python | 3,172 | 85 | import os
import utils.hhblits_search as hh
import utils.psiblast_search as psi
import yaml
import argparse
import time
# Load the paths of tools and databases
with open("config.yaml", 'r') as f:
cfg = yaml.load(f, Loader=yaml.FullLoader)
psiblast = cfg['psiblast']
hhblits = cfg['hhblits']
rosetta =... |
95048b77369556d9c9de43b046a91c1a65f061b5b70b3a306910011c244e81d6 | Python | 3,174 | 94 | from typing import List
import torch
import torch.nn as nn
from e3nn.nn import FullyConnectedNet
from e3nn.o3 import Irreps, TensorProduct
from e3nn.util.jit import compile_mode
from torch_scatter import scatter
import hienet._keys as KEY
from hienet._const import AtomGraphDataType
from hienet.nn.activation import Sh... |
4fb0d0ba56e0f1b4e2835167f880ede39453bfc81d298757c7240e2925718645 | Python | 3,175 | 116 | '''cgat_zap.py - replace files with empty placeholders
===================================================
Purpose
-------
The purpose of this script is to help in preserving disk space by
replacing certain files with empty files. The new files will have the
same file properties (modification time, etc) as the origi... |
81b17c8aaa3a0a343cd8d6a9c4dde5a60e8be917468a6034c1e0592b170bf311 | Python | 3,175 | 91 | """
Fit barrels to ellipsoids and computes their properties based on voxel data and barrel positions.
This scripts filters and extracts specific barrel positions before mapping 3D positions to 2D positions on a flatmap. Subsequently, it calculates the properties of confidence ellipses for each barrel. Computed ellipsoi... |
f4a01434c99500ae5a1aa4a62c79ca46de2958edbeb3f7426dfef6bbf658baba | Python | 3,177 | 61 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
f70813b0042015e005d5938356ed8d6f8e2bf24afd2493a4ce3add398958ccc1 | Python | 3,178 | 123 | # implement alignment methods for cross-subjects/sessions
from typing import Dict, Optional
import numpy as np
import scipy.linalg as linalg
def np_compute_transform_mat(
X: np.ndarray, use_log: bool = False, inv: bool = True
) -> np.ndarray:
"""
compute transform matrix (inv) sqrt of mean of covariances ... |
c8a5963cbd8c8363f178f52e49cd6c694da933f4cd7820d2965e2bd57d5d7f9f | Python | 3,179 | 90 | from dataclasses import asdict
import json
import pathlib
from typing import Callable, List, NamedTuple
from flax.training import checkpoints
import pick
from chemoxrl import EnvParams, ExperimentConfig
from chemoxrl_aux.policies import greedy_policy, rppo_policy
class CkptModel(NamedTuple):
name: str
label:... |
da7413fc09c8fe1a765253177fbf6261907a6b6c4abd46e529d3c639c202cab3 | Python | 3,180 | 96 | """
Use TIAToolbox Multi-Task Segmentor to gt nuclear/layer segmentations with HoVer-Net+.
Usage:
run_segmentation.py [options] [--help] [<args>...]
run_segmentation.py --version
run_segmentation.py (-h | --help)
Options:
-h --help Show this string.
--version Show versi... |
5c0d9b21cc7e85aa1459d1a94ed549aeeec8c38020ea04ae264fe260aee14f88 | Python | 3,181 | 69 | # -- coding: utf-8 --
# @Time : 2023/7/23 17:57
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : transform_adata.py
# @Description: This file is used to ...
import anndata
import scanpy as sc
from pathlib import Path
from scipy import io
import os
if __name__ == '__main__':
output_for_R_path = ... |
6376187ae64b1695109e42ca74d2a26dbd475432ef64bc56794f17cd5a98e055 | Python | 3,183 | 97 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
caccd55975f4b613a34f24775a6ae3c15531a4229890f55f4f229c76a47de451 | Python | 3,185 | 102 | import tensorflow as tf
class VAE(tf.keras.Model):
def __init__(self,
encoder_net, decoder_net,
beta=1, **kwargs
):
super(VAE, self).__init__(**kwargs)
self.encoder_net = encoder_net
self.decoder_net = decoder_net
self.beta = be... |
d546df678d72955ef38af1e3527ce11e14cf81bfa8bc96f82adce971e16e80a4 | Python | 3,186 | 83 | # todo upgrade to keras 2.0
from tensorflow.keras.layers import Reshape
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Reshape, Permute, Layer
from tensorflow.keras.layers import Input, Convolution2D, MaxPooling2D, UpSampling2D, Reshape, Dropout, add,... |
f95d49d240eec27f06ea9db4be9dfed6236b7c676450bf223acbf52bad8ac3e0 | Python | 3,188 | 113 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import torch
import torch.nn as nn
from torch_geometric.nn import radius_graph
from orbevo.models.orbevo.ocpmodels.common.ut... |
492e4945e520f7bdbcfcd7c976a9691d1e968dd5c786a179cb2d382640a1018c | Python | 3,190 | 92 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
7e876eff8225cf3c479e39a5ef9c9087b80efe6bdbef74266ea986a573562562 | Python | 3,190 | 122 | '''cgat_cluster_distribute.py - distribute files to cluster nodes
=================================================================
Purpose
-------
This script distributes one or more files to the local
scratch directory on all nodes in the cluster.
The script uses ``rsync`` to only copy files that are newer.
Usag... |
b62c533eae5907df45005736a205717be60424d3a499462b4525739d4c41948a | Python | 3,192 | 69 | import hydra
from hydra.core.config_store import ConfigStore
from config import Scenario, _DATATYPE, _ALGOTYPE
from typing import get_args
import numpy as np
from utils import varname, update_cfg
from omegaconf import OmegaConf,open_dict
cs = ConfigStore.instance()
cs.store(name="scenario_config", node=Scen... |
391dd0e6801f3e5e1b97d2142727b4c259e0b7d07538673d527b77295ee401d2 | Python | 3,193 | 105 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from configs.configs import get_config_dict
from helpers.evaluation import leave_every_other_out_split
from helpers.hcp import load_human_connectome_project_data
from helpers.plotters import conv... |
c3aeea47f8a06d21491a2514a1d5b8ccee38283a8a81bd40e20c679da2935ec9 | Python | 3,193 | 86 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
f6c1c31511b5a93068d4ca2e0211b86d92936e7eeab00eac84572344d245c991 | Python | 3,193 | 100 | import sys
import xml.etree.ElementTree as ET
input_file = sys.argv[1]
file = input_file.split("/")[-1]
outputname = input_file.split("/")[0] + "/" + file.split(".")[0] + "_Coatings.rml"
print(f"Processing file: {input_file}")
print(f"Output file: {outputname}")
tree = ET.parse(input_file)
root = tree.getroot()
fo... |
0383790452f4772b78f82b6e9d8749e416e9f31d107416f3c39a4988f9025657 | Python | 3,194 | 121 | from typing import Dict
import pandas
from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField
from openff.toolkit.typing.engines.smirnoff.parameters import (
ConstraintHandler,
ElectrostaticsHandler,
LibraryChargeHandler,
vdWHandler,
)
from openff.units import unit
from packaging impor... |
545ea19ed5bc274fc4ec240952f29f10036a01091fd92f8368e98a4663161659 | Python | 3,194 | 120 | # built-in modules
import os
import logging
import subprocess
# third party modules
import numpy as np
# pnabind modules
from pnabind.utils import moveFile
def stripChainID(pqr_file, prefix=None):
if prefix is None:
prefix = pqr_file.split('.')[0] + "_nochain"
new_file_name = "%s.pqr" % prefix
... |
6265b4e1a77c2a90c54f4912ebfb573440d24570f663fa139b33ff36d25b0c19 | Python | 3,199 | 94 | import copy
import pickle
import pyfaidx
import torch, random, os, json
import numpy as np
from src.tasks.utils import index_mapping
cur_index_mapping = {
0: 'A',
1: 'C',
2: 'G',
3: 'T',
}
class EnhancerDataset(torch.utils.data.Dataset):
def __init__(
self,
tokenizer,
... |
65fdb80c6d882e0f4f50be5cee59c58e11216799a445b490217391e36b7f255f | Python | 3,200 | 105 | """ Example run od the GMM augmentation """
import numpy as np
import matplotlib.pyplot as plt
import nibabel as nib
import argparse
import os
from augmentation_utils import generate_gmm_image, normalize_image
parser = argparse.ArgumentParser(description='GMM-based augmentation')
parser.add_argument('-i',
... |
e99e955363fa79a07895eaaa3f4f333475bede3f34acecabf88f63e645ec4e20 | Python | 3,201 | 85 | import collections
import torch
from tensorboardX import SummaryWriter
from torch.optim import Optimizer
def log_lamb_rs(optimizer: Optimizer, event_writer: SummaryWriter, token_count: int):
results = collections.defaultdict(list)
for group in optimizer.param_groups:
for p in group['params']:
... |
7695703dec1ac59ce6ba6c62e25c676ce4fda10e0a53d3c702a22f7ab0dc2ede | Python | 3,202 | 53 | import pandas as pd
import numpy as np
import argparse
def get_label(survival_label_path,save_path):
data_survival=pd.read_csv(survival_label_path,sep='\t')
sample_mRNA_data=pd.read_csv(save_path+'/sample_mRNA_data_2.txt',sep='\t')
sample_mRNA_data['sampleID']=sample_mRNA_data['sample_old'].map(lambda x:... |
8eb20a8674b5ccfff3c9e873d40d0ce0323c3694a44b2add4b372c4883c9b508 | Python | 3,202 | 83 | from tensorflow.keras.layers import Reshape
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Reshape, Permute, Layer
from tensorflow.keras.layers import Input, Convolution2D, MaxPooling2D, UpSampling2D, Reshape, Dropout, add, concatenate
from tensorflow.... |
854ace3bb1e2aa2e5948969ef26a41f0e551d8b24150a76c434097326c532cf1 | Python | 3,203 | 123 | #!/usr/bin/env python3
"""
Convert single Nifti-1 3D or 4D volume to set of JPEG stacks.
Usage
----
nifti2jpg.py -i <Nifti filename> -o <JPEG image stub>
nifti2jpg.py -h
Example
----
>>> nifti2jpg.py -i mynifti.nii.gz -o myjpgs
Authors
----
Mike Tyszka, Caltech Brain Imaging Center
Dates
----
2015-09-03 JMT From s... |
8a7cd1e22ffa45a47b4e437f18eff46796fdb59bfd024a75c97a07001b84f5a6 | Python | 3,203 | 86 | # from pix2pix
import os
import torch
import torch.nn as nn
from torch.nn import init
from torch.optim import lr_scheduler
class BaseModel(nn.Module):
def __init__(self, opt):
super(BaseModel, self).__init__()
self.opt = opt
self.total_steps = 0
self.isTrain = opt.isTrain
s... |
c93ff46413e791732144a04902e2cc00e353c8d074e57086e6fd83bff691e650 | Python | 3,204 | 114 | """
Utility functions to calculate the top and bottom nodes of the PID lattice in
large(-ish) systems, without having to compute all other nodes. Implements
Barrett's MMI measure for Gaussian distributions, using Ince's Gaussian copula
transformation.
References:
Barrett AB (2015). Exploration of synergistic and ... |
4b395c6a66f166e177e7c4fda9d74315176d942e619fbbcb5d7ce77ecdcdad6d | Python | 3,205 | 92 | import torch
from torch import nn
from utils import RBFExpansion
from transformer import ComformerConv, ComformerConvEqui, Piezo_block, Elastic_block
from torch_scatter import scatter
def bond_cosine(r1, r2):
bond_cosine = torch.sum(r1 * r2, dim=-1) / (
torch.norm(r1, dim=-1) * torch.norm(r2, dim=-1)
... |
96768570038f8ab1647021835f9d3e213a7a50ce1ff739f44f3d1f90e23a8dc1 | Python | 3,207 | 67 |
import numpy as np
from copy import copy
import pandas as pd
class Input:
def __init__(self, Table, pdata):
""" MaxQuant output
MaxQuant output is composed by a ProteinGroup.txt file and it contains
several parameters that can be used to filter the data.
Args:
Table ... |
6c7a79d88cb0cc09b1e13c151e215a8718d34f1acc33c99b12ea911b779d6a03 | Python | 3,208 | 87 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
b7edc458b64ea93053f7549715b16f1e965810d6885d987f1c9331e1af82073e | Python | 3,209 | 91 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
import sys
import timeit
from functools import partialmethod
from typing import Tuple
import torch
from pytorch_lightning.cli import LightningCLI
from pytorch_lightning.utilities.rank_zero import rank_zero_only
class Timer:
d... |
169388739120c4fd22c8b1c08dacf0030b55fb95a1a005734e2f836d4e6ec78e | Python | 3,213 | 114 | import numpy as np
from PIL import Image
from neurovisfit.data.params import AggregateBins
from neurovisfit.data.params import Crop
from neurovisfit.data.params import DataLoaderParams
from neurovisfit.data.params import ImageTransform
from neurovisfit.data.params import ProcessTimeBins
from neurovisfit.data.params im... |
582ab78ea57ec6151a053853847780c577a34d20a33923c12c00c795131cbc96 | Python | 3,216 | 94 | """Retriever tool."""
from __future__ import annotations
from typing import TYPE_CHECKING, Literal
from pydantic import BaseModel, Field
# Cannot move Callbacks and Document to TYPE_CHECKING as StructuredTool's
# func/coroutine parameter annotations are evaluated at runtime.
from langchain_core.callbacks import Cal... |
52caace16ba24d7b9f3f5c315f93742f86ece208bd0a642e2754c87651abf510 | Python | 3,217 | 87 | import torch
import torch.nn.functional as F
import torch.nn as nn
import copy
from stable_baselines3.common.policies import ActorCriticPolicy
import gym
from typing import Callable, Dict, List, Optional, Type, Union
class ActorCriticNetwork(nn.Module):
"""
Policy network for PPO models. Stores activations for... |
6a30da6d092de19f27664fa6c16f547fee9073dc998217a58015df5a3beda6a0 | Python | 3,217 | 80 | import numpy as np
from voxcell import VoxelData
from sys import argv, exit, stderr
from os import cpu_count
from tqdm import tqdm
import scipy.ndimage as nd
import flatmap_util as fmutil
argc = len(argv)
if argc < 3:
print('Usage: {} <flatmap> <flat xlen>'.format(argv[0]),file = stderr)
exit()
flatmap_fil... |
7ce972923e70a5a79dfda86a4121495e0923f68ae1028f8d5027d951676fd21c | Python | 3,217 | 89 | import torch
from torch.utils.data import Dataset
from collections import OrderedDict
import numpy as np
from torchdiffeq import odeint
import shelve
from CEL.utils.register import register
from .meta_dataset import DatasetRegistry
MAX = np.iinfo(np.int32).max
@register.dataset_register
class DampedWaveEquation(Data... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.