sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9d67b807928e370c825170d7d1334129ba4621dd01e7ffcde37c4226d55198d8 | Python | 5,637 | 194 | """ This module provides functions for measuring like time measuring for executed code.
:Version:
1.1.0
:Date:
19.03.2017
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2017 Jan Melchior
This file is part of the Pytho... |
c62752f78d00244b71b29e16a309473c8f811b7798e95a857e11c7c21d05cda1 | Python | 5,639 | 176 | import pandas as pd
import numpy as np
import sys, os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import matplotlib.pyplot as plt
import seaborn as sns
from tensorflow.keras.utils import to_categorical
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import keras
import keras.backend as K... |
27abcba049be4dcd394012bad206e13a9c5e1f2adb29d5f344f90562854085e4 | Python | 5,640 | 133 | import torch
from .attention import AttentionReadout
from .base import ClonedReadout, Readout
from .factorized import FullFactorized2d, FullSXF, SpatialXFeatureLinear
from .gaussian import (
DeterministicGaussian2d,
FullGaussian2d,
Gaussian2d,
Gaussian3d,
RemappedGaussian2d,
UltraSparse,
)
from... |
83a35cbcc8654e806b7503f7b2a775cc21bb5aea3d5197bbba3c155f3f8928be | Python | 5,641 | 141 | ''' Test module for dbn models.
:Version:
1.1.0
:Date:
04.04.2017
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2017 Jan Melchior
This file is part of the Python library PyDeep.
PyDeep is free software: ... |
6afcb38c5a438a46af328b0833d86f82a27277a3c823b008a1b1357a975cae4b | Python | 5,643 | 147 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import scipy.stats
import numpy.ma
import Stats
import Histogram
from cgatReport.Tracker import *
from cpgReport import *
##########################################################################
class replica... |
896d4b2cb2134132db257789507ce5cebdc774e488ce6ca9528e378a3ee33476 | Python | 5,643 | 164 | """
@author: malfatti
@date: 2019-07-27
@Modified by Jiaao Zhang 2022-09-19
Loads data recorded by Open Ephys in Binary format as numpy memmap.
DatLoad(Folder, Processor=None, Experiment=None, Recording=None, Unit='uV', ChannelMap=[])
Parameters
Folder: str
Folder containing at least the subfolder 'e... |
53bd83d0f55d3230ef6f265370235ece46b607dad981a32bf9dd377ec53c885f | Python | 5,653 | 146 | import copy
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from scipy.spatial.distance import cdist, pdist
import warnings
def generate_random_compositions(materials, n_comps=30, n_sources_per_comp=None,
mass_loading_selections=[2.5, 5, 7.5, 10],
... |
32226b7a6ee11fcec61d755c1f95637c0fbb545805684b9007b8384043bbf106 | Python | 5,656 | 188 | import numpy as np
from functools import wraps
from itertools import islice
def samples_correlated(arrays, seed=None):
"""
Returns an iterator over datasets sampled with replacement from
the input, each having the same length as the input.
For each iteration, the set of rows sampled from each input a... |
e18d8b0b66435b693b717f878b0a49919c3ac2a5b59507d1e365c1645684f080 | Python | 5,656 | 164 | # Rdkit import should be first, do not move it
try:
from rdkit import Chem
except ModuleNotFoundError:
pass
import utils
import argparse
from configs.datasets_config import qm9_with_h, qm9_without_h
from qm9 import dataset
from qm9.models import get_model, get_autoencoder, get_latent_diffusion
from equivarian... |
4fb74216c0cb4c8ac87068215f8c4641d180c6fc6c18702047d517c0ea1cd3a8 | Python | 5,658 | 104 | """Execute DTI stages with unchanged Slicer commands and per-output receipts."""
import argparse
from concurrent.futures import ThreadPoolExecutor
import os
from pathlib import Path
import subprocess
import sys
if __package__ in (None, ''):
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from preproc... |
724ef9bebaaf52d49cdbc49b96d41f73432dbc51c6d173f5bad0fe76488788e7 | Python | 5,658 | 155 | import torch
from torch.fft import fftn
def roll_quadrants(data, backwards=False):
"""
Shift low frequencies to the center of fourier transform, i.e. [-N/2, ..., +N/2] -> [0, ..., N-1]
Args:
data: fourier transform, (NxHxW)
backwards: bool, if True shift high frequencies back to center
... |
c518f9379bafbeaf2517e6d504d072232ec64fdcca6f1355c1b0f9a46784eed8 | Python | 5,664 | 167 | """
This module includes functions for parsing files used in the CWAS
categorization step. By parsing those files, these functions make the
pandas.DataFrame objects that can be directly used in the categorization
algorithm.
"""
from io import TextIOWrapper
import pathlib
import re
import gzip
import numpy as np
import... |
eabb5c615e9506b4812e7c0e747b5138f6652ace2a33c6acd526f939eaefaab7 | Python | 5,665 | 128 | import yaml
from collections import OrderedDict, abc as container_abc
from utils.my_containers import ObjDict
from utils.utils import ordered_load
def load_yaml(config_path):
with open(config_path, encoding='utf-8') as fp:
cfg = ordered_load(fp, yaml.SafeLoader)
return ObjDict(cfg)
class ConfigConst... |
fd09850cb52e814bd772aa4d76f415c36b856824d016f95f229ce5427393d8e9 | Python | 5,666 | 182 | ### Toy example to test Conv1dConnection (the dataset used is MNIST but each image is raveled (each sample has shape (784,)).
import argparse
import os
from time import time as t
import torch
from torchvision import transforms
from tqdm import tqdm
from bindsnet.datasets import MNIST
from bindsnet.encoding import Po... |
84c7bc45570fb3482551b2b2374dabae1fa04be85eb3ff6dff4d3d5c7a3183ce | Python | 5,671 | 158 | import math
from typing import Optional
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pydantic.typing import Literal
from torch_geometric.nn import Linear, MessagePassing, global_mean_pool
from torch_geometric.nn.models.schnet import ShiftedSoftplus
from models.base impor... |
1b0ac9982b5fceda7f46232b28bced364fb26b9671ece513543ee1bec4e5ad0e | Python | 5,672 | 158 | import numpy as numx
import pydeep.base.numpyextension as npExt
from DBM3LayerBinary import Model as MODEL
from DBM3LayerBinary import Trainer as TRAINER
from DBM3LayerBinary import Estimator as ESTIMATOR
from pydeep.base.activationfunction import Sigmoid
import pydeep.misc.measuring as MEASURE
import pydeep.misc.io as... |
eaf2d6509ac206afeaeea0e6c971eeb7db67e9c63b1fbc1a661a768556746c2c | Python | 5,673 | 147 | # 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/cascade_mask_rcnn_convnext_fpn.py',
'../_base_/datasets/coco_instance.py',
'../... |
1d844a05bd83b014b907d6737b9f635e29c259179dc911524a1ec8d14f405746 | Python | 5,675 | 147 | # 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/cascade_mask_rcnn_convnext_fpn.py',
'../_base_/datasets/coco_instance.py',
'../... |
557e87d2a7a704c7c2c6aa39cf0eb60cf47268d969c2a7ac5d111f4655ca9c32 | Python | 5,676 | 149 | from typing import Callable, Optional, Union
import torch
import torch.nn.functional as F
from torch import Tensor
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.typing import Adj, OptTensor, PairOptTensor, PairTensor
from torch_geometric.utils import add_self_loops, remove_self_loops
from to... |
58cffd63fa5c8cfb5a3848e5f0b4a1da03b13ab336923c85a59aa5f466fb44bd | Python | 5,677 | 160 | # Code from https://github.com/titu1994/Wide-Residual-Networks/blob/master/wide_residual_network.py
from keras.models import Model
from keras.layers import Input, Add, Activation, Dropout, Flatten, Dense
from keras.layers.convolutional import Convolution2D, MaxPooling2D, AveragePooling2D
from keras.layers.normalizatio... |
4de22efe30c338eb7b0b243010b23a986b8722052698d938de06170aa230562e | Python | 5,678 | 158 | import torch
import torch.nn as nn
from feature_networks.vit import forward_vit
from feature_networks.pretrained_builder import _make_pretrained
from feature_networks.constants import NORMALIZED_INCEPTION, NORMALIZED_IMAGENET, NORMALIZED_CLIP, VITS
from pg_modules.blocks import FeatureFusionBlock
def get_backbone_nor... |
1eb2e21841b4782bbbff7a744738a77eb8b734ffe6e6725b5b23deefe132a534 | Python | 5,679 | 147 | # 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/cascade_mask_rcnn_convnext_fpn.py',
'../_base_/datasets/coco_instance.py',
'../... |
ce2e79c06cdc8d90d624625a1a7942570ae9cb7185334fa5c2cc1dd18e6c2000 | Python | 5,679 | 147 | # 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/cascade_mask_rcnn_convnext_fpn.py',
'../_base_/datasets/coco_instance.py',
'../... |
475399da8850277d86f2d64c3b40247ed86ed7165ea38ee503179ea9cb874916 | Python | 5,680 | 147 | # 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/cascade_mask_rcnn_convnext_fpn.py',
'../_base_/datasets/coco_instance.py',
'../... |
d511e4744d9986a055e8fcddfa11a4754d44cbf8adb544bb757b6af1cebaf6aa | Python | 5,682 | 177 | from typing import Any
from langchain_core._api import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers.openai_functions import (
JsonOutputFunctionsParser,
PydanticOutputFunctionsParser,
)
from langchain_core.prompts import ChatPromptTemplate
from lan... |
08c0efd101f8bdb0a8717a87b04287fa8eec0e8ac0c5280fa6f18d415e515e8b | Python | 5,684 | 180 | import pensa
import numpy as np
import MDAnalysis as mda
import MDAnalysis.lib.distances as ld
import matplotlib.pyplot as plt
import gpcrmining.gpcrdb as db
def get_atom_self_distances(pdb, xtc, selection='all', first_frame=0, last_frame=None, step=1):
"""
Load distances between all selected atoms.
Para... |
09882c4141002b93acf86f9297cc35dcb5020455be3f5ab40749b861b87b306f | Python | 5,684 | 176 | # Adapted from https://github.com/microsoft/robust-models-transfer
# @InProceedings{salman2020adversarially,
# title={Do Adversarially Robust ImageNet Models Transfer Better?},
# author={Hadi Salman and Andrew Ilyas and Logan Engstrom and Ashish Kapoor and Aleksander Madry},
# year={2020},
#... |
a9073e47b842d90f93c7eb527bef90d52249aa4bd72f5f18ac9cb378a0a1f8bb | Python | 5,686 | 172 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 16 13:50:28 2023
@author: pku
"""
import matplotlib.pyplot as plt
#%%
import numpy as np
import tensorflow as tf
from tensorflow.keras import applications, regularizers, optimizers, activations
from tensorflow.keras.models import Model, Sequential
from tens... |
f56d01ca69e3e6f7e08e0cb30168be7c1dfba797adbb9db0f658c5f6ca90b49f | Python | 5,686 | 136 | #!/usr/bin/env python
# coding: utf-8
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from os.path import isfile, join, exists
from os import listdir, chdir
from scipy.stats import spearmanr
from os.path import abspath
import sys
# for relative paths in nn4dms code to work properly, we need ... |
431a2432830a8d2d03baa87ca3bd3a2d041e62c96c4628220ab04f89b4f1ebcb | Python | 5,687 | 201 | """Example for a complex multi-modality (i.e. multi-input) network."""
from vulcanai import datasets
from vulcanai.models import ConvNet, DenseNet
from vulcanai.datasets import MultiDataset
import torch
import torchvision.transforms as transforms
from torch.utils.data import DataLoader, TensorDataset
normalize = tra... |
8906bdd231b65a0159b8b9a2123347ac39b3f4cb99b2a40ecd4abe3405cf4fd6 | Python | 5,690 | 173 | import json
import pickle
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import figure_config # noqa: E402
sys.path.insert(0, "../experiments")
import utils # noqa: E402
mpl.rcParams.update(figure_config.mpl_style)
def adjust_membrane_potential_scale(u):
return u - 8.... |
769cb34e28c83d63f7254599561cf15be028b37c3c610742825c41071fb97db9 | Python | 5,691 | 182 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 28 23:11:35 2022
@author: Agus
"""
'''
Imports
'''
#matplotlib.use('Qt5Agg')
import os
import numpy as np
import glob
from scipy import signal
'''
FUNCTIONS
'''
def remove_noise(traces):
#apply filter to remove noise
ftraces_filtered = []
for index in ran... |
cdfb8121af1ee84eda39be4cb6dfcf3c5ca737ad79299079cb3cf01a5ffee840 | Python | 5,694 | 185 | import logging
import os
import socket
import matplotlib.pyplot as plt
import pandas as pd
import ptitprince as pt
import seaborn as sns
from configs.configs import get_config_dict
from helpers.figures import get_palette
def save_bar_plot(config_dict: dict) -> None:
sns.set(style="whitegrid", font_scale=1.5)
... |
6b03fba6258baa8e445c2ea67745b1fc0b912843335c806c575f1965a9306846 | Python | 5,700 | 180 | from functools import partial
from inspect import isclass
from typing import Any
import pytest
from pydantic import BaseModel
from typing_extensions import override
from langchain_core.language_models import FakeListChatModel, LanguageModelInput
from langchain_core.load.dump import dumps
from langchain_core.load.load... |
5eadebadb01fa9c6947ac39b696ee94666c9ffd16a625e0ea0a4a23ce280b687 | Python | 5,701 | 138 | # This extension template provides instructions to add new structure scores to pgmpy.
#
# Please follow the following steps:
# 1. Copy this file to `pgmpy/structure_score/` and rename it as `your_score_name.py` (e.g., `my_score.py`).
# Note: Do NOT start the filename with an underscore `_`, otherwise it won't be dis... |
7f8f4c219db99c8291101ccb9323541de63304882daaf4051f50d0b6ef69bf18 | Python | 5,701 | 176 | from typing import Iterable, Optional, Union
import torch
from bindsnet.network import nodes
class SubtractiveResetIFNodes(nodes.Nodes):
# language=rst
"""
Layer of `integrate-and-fire (IF) neurons <https://bit.ly/2EOk6YN>` using
reset by subtraction.
"""
def __init__(
self,
... |
af51bbcc56168da977d770ec6cd3625c6789d133d08a29a88677a6c19e2fdd32 | Python | 5,701 | 147 | # 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/cascade_mask_rcnn_convnext_fpn.py',
'../_base_/datasets/coco_instance.py',
'../... |
2c9c16d876b2210b5695cc1cebba813ef1624c34893a80d26d6f7596b28df4ff | Python | 5,703 | 116 | import logging
import os
import socket
import sys
import numpy as np
import pandas as pd
from configs.configs import get_config_dict
from helpers.hcp import get_human_connectome_project_subjects, get_human_connectome_project_subjects_phenotypes
from helpers.morphometricity import variance_component_model, get_phenoty... |
a0a4dc6d15bded9ab5d74b2317add7613855e7d2d4fad307e5e22a447dcd49ea | Python | 5,714 | 193 | BaseDir = "R:/Temp/Threads13/Thread0"
InnCurr = 150
MeanCurr = 150
import sys
file_name = 'Cell'
probeXs = [0] #um
probeYs = [50] #um
frequencies = [8] #Hz
ampltudes = [0.0002, 0] #Hz
DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz
durations = [19900] #ms
stopTime = [20000] #ms
rangesL = [10000] #phase calculation c... |
5d5e86cc7097801b2409bef1e6532ba878ea7c1d369031a017a183f699f79330 | Python | 5,716 | 148 | import nibabel as nib
import numpy as np
import os
import sys
rep=sys.argv[1]
num_parcels=1000
prefix="/jukebox/griffiths/bert-brains/results/"
full_data_datasets=[]
for dataset in ['black','slumlordreach']:
if dataset=='black':
#Black sub
subs=['sub-300', 'sub-304', 'sub-293', 'sub-273', 'sub-265', 'sub-307... |
86bb3118ed302c422bf35829bb670bf3d915e8f7a25b5c98f86d2b86a6185e6b | Python | 5,723 | 198 | """**Messages** are objects used in prompts and chat conversations."""
from typing import TYPE_CHECKING
from langchain_core._import_utils import import_attr
from langchain_core.utils.utils import LC_AUTO_PREFIX, LC_ID_PREFIX, ensure_id
if TYPE_CHECKING:
from langchain_core.messages.ai import (
AIMessage,... |
d5a87ed6388415f782b3af13c895efbe4c6b2924f4f3db0b8630ba9dae30e3ec | Python | 5,729 | 150 | """
Extract workflow paths from the tabular file containing
input and output tools
"""
import csv
import random
from scripts.utils import format_tool_id
class ExtractWorkflowConnections:
def __init__(self):
""" Init method. """
def read_tabular_file(self, raw_file_path):
"""
Read t... |
acd34fe4c664e2f497d93aac10ae1109e24ed3b7427f51de12aec5849f898f4b | Python | 5,730 | 144 | """
:AUTHOR: Jonas Scherer
:ORGANIZATION: Department of Neurobiology and Department of Cognitive Neuroscience, Bielefeld University, Germany
:CONTACT: jonas.scherer@uni-bielefeld.de
:SINCE: Tue Dec 13 17:57:00 2022
:VERSION: 0.1
This module contains functions to plot figures.
"""
import pandas as pd
import numpy as np... |
097386cdf8787de0cf31f4df87a9e18387803d929e33123a25a14c7fa0e589b4 | Python | 5,734 | 149 | import os.path as osp
import h5py
import numpy as np
import warnings
from tqdm import tqdm
import torch
import torch.nn.functional as F
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
class FOLDBackBonedataset(InMemoryDataset):
def __init__(self,
root,
... |
b57a40ddc701cdb58990efdf4d81487bc7d8c39daf46ba2cf7e46efa4447fce6 | Python | 5,734 | 162 | from sys import argv, exit
import pandas as pd
import urllib.request
print(">> Downloading latest version of OMIM annotation dump file...")
tmp_downl_file = 'genemap2.latest_dump.tmp'
urllib.request.urlretrieve("http://data.omim.org/downloads/KH9-kEspQpy0i0ROx7hPZw/genemap2.txt", tmp_downl_file)
print(".. Dow... |
1a83a9f3c386ff7001b915602918fb25d56a6e045dc032d3359ebd45b75315a7 | Python | 5,735 | 137 | import numpy as np
import pandas as pd
import os, tqdm
from scipy.ndimage import map_coordinates
from skimage.io import imread
from scipy.ndimage import label
from skimage import measure, img_as_bool
if __name__ == '__main__':
import sys
sys.path.append(os.path.join('..','..'))
from morgana.ImageTools.morphol... |
f3df975d48b643517b0141005d5237d7f693409e668a88a0f146a0dafbf8dea5 | Python | 5,735 | 139 | # Written by Xi Cheng (xicheng@simm.ac.cn)
import sys
import numpy as np
from rdkit import Chem
import MDAnalysis as mda
from MDAnalysis.analysis import distances
### basic anaysis ###
def calc_dist(pos1, pos2):
'''calculate distances between two position arrays'''
dist_array = distances.distance_array(pos... |
781e6bb2bf7b8e5e159493ca67cb5cf32013ab69bf5264ad20d95cfc473d6b51 | Python | 5,737 | 168 | """
Tests for utility methods for serialization
"""
import numpy as np
import pytest
from openff.utilities import requires_package as requires_pkg
from openff.toolkit.utils.serialization import Serializable
from openff.toolkit.utils.utils import deserialize_numpy, serialize_numpy
class Thing(Serializable):
def... |
e270e02067ca7b881493e3c1e9bc9982d0cd40eba32f90a2205fb32162e7cdc2 | Python | 5,738 | 124 | # coding=utf-8
import os
import numpy as np
import sklearn.model_selection as ms
from torch.utils.data import DataLoader
import datautil.imgdata.util as imgutil
from datautil.imgdata.imgdataload import ImageDataset
from pl_datautil.mydataloader import DistributedWeightedSampler, DynamicBalanceClassSampler
from pl_data... |
717db4d2cb1aee2bbd67a19e7c208dba094cbbf0e6b658bf3e15aaf114f46f48 | Python | 5,742 | 126 | import numpy as np
import pandas as pd
import pickle
import csv
import matplotlib.pyplot as plt
import collections
import itertools
import os
import argparse
import spacy
from decode_linguistic_features_utils import LoadLingFeatures
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argum... |
604cf33c64d65fe448a949a0aa5ebb11c3bafe7d1eb37f8dd4a6907971d2dea4 | Python | 5,743 | 128 | import logging
import os
import numpy as np
import pandas as pd
from scipy.spatial.distance import pdist, squareform
from sklearn.metrics import pairwise_distances
from statsmodels.stats.correlation_tools import cov_nearest
def get_tvfc_estimates_similarity_matrix(
config_dict: dict, tvfc_summary_measure: st... |
731ddbeb4736f46c833f885950a4db2a555696b76d51f774fb4047734dac51e2 | Python | 5,745 | 196 | #!/usr/bin/env python3
import pandas as pd
from rpy2.robjects import pandas2ri
from rpy2.robjects.conversion import localconverter
import rpy2.robjects as ro
import argparse
import yaml
import pathlib
DCloc = """
#########################################
########## Helper functions ###########
####################... |
5437a7fc69961da9b02b16595b55ab02620b505ee3546d5cd1bb3c5b2f4776b4 | Python | 5,747 | 141 | from collections.abc import Callable, Sequence
from langchain_core.callbacks import Callbacks
from langchain_core.documents import BaseDocumentCompressor, Document
from langchain_core.embeddings import Embeddings
from langchain_core.utils import pre_init
from pydantic import ConfigDict, Field
from typing_extensions im... |
a1e75e7684ebe8e87bfa5298e8b6ec6aa7064fde370f6cf21542a54b6a761400 | Python | 5,753 | 150 | #!/usr/bin/env python
# Imports
import unittest
import os.path
import sqlite3
import sys
import tempfile
sys.path = [os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')]+sys.path
from enrichm.data import Data
###############################################################################
HMM_FILE = '''H... |
247d756dc943c39cc6e7dd17be3aa5c5c34bff7eaadfb0dfa71fb761e27b506a | Python | 5,755 | 162 | import eventlet
eventlet.monkey_patch()
from flask import request, Flask, send_from_directory, jsonify, send_file
from flask_socketio import SocketIO, send, emit
from engineio.payload import Payload
import os
import sys
import datetime
from .viewer import Viewer
EXCLUDE_TRAITLETS = set([
'comm', 'count', 'keys',... |
3cd98129ae3d01ab874999998eb64c99e38656005cfc449742dbdb00ccedd182 | Python | 5,757 | 124 | __version__ = '1.2.2'
from typing import List
from typing import Optional
from .EnrichmentAnalysis import Enrichmentscope
from .MultipleData.Nebula import nebula
from .General.Omicscope import Omicscope
from .General.Snapshot import Omicscope_Snapshot
if __name__ != "__main__":
print("OmicScope v " + __version__... |
046649dfcc0d8ef08dfebf38b752e9db044a4e976555f2c5a406a197e467113d | Python | 5,758 | 164 | ## Examine RXE of male individuals in the hippocampus.
import session_info
import polars as pl
from pyhere import here
import statsmodels.api as sm
from scipy.stats import mannwhitneyu
from statsmodels.formula.api import ols
def get_pheno():
fn = here("input/phenotypes/_m/phenotypes.csv")
return pl.scan_csv(f... |
99d785aabec21e850b1ce201437acec7edcaf02912d6be81fd873dfc691046d8 | Python | 5,760 | 165 | from scipy.special import erfc, erfcinv
from scipy.optimize import curve_fit
from scipy.stats import linregress
import numpy as np
import matplotlib.pyplot as plt
from plotting import get_recog_positive_rates
from data import generate_recog_data
from net_utils import load_from_file
#%% Human data
testR = n... |
d5dd0560613cd2a344394268a18d722c05db73514f2c29b2f0a603635d1d2700 | Python | 5,761 | 163 | from .mda_torsions import read_protein_backbone_torsions, read_protein_sidechain_torsions
from .mda_distances import read_calpha_distances
from pensa.features.processing import get_feature_timeseries
from pensa.preprocessing.coordinates import sort_coordinates
# MDAnalysis-based reimplementation of the old standard f... |
9ebdc668a1affe719229ed332c5ca77e087329592744a624f41ba2969cb8bd92 | Python | 5,762 | 174 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: animalai/communicator_objects/items_to_spawn_proto.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _messag... |
ac6fc0b1a20427c1d887f912e1650e2abb2bedae510c0774a4f20097bd987b03 | Python | 5,762 | 145 | ####################################################################################
#
# 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... |
a8f91770ae20908d317423e504f6c6e81230ce0cb664e89dbd39f09a0609a464 | Python | 5,767 | 171 | # -*- coding: utf-8 -*-
####################################################################################
#
# 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 t... |
f9fcbbd5d64d79decc379b919aa4847326652a50a95f69d006f60c109cb0917a | Python | 5,767 | 164 | import os
import re
import time
from collections.abc import Iterator, Sequence
from pathlib import Path
from langchain_core.stores import ByteStore
from langchain_classic.storage.exceptions import InvalidKeyException
class LocalFileStore(ByteStore):
"""`BaseStore` interface that works on the local file system.
... |
164383997f3679dc45e70374f1f496ec28c5e3548b16644626208a5839361348 | Python | 5,777 | 140 |
import warnings
import pandas as pd
import numpy as np
import os
import time
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
import pickle
from sklearn.metrics.pairwise import euclidean_distances
from AnnoSpat.dependencies.cluster_cells import ssKMeans
from AnnoSpat.dependencies... |
521b514e09dd6355eaae1c7892be32b001b2a83ef2afea02be10f48ee5fc7003 | Python | 5,778 | 149 | """Route the upstream sampler's denoised predictions through RGI's minimizer.
alphafold3-colabfold 3.1.18 and later expose this point as
``diffusion_head.DENOISED_HOOK``. For 3.1.11, the pinned release before it,
checked hook points are added to the sampler's source in memory instead. Either
way the original sampler o... |
9cee7c7c8297384617f40a5628b70fe8ce750d013461b331f62620db6bbc8aac | Python | 5,778 | 173 | """
2023.08.30
author: femke.hurtak@epfl.ch
Helping script for computing connectivity statistics.
"""
import numpy as np
from tqdm import tqdm
import pandas as pd
from tqdm import tqdm
def connectivity_stats(matrix, info):
"""
input: sparse matrix, dataframe with info on neurons
output: identical datafra... |
c6bc498359b108499d47810182f213c2f93ff5792491292ea44f79b90ce55fbe | Python | 5,779 | 133 | import os
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
from torch.utils.tensorboard import SummaryWriter
from networks import arch
from dataloaders.radiology_2d import RadiologyDataset2D
from data... |
06bb6418073779e9563fa761a8481290f696c0af1e9cc00d0e16c3913b697043 | Python | 5,780 | 166 | model = "hof_param_471077857_"
file_name = 'CellJ.json'
import os, shutil, sys
import pandas as pd
valus = pd.read_csv('./required_files/Values.csv')
#Create threads
os.mkdir('R:/Temp/Threads11/')
for hof in range(0,40):
#Set up Json files
inFile = "./required_files/neuronal_model/" + model + str(hof) +".jso... |
621e8c68d4411596651fed397c866606d005960af5bbc45aa20946bc3eabdcd3 | Python | 5,780 | 166 | model = "hof_param_569998790_"
file_name = 'CellJ.json'
import os, shutil, sys
import pandas as pd
valus = pd.read_csv('./required_files/Values.csv')
#Create threads
os.mkdir('R:/Temp/Threads10/')
for hof in range(0,40):
#Set up Json files
inFile = "./required_files/neuronal_model/" + model + str(hof) +".jso... |
71da21f0a9512cf3f648426774f48d9470ef75b83d6d356733b93b1e8dd53126 | Python | 5,780 | 169 | import math
from collections import OrderedDict
import torch
from torch import nn
class Flatten(nn.Module):
"""
Helper module for flattening input tensor to 1-D for the use in Linear modules
"""
def forward(self, x: torch.Tensor) -> torch.Tensor:
return x.view(x.size(0), -1)
class Identit... |
e8b8c0bcd22c0ca44fb1fd459098558a62a4fb392059862012b842546f370c47 | Python | 5,780 | 166 | model = "hof_param_488698341_"
file_name = 'CellJ.json'
import os, shutil, sys
import pandas as pd
valus = pd.read_csv('./required_files/Values.csv')
#Create threads
os.mkdir('R:/Temp/Threads13/')
for hof in range(0,40):
#Set up Json files
inFile = "./required_files/neuronal_model/" + model + str(hof) +".jso... |
215d7e9dc5818dccd62791ad741ad0ab7fe20f0d237b49100a57a3bb84643159 | Python | 5,781 | 156 | import torch
import math
class SO2MLinear(torch.nn.Module):
"""
Perform an SO(2) linear operation to features corresponding to +- m
Args:
m (int): Order of the spherical harmonic coefficients
num_in_channels (int): Number of input channels... |
6c7bfb25583115320f929b289406e20d1a55ecd65966e77a641254c49a492830 | Python | 5,783 | 171 | # -*- coding: utf-8 -*-
####################################################################################
#
# 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.
#
# S... |
8180f9058d8ff51e5d48a7dc4cba63dad925202b7f6cce68cadf4b5a19836852 | Python | 5,786 | 137 | """**Evaluation** chains for grading LLM and Chain outputs.
This module contains off-the-shelf evaluation chains for grading the output of
LangChain primitives such as language models and chains.
**Loading an evaluator**
To load an evaluator, you can use the `load_evaluators <langchain.evaluation.loading.load_evalua... |
e4cdcc7211b4d532ab37831e2e948bc9424af7ab5accf2bdebd185b114217388 | Python | 5,787 | 177 | #!/usr/bin/env python3
"""
Compute batch distribution for MassBench Adenocarcinoma dataset.
"""
import pandas as pd
import numpy as np
from pathlib import Path
from collections import Counter
def analyze_batch_distribution(data_path=None):
"""
Analyze batch distribution in training and test sets.
Args... |
7ba1a6932a5e5cb66ab2b9264d7412ee2a05e32739b2f57f64802bb011809e42 | Python | 5,790 | 216 | import torch
import torch.nn as nn
from e3nn.nn import FullyConnectedNet
from e3nn.o3 import Irreps, Linear
from e3nn.util.jit import compile_mode
from torch_scatter import scatter
import hienet._keys as KEY
from hienet._const import AtomGraphDataType
@compile_mode('script')
class IrrepsLinear(nn.Module):
"""
... |
a9eea926abc7c554a376ed0100a399d149cd3ffcfefe0a5801a387e4bcf541af | Python | 5,790 | 165 | from fcd_torch import FCD as FCDMetric
from moses.metrics.metrics import SNNMetric, FragMetric, ScafMetric, internal_diversity, \
fraction_passes_filters, weight, logP, SA, QED
from multiprocessing import Pool
from rdkit import Chem
import copy
import numpy as np
import time
# obtain smiles from rdmol
def get_smi... |
1e13fad9d2e2c9f40dd5a1e23e4ec9a18607e92a0dced71513504cbe2ad92e2f | Python | 5,792 | 172 | import Bio.SeqIO as sio
import tensorflow as tf
import numpy as np
from sklearn.preprocessing import LabelBinarizer
from tensorflow.keras.utils import to_categorical
import random
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import tqdm
#load model
filterm = tf.keras.models.load_model(os.path.join(os.path.dirnam... |
9e66c9ac3df3e1f503663e92afd0242df00f3eb98ec312f2c773a0247f71da25 | Python | 5,794 | 116 | import logging
import os
import socket
import sys
from fcest.helpers.data import to_3d_format
from fcest.helpers.summary_measures import summarize_tvfc_estimates
from nilearn import connectome
import numpy as np
import pandas as pd
from configs.configs import get_config_dict
from helpers.array_operations import recon... |
90c5fff203fec67c9b4206a10fb1322dc7c57c02da650614064b76ba5eb3b899 | Python | 5,795 | 155 | import os
os.nice(19)
import numpy as numx
import pydeep.rbm.model as MODEL
import pydeep.rbm.trainer as TRAINER
import pydeep.rbm.estimator as ESTIMATOR
import pydeep.misc.visualization as VISUALIZATION
import pydeep.misc.io as IO
import pydeep.misc.numpyextension as npExt
import mkl
import scipy.io as sio
mkl.set_nu... |
09dc71e9a619dfa810ae2395390ab47af432802a2f1017b5a4c2100ddb9b9655 | Python | 5,796 | 152 | "evaluate"
import pyrootutils
root = pyrootutils.setup_root(search_from=__file__, pythonpath=True)
#package
import numpy as np
import torch as T
import matplotlib.pyplot as plt
#private
import src.pipeline as pl
import src.utils as utils
import src.plotting as plot
import src.eval_utils as eval_utils
if __name__ =... |
02b39aa812e842fbd84a67c4ed7c85ccce3895a102bf23dad56e2f34678af1d8 | Python | 5,799 | 154 | import cv2
import random
from inspect import getmembers, isfunction
from scipy.ndimage import rotate
from skimage.transform import resize
# from stardist.models import StarDist2D
from . import channels
from ..utils import utils
from ..utils.utils import *
def identify(vol, annotations, r_crop):
if np.max(vol) <... |
4fe4e7f2fe992228e8fab999f3e3284c09e342965671ad951706d427ded21f3c | Python | 5,799 | 144 | #!/usr/bin/env python3
import os
import torch
import hydra
import logging
from tqdm import tqdm
from models import get_model
from torch_geometric.loader import DataLoader
from ori_dataset import Mixed_MD17_DFT, get_mask
logger = logging.getLogger()
def criterion(outputs, target, names):
error_dict = {}
for ke... |
e97b51e107e1fda646e2948ca14e5f2279e0400ca3acead702ef7e417a9b6a39 | Python | 5,799 | 142 | import json
import pytest
from langchain_core.load import dump, loads
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.prompts.image import ImagePromptTemplate
def test_image_prompt_template_deserializable() -> None:
"""Test that the image prompt template is serializable."""
loads(
... |
84f9bbf3589088f4e198f3e6222d0b0529fd32a54c70e3975f69129d508959a5 | Python | 5,802 | 100 | # 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... |
e63745b8834483b3ce188cabaa56d86c5333b0bff02703cd3de8f39da935a144 | Python | 5,805 | 137 | import numpy as np
import scipy as sp
import pandas as pd
import anndata
from universal_divergence import estimate
from itertools import combinations
def score_divergence(codes, sources, k=50, **kwargs):
"""
Measures how well sources are mixed (smaller: well-mixed)
Function to calculate the divergence sc... |
edd6b805b2fc5b3abadd6ce85a5a99d0ca788f644ad3761080ef009a1fd6b99b | Python | 5,805 | 82 | """
Script to regenerate all figures related to experimental data analysis.
Author: jonas.braun@epfl.ch
"""
import os
from pathlib import Path
import params, copy_data
import fig_functional, fig_headless, fig_predictions, supfig_natbeh, supfig_bpn_mdn, supfig_stim_powers
import supfig_dfd_inhibit, fig_antennacut, fig_... |
2e6c9d0c4e0f0b150e9c356ac0b1ccb5da475feb9e901b9940d2b53c03775dde | Python | 5,808 | 153 | import cv2
import numpy as np
import tensorflow as tf
from scipy import ndimage
from skimage.feature import peak_local_max
from skimage.segmentation import watershed
from skimage.morphology import area_opening, area_closing
from keras.preprocessing import image as imp
import matplotlib.pyplot as plt
import time
"""Lo... |
562ad2ff10e06623df0abf2408d7a1f01a81de6d0094e42fd3d7dd70cbfe171e | Python | 5,813 | 161 | import logging
import os
import socket
import pandas as pd
from configs.configs import get_config_dict
from helpers.data import normalize_array
from helpers.rockland import extract_time_series_rockland
def _extract_time_series_final_regions(config_dict: dict, roi_list_name: str) -> None:
"""
Extract time se... |
293a54539aa1f25366689009ef54b4f139fa195499e02bc5c28136846f705176 | Python | 5,819 | 130 | """**Callback handlers** allow listening to events in LangChain."""
from typing import TYPE_CHECKING, Any
from langchain_core.callbacks import (
FileCallbackHandler,
StdOutCallbackHandler,
StreamingStdOutCallbackHandler,
)
from langchain_core.tracers.context import (
collect_runs,
tracing_v2_enabl... |
56e828c67312e9ee1eae28dd45617dbdf0154499399d1c045eeb0ae30ff0ffc6 | Python | 5,821 | 200 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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
#
# Unl... |
6dab6a1448bc138e8fc4fffb41f18c26055e72cf5b735fca702a7ace5adadbd4 | Python | 5,822 | 162 | import matplotlib.pyplot as plt
import pandas as pd
import plotly.graph_objects as go
import plotly.offline as pyo
import plotly.express as px
import numpy as np
import scipy as sp
import ants
import scipy.stats as stats
def get_maps_char(maps,samples):
#directories and files for analysis
indir = '/xdisk/hutchinso... |
9b789422c957eb946a47f2fd5b541021cda3dc4a24b333a24100e5ca07177c3f | Python | 5,822 | 115 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... |
bf764619a5019c055a2e24ff8b8df0cd4d018f17aa46b58eced89f6b9270762f | Python | 5,825 | 154 | '''
Author: Zhenyu Yuan
Email: zhenyuyuan@outlook.com
Brief: high resolution seismic processing by a sequential convolutional neural network
Parts: model training, validation and prediction
'''
import os
import tensorflow.keras as keras
import h5py
import pre_data
import model
import utils
from sklearn.mode... |
9723dfd2856be22159e4954caf5e697279adc10c9965921ef316507b07e16251 | Python | 5,828 | 187 | import numpy as np
def check_hand_(patient):
# extract labels for recording
conditions = patient.label
# check which hand has been tracked
if conditions:
if 'hand' not in conditions.keys():
hand=['left','right']
elif isinstance(conditions['hand'],list):
... |
7dc773120ee09a9e86a9a07f3d6aab219d0a8d236e912ab92c88273a4c60bf18 | Python | 5,830 | 160 | ####################################################################################
#
# 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... |
0a4feaed82473fb91ffe7e238acd0a7a359e9c2b614212b3b3d8d1f24871be52 | Python | 5,834 | 207 | import argparse
import pathlib
from runtime.utils import str2bool
PARSER = argparse.ArgumentParser(description="HU_AF2")
paths = PARSER.add_argument_group("Paths")
paths.add_argument(
"--data_dir",
type=pathlib.Path,
default=pathlib.Path("./data"),
help="Directory where the data is located or should ... |
48a1effd793b09cae169de793acb8c6c509ca5025396af9deedc5cdea108bd8f | Python | 5,835 | 129 | from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from mimic3benchmark.readers import PhenotypingReader
from mimic3models import common_utils
from mimic3models import metrics
from mimic3models.phenotyping.utils import save_resul... |
f6a9ccc423103fec55f966a257345c0beba97c756ecd2875cac5a03dd889c724 | Python | 5,835 | 175 | """Base classes for output parsers that can handle streaming input."""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
from typing_extensions import override
from langchain_core.messages import BaseMessage, BaseMessageChunk
from langchain_core.output_parsers.base import BaseOut... |
d54420f909c7ab95e9632f7caad209531a1000aabf2030a41aff7fbf0602a6f8 | Python | 5,840 | 136 | import os
import gc
import pathlib
import scipy.io
import pandas as pd
import numpy as np
import datetime as dt
from ctypes import *
from .pypl2 import pypl2api, pypl2lib
def get_files_list(dir_path, files_type):
files_list = []
for f in os.listdir(dir_path):
if f.endswith(files_type):
fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.