sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8fe994ecfe1158d0e63b7d6e8392139b47630ba489e06011985605ba909b94af | Python | 4,941 | 148 | import logging
import numpy as np
from skimage.external import tifffile
from scipy.ndimage.filters import maximum_filter1d
from skimage.transform import downscale_local_mean
from skimage.transform import resize
from .ioutils import parse_meta
from .ioutils import imread_raw
logger = logging.getLogger('luigi-interfa... |
85543678b5965517b6759230755b2f9492a3dfb005d5ed13c6f67ae8ed68c991 | Python | 4,942 | 149 | from typing import Dict, Optional
import torch
from torch.utils.data import Dataset
from tqdm import tqdm
from bindsnet.analysis.pipeline_analysis import PipelineAnalyzer
from bindsnet.datasets import DataLoader
from bindsnet.network import Network
from bindsnet.pipeline.base_pipeline import BasePipeline
class Data... |
c0d3a9def76886e19b75f59587c7bcf1e52d244a6d0af6be34bccaece4b4d958 | Python | 4,942 | 174 | import argparse
import copy
mimic = {
'name':'mimic',
'exp':'mimic',
'seed':20,
'arch':'dn121',
'num_classes':14,
'pretrained':False,
'num_channels':1,
'lr':1e-4,
'betas':(0.9, 0.999),
'num_epochs':10,
'tensor_log':False,
'chkpt_every':4800,
'early_stop':10,
... |
6e80fc078936c526896c0957c18089866ae5279ef9f582974936ac0c06ce0b88 | Python | 4,944 | 138 | import sys
sys.path.append(".")
import os
from dataclasses import dataclass
from contextlib import nullcontext
from omegaconf import OmegaConf
import torch
from crystallm import (
parse_config,
CIFTokenizer,
ContextSensitiveTreeBuilder,
GPT,
GPTConfig,
GreedySelector,
MCTSEvaluator,
MC... |
afb98a4a036b9a1fec9314d9b9e182bc877b6159c10f94321ff2236c7dc6b681 | Python | 4,944 | 114 | # This program is used in the first step of the Treepedia project to get points along street
# network to feed into GSV python scripts for metadata generation.
# Copyright(C) Ian Seiferling, Xiaojiang Li, Marwa Abdulhai, Senseable City Lab, MIT
# First version July 21 2017
# now run the python file: createPoints.py... |
6b5bdca90ce6bb9ca26426aea4b64adc4b5d5013ff43ffccfcbf9a5cecd996b4 | Python | 4,947 | 149 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 4 16:53:51 2021
@author: athanasiadis
"""
import numpy as np
import itertools
def block(y_labels,nshuffles,label_values,contribution):
"""
block
______________________
This is a function that shuffles the labels in a
bl... |
f743e5b13ac514267b15ed996566e2005ecaf8138ab134f6ec2a9f718d4436af | Python | 4,947 | 92 | # Copyright (c) 2008-2026 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Covered Software is provided under this License on an "as is"
#... |
c21ce9db96b3afd75aff478f3eb986a56d0c5fbcdc8cc9ab566344a8543b638e | Python | 4,950 | 170 | import itertools
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import plotly.offline as py
import plotly.graph_objs as go
import plotly.io as pio
from sklearn.metrics import roc_curve
# === Static parameters ===
default_xaxis_dict = dict(
tickangle=-90,
tickfont=dict(
... |
72a0433ecc2b53b9afb7669aaba700304a62186533f30ca779fad60c87b53fc8 | Python | 4,951 | 140 | import pandas as pd
import numpy as np
import random
import sys
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.metrics import roc_auc_score
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier, GradientB... |
eb2931d0701f261a43b07df8fee136f58afeb96ce5b2e04d970f462e1ec8d714 | Python | 4,953 | 120 | nameModelBase = 'MHATT_bonds_deeper_benchmark_clipping_weights'
logfile = open('Log_MHATT_bonds_deeper_benchmark_clipping_weights.txt','w')
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.neighbors import KernelDensity
import pandas as pd
import rdkit, rdkit.Chem, rdkit.Chem.rdD... |
09be89e253b4635550b2dbf8dc014dffa7a2d8f4f1d4379138b430c867f66be9 | Python | 4,954 | 122 | nameModelBase = 'MHATT_bonds_deeper_benchmark_clipping_weights'
logfile = open('Log_MHATT_bonds_deeper_benchmark_clipping_weights.txt','w')
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.neighbors import KernelDensity
import pandas as pd
import rdkit, rdkit.Chem, rdkit.Chem.rdD... |
75b0f151f8a2529ca819222d139c75eff62337121bff6a1837a5895e6454d435 | Python | 4,956 | 121 | import numpy as np
import pandas as pd
import os, tqdm
from scipy.ndimage import map_coordinates
from itertools import repeat
from skimage.io import imread
from scipy.ndimage import label
from skimage import measure, img_as_bool
import multiprocessing
if __name__ == '__main__':
import sys
sys.path.append(os.pa... |
52709b6d4ac647c88ba39e356680094343889e401a404b0114ae41342fd25846 | Python | 4,957 | 113 | from utils_stat import get_roc_info, get_pr_info, load_neurologist_data, calc_neurologist_statistics, read_raw_score
import matplotlib.pyplot as plt
from utils_plot import plot_curve, plot_legend, plot_neorologist
from time import time
from matrix_stat import confusion_matrix, stat_metric
import collections
from tabula... |
71ecaae75039b66c5927830343f30e3bb1263215022334df3e81f4fc755eeee7 | Python | 4,958 | 171 | """Metric computation for benchmarks.
Three metric groups:
- image_quality (always): distribution stats + self-consistency metrics
- with_reference (when annotated reference available): ssim, mse, correlation
- with_phantom (when simulated phantom available): mse vs ground truth
Self-consistency metrics reuse the los... |
71c9ce769570aaa5c939fd777ad32325ee11b127dd841dfd779828a1f1107cf7 | Python | 4,959 | 119 | import random
import torch
import numpy as np
from ._base import _index_select_data, register_transform, _get_CB_positions
@register_transform('focused_random_patch')
class FocusedRandomPatch(object):
def __init__(self, focus_attr, seed_nbh_size=32, patch_size=128):
super().__init__()
self.focus_... |
b4d16067bfc088487fe4712a3e9d21fed7f3329b9ec86ab7d0d7cd3229ae9400 | Python | 4,960 | 136 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
from utils import load_config, parse_arguments
from encoder import run_subcortical, run_cortical
if __name__ == '__main__':
print('Running: ', __file__)
# Configuration (config.yaml)
config = load_config('conf... |
504d67f3677bf08f25a0e7a6959f4f3bd6eea798a37c9ca5c5fffdfba5d18283 | Python | 4,962 | 116 | import os
import sys
from time import time
import multiprocessing
from queue import Empty as qEmptyException
import traceback
import json
import numpy as np
sys.path.insert(0, "../")
from preprocess_rhd.preprocess_oe import preprocess_one_session
from utils_here import clear_folder
MAP_CSV_PATH = "/media/hanlin/Liuya... |
1c5e758dd438ebb1c357487108dfdb5252be79de324f7fcb30212773342e4bed | Python | 4,964 | 157 | import copy
import tempfile
from pathlib import Path
import pytest
import chroma
from chroma.data.protein import Protein
BASE_PATH = str(Path(chroma.__file__).parent.parent)
PROTEIN_SINGLE_CHAIN = BASE_PATH + "/tests/resources/4kw4.cif"
PROTEIN_COMPLEX = BASE_PATH + "/tests/resources/3hn3.cif"
CIF_TRAJECTORY = BASE_... |
4f6ca32cc0697163f4cd9c01fd58b7799de153a6550283ebac6de09a72f1584d | Python | 4,966 | 151 | import os
import signal
from pathlib import Path
from typing import Optional
import dotenv
import pytorch_lightning as pl
from omegaconf import DictConfig, OmegaConf
# This is the function that will be called when the timeout happens
def timeout_handler(signum, frame):
raise TimeoutError("Function call timed out... |
f29272e565b540aad6b48115a6fc146b558b221bbe32007c380f8b8b2c95db6d | Python | 4,971 | 107 | # 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... |
8d7d41a8cb773a0b4a2aa52fa577fd482539cd2a1be1a5b93b19f60ae056a09f | Python | 4,972 | 132 | # Copyright (c) 2008-2026 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Covered Software is provided under this License on an "as is"
#... |
b749ce57972a007f9b10487140fb2596b2da487095d56248d16da2bb6ccdd58b | Python | 4,973 | 136 | """Tests for functions in common.py"""
import os
import pickle
import shutil
from pathlib import Path
# use hypothesis to generate multiple test cases
import hypothesis.strategies as st
import pytest
from hypothesis import given, settings, HealthCheck
from MRdataset import import_dataset, save_mr_dataset, load_mr_dat... |
9d65722187923a35d939824fab930194a79df5eec61fca1cdc580903babf4c27 | Python | 4,974 | 141 | import os
import torch
from tqdm import tqdm
from processing.utils import acc_class as balanced_acc
from processing.utils import AverageMeter
import wandb
def train_epoch(model, dataloader, loss_fn, optimizer, device):
model.train() # Set model to training mode
train_loss = AverageMeter()
predicted_labe... |
22afc94b0fd37c18bc9ec2c08d3a8da4c8c22edc2651215470f6a54323cb44e5 | Python | 4,976 | 158 | import datetime as dt
import json
import uuid
from typing import Any
from unittest.mock import MagicMock, patch
import pytest
from langsmith.schemas import Example
from langchain_core.document_loaders import LangSmithLoader
from langchain_core.document_loaders.langsmith import _get_content_from_inputs
from langchain_... |
e6af21370c6a20ee6e5fc1306df2cac734280b594b3dfe0cacc8b79b048e7b15 | Python | 4,976 | 133 | from collections import Counter
def _safe_divide(x: float, y: float):
if x == 0.0 and y == 0.0:
return 1.0
elif x != 0.0 and y == 0.0:
return 0.0
else:
return x/y
def f_score(p: float, r: float):
if p == 0.0 and r == 0.0:
return 0.0
else:
return 2*p*r/(p+r... |
39bb0bc63f443a8b3bd692f017a94e1b8d4493560a7c2f1bdd7318734692419f | Python | 4,979 | 181 | #!/usr/bin/env python
"""
Extract aseg volumes from a set of FS6 processed subjects
- Output an R-compatible CSV summary file
- Include volumes normalized to estimated total intracranial volume (eTIV)
Usage
----
label_volumes.py <FS subjects directory>
label_volumes.py -h
Authors
----
Mike Tyszka, Caltech Brain Imagi... |
abcbb0e2d681eb7ea964df1a291db2dac64f7d2999169a4d434c21883f128fa7 | Python | 4,979 | 153 | """Implement an LLM driven browser."""
from __future__ import annotations
import warnings
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import CallbackManagerForChainRun
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers i... |
bf790e785a0ce55eaa541473a06c505a6ff9891b3cd25420e7fa3f82848aa66f | Python | 4,979 | 169 | # ThorLink
# Lloyd Russell 2017
# simple utilities to load Thor files into python
import os
import time
import numpy as np
import glob
import h5py
# import matplotlib
# matplotlib.use('TkAgg')
# import sys
# sys.path.append("tools")
# from tools import training
# try:
# # for Python2
# import Tkinter as tk
# imp... |
c441b48ed04f95442f7d384e7a8a8c1a7e96bf6961543b76fe34c90970ca5974 | Python | 4,980 | 143 | """
Analyze relationship between the subject's learning rate
and model variable (cpp, uncertainty) at the group level.
"""
import argparse
import data_analysis_utils as dana
import matplotlib.pyplot as plt
import matplotlib.ticker
import model_learner as model
import numpy as np
import os.path as op
import pandas as p... |
6479fe753d2d7e06d891fd7db776329f9d41c37e8c24a95e7546500861e14112 | Python | 4,981 | 163 | import random
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
from rdkit import Chem
import threading
def generate_random_graph(n, p):
"""Generate a random undirected graph with n vertices and edge probability p."""
adj_matrix = np.zeros((n, n), dtype=bool)
for i ... |
a52c3c94feec7a1a87321f7d3ec8f6eb411e355c729fe7e08295ea0477c91cd1 | Python | 4,981 | 126 | # 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... |
75349a04ae8a79d0ddbf68f7dfaf85bcaa694323f35a87e73d59c6fbf84de2ba | Python | 4,984 | 125 | # 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... |
9b4bcbcc2de56fea2e717f00b56d1cae6573e3b3839f7668b812b7ddea978235 | Python | 4,984 | 126 | """Shared model-building components."""
from typing import Optional
import numpy as np
import torch
from torch import nn
from torch import Tensor
from torch_scatter import gather_csr, scatter, segment_csr
from torch_geometric.utils.num_nodes import maybe_num_nodes
class RBFExpansion(nn.Module):
"""Expand intera... |
ecdcc78ab3a6c917d6b6e52878e59a84a30feef8f0bba88c8a5e8b9bd6ae89d9 | Python | 4,984 | 116 | import mxnet as mx
from nowcasting.config import cfg
from nowcasting.hko_evaluation import rainfall_to_pixel
from nowcasting.encoder_forecaster import EncoderForecasterBaseFactory
from nowcasting.operators import *
from nowcasting.ops import *
def get_loss_weight_symbol(data, mask, seq_len):
if cfg.MODEL.USE_BALA... |
078dd2e96b9e455d3c01d86b1cc2a5e193492fea0b877bce6380f72de2beeeaf | Python | 4,986 | 143 | from langchain_core.prompts.prompt import PromptTemplate
_PROMPT_TEMPLATE = """
You are an agents controlling a browser. You are given:
(1) an objective that you are trying to achieve
(2) the URL of your current web page
(3) a simplified text description of what's visible in the browser window (more on that below)... |
e9ee9d1a02f0e892339c2908ca128acc4128870a8c6554984ae7fe9b40693016 | Python | 4,986 | 92 | """Disease-relevant reanalysis (round-3 Reviewer I / Tier 4.1): do the signatures separate a clinically
pivotal T-cell state? We test tumour-infiltrating (TIL) versus blood CD8 T cells in the cohorts already in
the paper, evaluated with PATIENT held out, and ask (a) are they separable, (b) are canonical exhaustion
gene... |
3d15bdb756a5818e29fde0c63b1dda67c9e7c32ea373a07cd9e7d80c1f0a9c46 | Python | 4,988 | 146 | import gc
import os
from csv import DictWriter
from glob import glob
import cv2
import hydra
import numpy as np
import segmentation_models_pytorch as smp
import torch
import torchvision
from omegaconf import DictConfig
from tqdm import tqdm
from src.data.utils import CLASS_ID_REVERSED
from src.models.smp.model import... |
1cd8dc125986075545abb335dd1ffa3e1c3d817a198fcf4765c3511a948c7d9d | Python | 4,989 | 113 | #!/usr/bin/env python3
import logging
from pathlib import Path
logging.addLevelName(25, 'IMPORTANT') # Add a new level between INFO and WARNING
logging.addLevelName(15, 'VERBOSE') # Add a new level between INFO and DEBUG
logger = logging.getLogger('sdcflows')
def get_parser():
"""Define the command line interf... |
20945e1e350658fd62a2adf459773a3f9e1e15adc657a84ee6ea347752ad592d | Python | 4,989 | 119 | import numpy as np
import torch
from torch.nn import functional as F
import random
import pdb
from torch_geometric.data import Batch
import utils
def post_process(gen_seq, inverse_scaler):
"""Post process generated sequences."""
gen_seq = inverse_scaler(gen_seq)
gen_seq = torch.argmax(gen_seq, dim=-1)
... |
2862d257ebefe93a75f0d91704c1b39185fe7c89b78ec2562e935353329532a8 | Python | 4,990 | 156 | """ Train minGPT on the VQ-VAEs priors. """
from omegaconf import OmegaConf
from pathlib import Path
import mlflow.pytorch
import torch
import torch.optim as optim
from monai.config import print_config
from monai.utils import set_determinism
from tensorboardX import SummaryWriter
from models.img2seq_ordering import O... |
b77f66001a84dfb0d496d3fda191d8081dfcadf2187f30ac92e950cd3e156818 | Python | 4,991 | 146 | import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassifier
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from random import randrange
linux = False
import os
#%% Import scripts
#from xgboost import XGBRegressor
dire... |
88d01451b2abd8d987ca07c692ebe7f9612590e11b5eff0e964b2a4e2b9e5f4b | Python | 4,993 | 141 | # 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... |
0dc776ccefc1957b2f714fe128b47650c347b9ed230e96a0dfd0f3c96df282fe | Python | 4,994 | 142 | """
This script summarized DE results.
"""
import numpy as np
import pandas as pd
import session_info
from pyhere import here
from functools import lru_cache
@lru_cache()
def get_annotation(feature, tissue):
"""
Get the annotation file based on feature and tissue.
"""
feat_lt = {"genes": "gene", "trans... |
6b136c1af1e19cf02ddbedc13dbeebf2f9693de90fdd35fe2b8dee9d81f01f4b | Python | 4,994 | 140 | # Code adapted from https://pytorch-geometric.readthedocs.io/en/latest/_modules/torch_geometric/nn/models/schnet.html#SchNet
import torch
from torch.nn import Embedding, ModuleList, Sequential, Linear
import torch.nn.functional as F
from torch_geometric.nn import radius_graph, MessagePassing
from math import pi as PI
... |
9906554357ecfa4a8b177f4aa3284364ac4d8155b8621ed3f006b80de39809f5 | Python | 4,994 | 96 | import os
import pandas as pd
import pickle as pkl
from types import SimpleNamespace
import yaml
from yaml.loader import SafeLoader
import numpy as np
from scipy.ndimage import gaussian_filter
from utils import *
from tqdm import tqdm
np.seterr(all='raise')
name = 'SGD_update_noise'
folder = 'outputs/' ... |
bf487820669dcebdcb5371b8634920ac070853faf2ee100ee0fe6bb9fe3c5010 | Python | 4,995 | 189 | ### Toy example to test LocalConnection3D (the dataset used is MNIST but with a dimension replicated
### for each image (each sample has size (28, 28, 28))
import torch
from torch.nn.modules.utils import _triple
from tqdm import tqdm
import os
from bindsnet.network.monitors import Monitor
import torch
from torchvisi... |
48ad1c9f4d1fdde1f0554e6c91dbe9b3bf210a72912bf13d463d44eb05e542ea | Python | 4,996 | 88 | """Backbone head-to-head (answers the recurring reviewer ask: does the CNN matter?).
Same no-filtering + multi-pass + held-out attribution pipeline, only the backbone changes:
linear, logistic regression on the full feature set (architecture removed)
mlp, dense non-linear, NO convolution
cnn_small, the paper's c... |
625efac46da2ae01623cb276681d3ca9670049f9accbe224647d23cd12f33011 | Python | 4,996 | 135 | import numpy as np
import pandas as pd
from scipy import stats
from sklearn.cross_decomposition import CCA
from pgmpy.utils import preprocess_data
from ._base import BaseCITest, _CITestResult, _ResidualMixin
class HotellingLawley(_ResidualMixin, BaseCITest):
r"""
Hotelling-Lawley trace CI test for mixed dat... |
0d29e0291c0dbb2d18e9aa6452202d5b0fee48e65858f502bae0b2559ad96c5c | Python | 5,001 | 103 | # Sconda conda activate TensorFlow_CPU_01; cd /mnt/bioadhoc-temp/Groups/RaoLab/Edahi/ForFerhatGit/FCDNN/code; python
#!/mnt/BioAdHoc/Groups/RaoLab/Edahi/00.Scripts/01.Downloaded/anaconda3/envs/TensorFlow_CPU_01/bin/python
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pickle
imp... |
2281af810ba4be1a3f5bee1448b4877a7e926cf47529388b59b62eb38ff39f9a | Python | 5,006 | 165 | import types
import numpy as np
import matplotlib.pyplot as plt
from fastweights_numpy import FastWeights, FeedforwardNet
from dt_utils import Timer
from data_utils import generate_recognition_data
from neural_net_utils import Sigmoid, CrossEntropy, plot_W, plot_B, maxabs
#%% Generate data
d = 50 #len... |
048bb44945299012411d9dab05e5c6ad440c74f4bae489ce86c86e9fa1513f43 | Python | 5,010 | 150 | ####################################################################################
#
# 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... |
137bf66c974073baccb141d3307957e17a7e2ab5dddd32f6c163c90948a2a26c | Python | 5,010 | 103 | # Sconda conda activate TensorFlow_CPU_01; cd /mnt/bioadhoc-temp/Groups/RaoLab/Edahi/ForFerhatGit/FCDNN/code; python
#!/mnt/BioAdHoc/Groups/RaoLab/Edahi/00.Scripts/01.Downloaded/anaconda3/envs/TensorFlow_CPU_01/bin/python
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pickle
imp... |
8678fcd6bd0de3b317b2a0846f204e4e2a084d80515080f3e5233cf443c1fc63 | Python | 5,010 | 129 | ####################################################################################
#
# 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... |
94a8dd53c2364ad8076d47c2dedf70fb07c9a670fdd1e2b30bfb063fc2a6d7bb | Python | 5,011 | 150 | ####################################################################################
#
# 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... |
ced7eaa68ff09da5a374dd41fc7c5e12a6aeb423a4ce604a55dca0612c15854d | Python | 5,011 | 129 | ####################################################################################
#
# 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... |
9fa7afb85c357cb024da42c73cff33a31c74f7d3fea4e70846926caea8031322 | Python | 5,012 | 152 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: animalai/communicator_objects/arena_configuration_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 _m... |
3363c81bd6a4b4e0c9e1e2ea5617b5b53bf5e7cfc1c6c97faac9b2068719cde0 | Python | 5,013 | 145 | import numpy
from openff.toolkit import Quantity, unit
from openff.toolkit.topology import Molecule
from openff.toolkit.typing.engines.smirnoff import VirtualSiteHandler
class VirtualSiteMocking:
@staticmethod
def sp1_conformer() -> Quantity:
return Quantity(
numpy.array(
... |
9703669ea4823248effdb45080af3c078d8c5875a54f6da1ca343d61b35a06a1 | Python | 5,018 | 131 | # functions for interacting with cellpose processed data
import os
import numpy as np
from matplotlib import pyplot as plt
from imagingplus.main.subcore import MicroscopeMetadata
from imagingplus.main.core import SingleImage
from imagingplus.plotting._utils import _add_scalebar
class CellposeImg(SingleImage):
... |
d1077a3e5e31a948a88a6cc3b441b419957b3c20a10ed617c3851546f9619fb0 | Python | 5,018 | 166 | #!/usr/bin/env python
#
# mrQA documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... |
7acbbfcb065ae05e51fe76bd0c496764b71a8f292fd7c90f0374592f2f213858 | Python | 5,020 | 140 | import argparse
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import sys
sys.path.append("../../")
from TCN.poly_music.model import TCN
from TCN.poly_music.utils import data_generator
import numpy as np
parser = argparse.ArgumentParser(description='Sequence Modelin... |
cea9357dc586ce094d976c8632c11a52672f618e7b468c6a22fb9c05e08bcbe5 | Python | 5,021 | 143 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2022/06/15 11:18:27
@Author : Zilan Yu
@version : 1.0
'''
import pandas as pd
import os
import random
root_folds = '../iedb_5folds'
fold_path = os.path.join(root_folds, 'iedb.tsv')
def merge(df1, df2):
df_merge = pd.c... |
4b2fec966b3a326ccd522442a31ed83da1cbc06f642fb19f795c214157016baf | Python | 5,023 | 140 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class Attention(nn.Module):
def __init__(self, rel_size, in_ft):
super().__init__()
self.w_list = nn.ModuleList([nn.Linear(in_ft, in_ft, bias=False) for _ in range(rel_size)])
self.y_list = nn.ModuleList([... |
8c316c7c010dbd31ec220e5997addd334f5ffc4323228c66be1108bbc8dd73cd | Python | 5,023 | 125 | """
This script examines the Spearman correlation of effect sizes
between brain regions.
"""
import session_info
import pandas as pd
from functools import lru_cache
from scipy.stats import spearmanr
from scipy.stats import fisher_exact
from rpy2.robjects.packages import importr
from rpy2.robjects import r, globalenv, p... |
00e35d7301c79b91054148517b39574d6689fa9276beca0756a91668d7c945cc | Python | 5,025 | 131 | import wandb
from equivariant_diffusion.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\
assert_correctly_masked, sample_center_gravity_zero_gaussian_with_mask
import numpy as np
import utils
from protein import losses
import time
import torch
def train_epoch(args, loader, epoch, model, model_dp, ... |
0ccdbbe33f8652b0d8ea10c0616bb3808113bd71ecd630c99f79364777a045e8 | Python | 5,035 | 158 | 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'] = '1'
import tqdm
#load model
filterm = tf.keras.models.load_model(os.path.join(os.path.dirnam... |
756336726f6c48860fc8f4dfb62a46767e0849e4574017d2c2cc0c54033d40c9 | Python | 5,037 | 141 | """
Plot illustration of adaptive vs fixed learning rate.
"""
import argparse
import data_analysis_utils as dana
import itertools
import matplotlib.pyplot as plt
import matplotlib.ticker
import model_learner as model
import numpy as np
import os.path as op
import pandas as pd
import plot_utils as plut
import scipy.sta... |
77c0e100b815cc98bb48479d458da5af2c935b15dad7a0413e4dd9dcfd860227 | Python | 5,037 | 140 | import pandas as pd
from torch.utils.data import Dataset
import torch as tr
import os
import json
import pickle
from sincfold.embeddings import OneHotEmbedding
from sincfold.utils import valid_mask, prob_mat, bp2matrix, dot2bp
class SeqDataset(Dataset):
def __init__(
self, dataset_path, min_len=0, max_len=... |
8e27ef0f69c29377d06cc15e74769f7775db50b8c5e191dce2f577345ffb7bf1 | Python | 5,037 | 135 | # Load in model weights and evaluate its goodness (ECE, MCE, error) also saves logits.
# ResNet model from https://github.com/BIGBALLON/cifar-10-cnn/blob/master/4_Residual_Network/ResNet_keras.py
import keras
import numpy as np
from keras.datasets import cifar10, cifar100
from keras.preprocessing.image import ImageDat... |
966d7129f040cb6f15720f12d9937baa084cf12bfb7afd3cee4aa92787e1c16a | Python | 5,037 | 150 | #!/usr/bin/env python3
"""Aggregate per-molecule efficiency_test JSON results into a table."""
from __future__ import annotations
import argparse
import csv
import json
from pathlib import Path
def _mean_s(d: dict) -> float | None:
s = d.get("summaries") or {}
tot = s.get("total_per_mol") or {}
return t... |
5590eedd4f9dd1c08028a41367145e5c053be311a0ead006d02be745522554de | Python | 5,039 | 146 | #!/usr/bin/env python
# standard packages
import argparse
#### Get command-line arguments
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("data_file",
help="a list of data to perform inference on")
arg_parser.add_argument("data_dir",
help="directory containing the data f... |
9c989afad65b598b5bf7480d22e6a9420e6ea8b9b1cf7cb8444fb8315b598b05 | Python | 5,048 | 106 | import io
import pandas as pd
import tarfile
import argparse
from pymatgen.io.cif import Structure
from mycif import CifWriter
import re
import numpy as np
from tqdm import tqdm
from spglib import standardize_cell, find_primitive
from pymatgen.analysis.structure_matcher import StructureMatcher
import warnings
warnings... |
8a77104797ac915da9df0d100832d7bba9b469830f863a851492e0faa8ca4e61 | Python | 5,051 | 104 | from mimic3benchmark.readers import InHospitalMortalityReader
from mimic3models import common_utils
from mimic3models.metrics import print_metrics_binary
from mimic3models.in_hospital_mortality.utils import save_results
from sklearn.preprocessing import StandardScaler
from sklearn.impute import SimpleImputer
from sklea... |
c7688d4934499b96daf40149545e72bb81aaf1b9e076baaf92021e3ffc4544e9 | Python | 5,052 | 135 | import ctypes
import os
import numpy as np
import cv2
from concurrent.futures import ThreadPoolExecutor, wait
_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__)))
_VALID_DLL_PATH = [os.path.join(_BASE_PATH, '..', 'build', 'Release', 'varflow.dll'),
os.path.join(_BASE_PATH, '..', 'bu... |
42cb1c2d462349fe976347d73a1c141ed62ba970706be151a79dd92a339e2a80 | Python | 5,053 | 150 | import numpy as np
import pytest
from langchain_classic.evaluation.embedding_distance import (
EmbeddingDistance,
EmbeddingDistanceEvalChain,
PairwiseEmbeddingDistanceEvalChain,
)
@pytest.fixture
def vectors() -> tuple[np.ndarray, np.ndarray]:
"""Create two random vectors."""
vector_a = np.array(... |
9f6ae4c0326368a1fb70bfc9e30bd10f00af66a4f7b1ec64508b7b1521c2c98c | Python | 5,055 | 138 | import os
import tqdm
from src import constants
from src import utils
def process_subworkflow(subworkflow, nodes, edges, id_map, next_id):
sub_nodes = []
sub_edges = {}
sub_id_map = {}
sub_next_id = 0
for step in list(subworkflow["subworkflow"]["steps"]):
step = subworkflow["subworkflow"... |
7201649874cda09cac4469e6759769bf032fb6e3991d1b003f958f0cb35aa75b | Python | 5,056 | 96 | """Checks for shared dependencies and relocated public entry points."""
import os
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
from inference.predict import TANet as PredictionNetwork
from model.ddsurfer import TANet
import run_ddsurfer_pipeline as pipeline
ROOT = Path(__file_... |
7f3dadacdfe7a899cdf679af039ad86c3b17fa3d67c1c498424358a167a4d870 | Python | 5,056 | 147 | """Chat generation output classes."""
from __future__ import annotations
from typing import TYPE_CHECKING, Literal
from pydantic import model_validator
from langchain_core.messages import BaseMessage, BaseMessageChunk
from langchain_core.outputs.generation import Generation
from langchain_core.utils._merge import m... |
4acdcaea316d2ed23624720e27aebf7532f1fead2771cec427c4bbbf220986bc | Python | 5,057 | 135 | import types, os
from PIL import Image
import numpy as np
import torch
from torch import nn
from torchvision import transforms, models
from torch.utils.data import TensorDataset
from data import prob_repeat_to_frac_novel, GenRecogClassifyData, generate_recog_data
from plotting import plot_recog_generalization... |
825a62d0df0c260e745c3755090cfa9703fe6bc6bac5c0fb5e46eb5c1f10c50a | Python | 5,058 | 163 | import logging
import os
import socket
import time
from fcest.helpers.inference import run_adam_vwp, run_adam_svwp
from fcest.models.wishart_process import VariationalWishartProcess, SparseVariationalWishartProcess
import gpflow
from gpflow.ci_utils import ci_niter
import matplotlib.pyplot as plt
from matplotlib.color... |
1512926b255e020b7aff26b726f0fda518a81f5bf51f702acfa0a7126a809239 | Python | 5,060 | 152 | """Test LLM-generated structured query parsing."""
from typing import Any, cast
import lark
import pytest
from langchain_core.structured_query import (
Comparator,
Comparison,
Operation,
Operator,
)
from langchain_classic.chains.query_constructor.parser import get_parser
DEFAULT_PARSER = get_parser(... |
2cea0d7c8eea1c881dcae8fbc8f226b5e08355217f02d9443c4f64baf23d0802 | Python | 5,060 | 105 | 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... |
f135ef3b2942b751414c88e854924fd853a0d1cea24591059ad56143470a57a3 | Python | 5,060 | 101 | # -- coding: utf-8 --
# @Time : 2022/12/18 20:53
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : load_mouse_region_tree.py
import json
from treelib import Node, Tree
tree = Tree()
tree.create_node('Mouse brain', 'Mouse brain')
def add_node(tree_dict, key_input):
#print(type(tree_dict[key_inp... |
031f336259deab08f475e58db3bb9ffd6b004c651ce67c606eb2fffa3acef600 | Python | 5,062 | 127 | """
:AUTHOR: Jonas Scherer
:ORGANIZATION: Department of Neurobiology, Bielefeld University
:CONTACT: jonas.scherer@uni-bielefeld.de
:SINCE: Tue Dec 13 17:57:00 2022
:VERSION: 0.1
This module contains functions to plot figures used in the virtual forest publication.
"""
import pandas as pd
import numpy as np
from matp... |
9afef6ab88c18e9d163879f0dbf409ae20278c1159fc70ae2030d9cbb39ef4a8 | Python | 5,063 | 131 | # 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
#
# Unless required by applicable law or agr... |
fd285e0f57abdaf30b0bfeefa6ea7e4e0e3799fb83c0a1d3d5dabe147e078c4e | Python | 5,065 | 151 | #!/usr/bin/python
"""This determines the easyDesign package version, primarily based on git.
If git is available, we use the version specified by git. This can indicate
commits on top of the last numbered version and can also indicate if the
working directory is dirty (i.e., has local modifications). If git is not
avai... |
d0b274fbde00c8b9abce8c7848b8556eacbf4eeeff137aaee8ce97394eeab42b | Python | 5,066 | 120 | # tracks taken from geneset comparison
# need to integrated
from RnaseqReport import *
class AnnotationsAssociated:
pass
##########################################################################
##########################################################################
#########################################... |
fafdb05942d431f62062a230241f5836f5e38c5dff80ee383ad2ae4416c3b8a4 | Python | 5,068 | 152 | """Test LLM Bash functionality."""
import os
import sys
from unittest.mock import patch
import pytest
from langchain_classic.chains.llm import LLMChain
from langchain_classic.evaluation.loading import load_evaluator
from langchain_classic.evaluation.qa.eval_chain import (
ContextQAEvalChain,
CotQAEvalChain,
... |
79f572c21265ab9a7059ebc5c375692fd48d4af5b656d049923c5f2a8505e6e7 | Python | 5,069 | 180 | from typing import Type, List, Optional, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
def nll_loss(
input: torch.Tensor,
target: torch.Tensor,
weight: Optional[torch.Tensor] = None,
smooth: float = 0,
reduce: bool = True,
) -> torch.Tensor:
# input (log_prob): [bsz,... |
55b3bf60ad4f96089e8fffc492f9b1f3e535b837eb668b0489a8bf909b8e6e3d | Python | 5,070 | 147 | import argparse
import json
from pathlib import Path
from shutil import copy2
from typing import Dict, List
import nibabel as nib
import numpy as np
import pandas as pd
from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json
from tqdm import tqdm
from util import BodyParts, BodyRegions, loa... |
b5bcca78998d874303ad9eabafcd28f6c139be9db8a18be28d352ccf35c32786 | Python | 5,072 | 170 | import numpy as np
from explainability.layers.layer import StandardLRPLayer
from explainability.utils.strategies.lrp_strategy import LRPStrategy
from tensorflow.keras import Model
from tensorflow.keras.layers import Activation, Conv2D, Dense, Flatten, Input
from explainability import RestructuredLRP
# def test_rest... |
63694ad1239fa7697dfa338d06ed0c077d0b0245e6fa48e6bc1597b3aa22225a | Python | 5,073 | 114 | import matplotlib.pyplot as plt
import torch
from Grad_Cam.grad_cam import GradCAM
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
from pytorch_grad_cam.utils.image import show_cam_on_image, deprocess_image
from torchvision.models import resnet50
from skimage.io import imread
from torchvision im... |
f18af3e9cab931761e51aba6b9a124ee2a8043809b0134d4d110e59b9be3e5fb | Python | 5,074 | 149 | ####################################################################################
#
# 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... |
beb855df1540978a5b982cf580f281a68d618694e16da0e36bbc89a875827d16 | Python | 5,078 | 146 | from warnings import warn
from tqdm import tqdm
import torch
import numpy as np
from torch.optim import Adam
from torch.optim.lr_scheduler import StepLR
from torch.nn import MSELoss
from odl.contrib.torch import OperatorModule
from dival import IterativeReconstructor
from dliplib.utils.losses import poisson_loss, tv... |
3411b657b7176f56244e41a8da88be2fb2c30bda5a3fac48e78bc2e8111ef3a0 | Python | 5,083 | 144 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 6 21:27:23 2021
@author: athanasiadis
"""
import torch
import numpy as np
import attack_modelfunctions as md
import torch.nn as nn
def computer_local(eigenvectors,modelinfo,nsub,nvalues,model_flag):
"""
computer_local
______________... |
88107aa6e02877d8c5f09af1d7d6c710665640b39023d9ff24d623838e8fdd2e | Python | 5,083 | 90 | """Unified loader for the PINN4SOH per-cycle feature tables (XJTU, MIT, TJU, HUST).
Every CSV has the same 17 columns: 16 charge-curve statistics + `capacity` (Ah), one row per cycle.
Output: a single long-format parquet with cell metadata, cycle index, features, capacity, SOH and EOL labels.
Usage: python src/... |
fa04318d623084995a8f8d5d69d2ef1a6b30f005d4c1425f713e3c8a87c6ad62 | Python | 5,084 | 175 | # pylint: skip-file
"""
This script is simply a modified version of an example described in
https://group-lasso.readthedocs.io/en/latest/.
The original script can be found here:
https://github.com/yngvem/group-lasso/blob/master/examples/example_sparse_group_lasso.py
Notice that there are various extra plots included... |
7a8bb4a78143fedc3ce672b20075bfdfba2e72014e09fd5d4c599beb8a035753 | Python | 5,086 | 143 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 16 15:19:43 2023
@author: baran
"""
from matplotlib import pyplot as plt
import numpy as np
from PIL import Image
from tqdm import tqdm
from scipy.signal import convolve
from scipy import stats
Image.MAX_IMAGE_PIXELS = 500000000
def neigh_ct(imar... |
8118ed8c80e3bd170db09bae3921780f02b5f0af28271764bc8ae8de88a90b2b | Python | 5,088 | 192 | import torch
from torch.nn.modules.utils import _pair
from tqdm import tqdm
import os
from bindsnet.network.monitors import Monitor
import matplotlib.pyplot as plt
import torch
from torchvision import transforms
from tqdm import tqdm
from bindsnet.analysis.plotting import plot_local_connection_2d_weights
from time i... |
5d214c4fbc41feaf3fccf56323ba7be32739d9c8901988f5f92e83209ab831b0 | Python | 5,092 | 135 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 16:59:16 2020
@author: gritti
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 11:24:40 2020
@author: gritti
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 16:46:26 2020
@author: gritti
"""
import os, glob, tqdm
from skimage.io import imread, imsave
im... |
e3ecb582f195c836ff6ba693eba49010a9bb120294d12c61c64cc7a3b2a6cf8b | Python | 5,093 | 151 | import os
import time
import pickle
import numpy as np
import torch
from torch.optim import lr_scheduler
from torch.nn.init import xavier_normal, xavier_normal_
from torch import nn
import torch.utils.data.sampler as sampler
from config_PPI import DefaultConfig
from model_PPI import DGCNN
import data_generator_PPI
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.