sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3ebccde495d526f158137527651d41604b6f4119ca73290877a1d0836334b451 | Python | 4,657 | 149 | import numpy as np
import joblib
import torch
import matplotlib.pyplot as plt
from matplotlib import colors, gridspec
from dt_utils import Timer
from data_utils import generate_recognition_data
from torch_net_utils import maxabs, plot_W_seq, plot_xhy_seq, run_net, plot_corr, list2tensor
from neural_net_utils ... |
033c33040cd92bb3ad1e05cfb601b7fa535c079868c27f7c97821e5271be467d | Python | 4,658 | 144 | 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 (
JsonKeyOutputFunctionsParser,
PydanticAttrOutputFunctionsParser,
)
from langchain_core.prompts import BasePromptTemplate, C... |
3d3c12d94b406dfce8c423b620569746a885a81a039b4fb0a1f60ddd38885db2 | Python | 4,658 | 139 | """Parser for JSON output."""
from __future__ import annotations
import json
from json import JSONDecodeError
from typing import Annotated, Any, TypeVar
import jsonpatch # type: ignore[import-untyped]
import pydantic
from pydantic import SkipValidation
from pydantic.v1 import BaseModel
from typing_extensions import... |
90c6b11c77c99a7dc8278a4dd3629cd21eb696ddf6261fe8eeef511720b485ff | Python | 4,659 | 113 | import os
import pathlib
import argparse
import re
import numpy as np
from sam.model import SAM
try:
import cg2all
has_cg2all = True
except ImportError:
has_cg2all = False
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Generate a conformational ensemble for an input... |
e503e7ea849b63f0198e6f5ecb3bf7ef575bebdf8b72c44b6d7d5a192fcb540c | Python | 4,659 | 101 | """Per-pixel attribution -> per-feature findings.
One ``attribute()`` seam, several methods:
CNN : integrated_gradients (default), saliency, occlusion [Captum]
ViT : attention_rollout, chefer [attention-based]
The method computes a per-pixel importance map for a batch, then
``tran... |
0ca33ecf575fa97cd86948166c5e4b19361fbb5ddfb186955a79700ecc11b813 | Python | 4,660 | 140 | """
Removes rows from deepsignal extract associated with given set of k-mers.
"""
import pickle
import sys
from itertools import product
import numpy as np
import pandas as pd
from utils.bio import valid_cpg_mc_kmer
from utils.constants import METHYL_BED_COLS
from utils.constants import DEEPSIGNAL_EXTRACT_COLS
ME... |
430a05b22d8ffb52288d8b79326d900fbf56b7fcb8cb5538b2eef79f2e04a87a | Python | 4,666 | 146 | # This code is adapted from https://github.com/microsoft/foldingdiff/blob/ac28993b0a3f89440f5c65ef6c37c5db342bdae1/bin/omegafold_across_gpus.py
"""
Short script to parallelize omegafold across GPUs to speed up runtime.
https://github.com/HeliXonProtein/OmegaFold
"""
import os
import logging
import argparse
import sub... |
94c393b8efd4c6c164a32b2cc933236aa011d5abe5126158c5c28a169bafd0b5 | Python | 4,666 | 143 | # 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
# -- REQUIREMENTS -----------------------------------------------------
# pip install s... |
64f62d9589c0f19ac3de02eeeddee05a297d65d9ba925813804f972e164ee991 | Python | 4,667 | 118 | #%%
import os
import gc
import warnings
from copy import deepcopy
from time import time
import numpy as np
import pandas as pd
from scipy.io import loadmat, savemat
from load_intan_rhd_format import read_data, read_header
from utils.write_mda import writemda16i
from utils.filtering import notch_filter
# channel map ... |
ff88e95c3f65bb44f63c80bee01609bf979888162164484156be7463048ae92d | Python | 4,670 | 73 | #TO BE UPDATED
import numpy as np
from WeightModel.WeightClass import weightClass
from InitFunctions import gaussian
class interactiveSynapse(weightClass) :
parameters = {'save' : False,
'Cpre': 1., 'Cpost' : 2., 'tCa' : 20., 'delay_C' : 0. ,
'thetap': 1.3, 'thetad': 1., 'eta' ... |
b22a993449727f0193075ab6cd42a79fc5c4b15dee1f6dee7002c153426d95bb | Python | 4,671 | 96 | """facial asymmetry / mean facial asymmetry index (MFAI).
ported from gui_methods.py's mirror_mesh/compute_asymmetry_heatmap/
calculate_sum/calculate_asymmetry, old repo. swapped out menpo3d's
VTKClosestPointLocator for trimesh.proximity.closest_point - does the same
thing (real closest point on the surface, not just ... |
d83fe8304fcfe8f9aa685402f1ebec765e1790e0b6db3b4fbb523ff5912b815a | Python | 4,672 | 159 | import numpy as np
import pytest
import torch
from motornet.muscle import (
CompliantTendonHillMuscle,
MujocoHillMuscle,
ReluMuscle,
RigidTendonHillMuscle,
RigidTendonHillMuscleThelen,
)
from motornet.skeleton import PointMass
from motornet.effector import (
CompliantTendonArm26,
FreePointM... |
0562b8dfe0c89b5b9b4ceb0baeec40f29ef3b1b10ccdea3ad35dc1bc392d14fd | Python | 4,674 | 90 | import logging
import os
import socket
import sys
from configs.configs import get_config_dict
from helpers.slurm import send_slurm_job_to_queue
if __name__ == "__main__":
hostname = socket.gethostname()
assert hostname == 'hivemind'
assert len(sys.argv) == 5
data_set_name = sys.argv[1] # 'd2', '... |
b0398df23a1b66cd4ebc61486b4defe9b0205efda4a89b346a03d025751d62f7 | Python | 4,674 | 110 | import logging
import os
import socket
import sys
from fcest.helpers.array_operations import get_all_lower_triangular_indices_tuples
import numpy as np
import pandas as pd
from configs.configs import get_config_dict
from helpers.array_operations import slice_covariance_structure
from helpers.hcp import get_human_conn... |
ab912b78ed00536aca1ab275555b5f5c51319c62f5681aa7ba4a7447fc2a676c | Python | 4,676 | 132 | import importlib.metadata
import json
import shutil
import sys
from pathlib import Path
from types import SimpleNamespace
from zipfile import ZipFile
import pytest
from colabfold.citations import write_bibtex, write_rgi_citation
@pytest.mark.parametrize("existing", [False, True])
def test_rgi_citation_preserves_exi... |
d11a50e6470fa6dd17d4b737ac00c59b014dbe4c3b56b756414950183c67ddfb | Python | 4,679 | 96 | """Baseline SOH regressors under protocols P1-P4 (CPU models first: Ridge, LightGBM).
Target: soh_initial (capacity / cell's early-life capacity), consistent across datasets.
Feature sets:
abs : the 16 raw per-cycle statistics
rel : abs + each statistic divided by the cell's mean over its first 10 cycles (c... |
1fae38d4e01177a29016ecada2975709c03b057d64ed9604adedf9c0781317b0 | Python | 4,680 | 125 | ####################################################################################
#
# 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... |
ab9949d84ac3bcbcc0dd5e2c5e91cd72fc7deb9f25465cc6310b76eacef15488 | Python | 4,680 | 167 | # TODO TURN INTO PROPER CODE THAT CAN BE INTEGRATED INTO THE PACKAGE WORKFLOW
# run python implementation of turboreg
import numpy as np
from matplotlib import pyplot as plt
from imagingplus.main.core import ImagingTrial
from pystackreg import StackReg
from skimage import io
from imagingplus.utils.images import Impo... |
45c9bb7fe79470f33c5b1f2cf680ff5d4ebea191300371c33c6f5e366ea695d7 | Python | 4,681 | 91 | """Point-model levers under P4 (LightGBM backbone), 3 seeds:
base : anchored (abs + rel) features [reference, ~4.2% MAPE]
dsnorm : + per-dataset unsupervised standardisation (each dataset z-scored with its OWN statistics;
uses only unlabeled target i... |
866e1de7ba1f7eaf8d0b894fb4d33f1128616c9139968a2a51619ae88781ec35 | Python | 4,681 | 125 | ####################################################################################
#
# 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... |
5b6761815a5cb53334166b78e44d275a53cfe9de3ba9f99afcc57e3b80bddb09 | Python | 4,686 | 136 | """
##############################################################################
#
# Calculate exon inclusion scores (forall exons, forall samples).
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: wsciekly.maciek@gmail.com
# CREATED: 05... |
0f50fd868f8d2a6befb603df22e979166c61ac25f358a82ecbbd6e29470e9b38 | Python | 4,687 | 138 | import pandas as pd
import torch
import numpy as np
import os
import matplotlib.pyplot as plt
import src.data as data
from src.main import time_step_blow_up
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
name = "4_98"
# Map location param is required as the model was trained on gpu
model = torch.load(os.path.join("../mod... |
765c41b5382d866c2f54807fb01c761d209669dbde195138bcc258f51f0571d7 | Python | 4,687 | 104 | """ Module for Functional Enrichment Analysis.
This OmicScope module is totally dedicated to Functional Enrichment
Analysis of Omics Experiment.
In this workflow we used GSEApy algorithm to
get two main analysis: Over-Representation Analysis and Gene-Set Enrichment
Analysis. For both cases, GSEApy runs the analysis a... |
45b075ce0ec6edf87b3895b098235ccb7e52ae12f60b2a6bf78ced07b3dcca78 | Python | 4,688 | 144 | import hydra
from hydra.core.config_store import ConfigStore
from config import Scenario
from model import Net
import os
from utils import *
from matplotlib.ticker import FormatStrFormatter
from tqdm import tqdm
import matplotlib as mpl
from matplotlib import font_manager
from scipy.stats import pearsonr
import yaml
fr... |
01b3dceb77b45a242c25c531f8ba74839bec187fea3cbeeb2f8d5be60644dc9e | Python | 4,691 | 137 | # srun --nodes=1 --ntasks=1 --cpus-per-task=8 --gpus=1 --mem=100g --time=06:00:00 --pty bash -i
# Sconda conda activate ghmc1; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/GhmCN/reviewer_questions/distribution_of_genes_and_distances_activ72B; python
import pandas as pd
import numpy as np... |
e5f1a24fda6db134f82a780a3cd50e164c26feb07721ff35a2fdd1dd0c7e3e40 | Python | 4,691 | 159 | # Copyright 2020 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... |
22e9988d942ef9df9d93ed6c0c52a311375366bf7c453b1d517aa21ae13ed2ec | Python | 4,692 | 144 | """
Lightning callback: detect abnormal flow training loss spikes and dump diagnostics.
"""
from __future__ import annotations
import logging
import os
from collections import deque
from pathlib import Path
from statistics import median
from typing import Deque, Optional
import torch
from lightning.pytorch.callbacks... |
50492b5337e6e9948a1b9ddfdecb2f294b3321c062e506480cbae14d6e79fca7 | Python | 4,693 | 98 | from nowcasting.config import cfg, save_cfg, cfg_from_file
from nowcasting.utils import logging_config, parse_ctx
from hko_factory import HKONowcastingFactory
from nowcasting.encoder_forecaster import encoder_forecaster_build_networks, load_encoder_forecaster_params
from hko_main import run_benchmark
import os
import a... |
0e1251bd4f551d1e5a09056c4d26628fa93e9595a6fd3393dec940d6923ff375 | Python | 4,694 | 170 | from cProfile import label
from multiprocessing.dummy import Array
from sys import argv, exit, path
from typing import List
import matplotlib
import matplotlib.pyplot as plt
import xml.etree.ElementTree as ET
import numpy as np
import subprocess
import time
import os
from tqdm import trange
import csv
"""
////////////... |
5965db7c76fb884ba7b294b92805bcb59ec9d1f6f9fe5c46fe3ff1bdeb4aad71 | Python | 4,694 | 118 | """
Tests for folding at home generator suite in perses
TODO:
* Write tests
"""
import os
from unittest import skipIf
running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'
#default arguments for tests
DEFAULT_PLATFORM_NAME='CPU'
DEFAULT_PROJ_ID = {'complex': 1000, 'solvent': 1001, 'vacuum': 1... |
6437e2d5c714ddf0ca03c9ccb8905405313d5ba27a2806ace3660b765d1f83be | Python | 4,696 | 105 | from utils.io import load_test_data_as_tensorflow_datasets,\
load_test_data_as_tensorflow_datasets_with_wavelengths
from models import LSTMParams
import numpy as np
from paths import MODEL_PATH, TEST_DATA_PATH
import glob
import os
def evaluate(_dataset, _data_path, wl):
for model_path in glo... |
a5c95d81e32296ba81a8435054f4736d5f6e1896a7e934d55779aff0c7ea5be1 | Python | 4,696 | 81 | """Statistical validation + the 'ribosomal easy catch' for the DeepMapper biology paper.
(1) VALIDATION: cross-validated separability with a permutation null (CI + p-value) for each of the
paper's classification tasks, so the headline accuracies are backed by statistics, not a single
split. Fast linear classif... |
ded782ba94c420db4d3c985a1bd6c8e96fc3ead4acd7a138f86cf044051e7abe | Python | 4,696 | 125 | # Based on the code from: https://github.com/klicperajo/dimenet,
# https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet.py
import torch
from torch_scatter import scatter
from torch_sparse import SparseTensor
from math import sqrt, pi as PI
from torch_geometric.nn import knn_graph
... |
6a5a0647fc8acaa26e372403068f89969b4eae26c09283e0caca9701fa0f0198 | Python | 4,697 | 122 | "Flow decorrelation"
import os
import sys
from tqdm import tqdm
from datetime import datetime
from glob import glob
import pandas as pd
import numpy as np
import torch as T
import matplotlib.pyplot as plt
import hydra
from omegaconf import DictConfig
from sklearn.model_selection import train_test_split
import pipelin... |
d57123d7df7d4dbf7c8feeff83d7610ef979844505876d841dec2fc24baa5bf9 | Python | 4,702 | 136 | from collections import namedtuple
import h5py
from ...transforms import StaticTransform
from ...utils import recursively_load_dict_contents_from_group
from ..base import TransformDataset, default_image_datapoint
class StaticSet(TransformDataset):
def __init__(self, *data_keys, transforms=None):
"""
... |
1f1362941de9f7e19672a64b7098dd2341648845da6ba8bc6f12969ce2f44dd2 | Python | 4,704 | 149 |
import numpy as np
from scipy.interpolate import LinearNDInterpolator
from tqdm import trange
from chreyesees.rbf.rbfinterp import RbfModel
import warnings
def nan_rbf_interpolator(X, Y, sample_weight=None, copy=True, error='ignore', **kwargs):
if copy:
Y = Y.copy()
if sample_weight is None:
... |
c716433d26442f3c11656144074b09737cd6a2ec791b689b11fd8ca0f2465552 | Python | 4,706 | 196 | """Pydantic model for default configuration and validation."""
"""Implementation based on the template of Matformer."""
import subprocess
from typing import Optional, Union
import os
from pydantic import root_validator
# vfrom pydantic import Field, root_validator, validator
from pydantic.typing import Literal
from c... |
d77cd98b6a89f797c60cc5b9202c8bab3fbfc21a367d964b9658ab18c4ff3310 | Python | 4,707 | 133 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import numpy.ma
from ChipseqReport import *
##########################################################################
##########################################################################
###################... |
007718b5575d2078a5fc14c126ca56d21ace273756c5ecbc96d219d458fc05ff | Python | 4,708 | 132 | """
Utilties for converting to/from a dictionary representation of domain assignments.
"""
import logging
import os
from itertools import product
import numpy as np
import warnings
from Bio.PDB.PDBExceptions import PDBConstructionWarning
warnings.simplefilter('ignore', PDBConstructionWarning)
LOG = logging.getLogge... |
1342136988c6eb46e8b1510700c4ccc403bf51271c38ff36d14d23f03ece167c | Python | 4,708 | 121 | import cv2
import numpy as np
import matplotlib.pyplot as plt
from skimage.transform import resize
from skimage.filters import gaussian
from scipy.ndimage import rotate
import math
from dipy.data import get_fnames
from dipy.align.imwarp import SymmetricDiffeomorphicRegistration
from dipy.align.metrics import SSDMetr... |
81bd74bba62387ff4e410d3fdd5da29bd65ba878f5baec1596de0964235d381d | Python | 4,709 | 152 | import os
import numpy as np
import pandas as pd
import argparse
import pyreadr
import scanpy as sc
import anndata
import sklearn
import umap
import annoy
import torch
from torch import nn, optim
from collections import OrderedDict
from types import SimpleNamespace
def prescient_read_data(data_path, meta_path, out_d... |
f17fe70c02fc8aed2832edec361bb26dd7ef707895c757b3fe122966935238d3 | Python | 4,709 | 128 | # Libraries
import numpy as np
try:
from tensorflow.keras import backend as K
except ImportError: # TensorFlow is optional for lightweight/Python 3.13 installs.
K = None
def _require_backend(backend):
if backend is None:
raise ImportError(
"TensorFlow is required for this metric/loss... |
a4786221094405f98e6f379e611fd7dd7764724a6366263ed9fa3d346badfc53 | Python | 4,710 | 112 | from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from mimic3benchmark.readers import LengthOfStayReader
from mimic3models import common_utils
from mimic3models.metrics import print_metrics_regression
from mimic3models.length_of_s... |
ecf3ae3344a6fdf21abdea2b7c750dae9d5e7390f7a189f4d7056ad0107a63f6 | Python | 4,716 | 135 | """Filter that uses an LLM to drop documents that aren't relevant to the query."""
from collections.abc import Callable, Sequence
from typing import Any
from langchain_core.callbacks import Callbacks
from langchain_core.documents import BaseDocumentCompressor, Document
from langchain_core.language_models import BaseL... |
96323ce507232d7d3f53f1820c246409bd6038585a1baf51c0c63575a5a4f8d3 | Python | 4,717 | 143 | #!/usr/bin/env python
import argparse, sys
from argparse import RawTextHelpFormatter
import gzip
__author__ = "Colby Chiang (cc2qe@virginia.edu)"
__version__ = "$Revision: 0.0.1 $"
__date__ = "$Date: 2015-04-13 14:31 $"
# --------------------------------------
# define functions
def get_args():
parser = argpars... |
3a0ee226a96ff48f61eeece575b7ad1546fb01197193743c2628b1d6da05d5f9 | Python | 4,720 | 115 | import math
import torch
from torch.optim.optimizer import Optimizer
class EAdam(Optimizer):
r"""Implements Adam algorithm.
It has been proposed in `Adam: A Method for Stochastic Optimization`_.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
paramete... |
97bb977d7a2d02ba93c44f83bb36acb359bfb3813476b02ed1c6d0dca4d15e94 | Python | 4,720 | 128 | from collections.abc import Hashable
import pandas as pd
import pytest
from pgmpy.structure_score import (
BIC,
K2,
BaseStructureScore,
BICCondGauss,
BICGauss,
)
from pgmpy.structure_score._base import get_scoring_method
class CountingScore(BaseStructureScore):
def __init__(self, data, max_c... |
2bc4b22a0f5d0e539b80c02a3cdbe1a67791d0e5af06eafbf94dc5ef297807c7 | Python | 4,722 | 106 |
# *=========================================================================
# *
# * Copyright Erasmus MC Rotterdam and contributors
# *
# * Licensed under the GNU GENERAL PUBLIC LICENSE Version 3;
# * you may not use this file except in compliance with the License.
# *
# * Unless required by applicable law or agr... |
1122d1cf464a79b6d71f50ce4f3a68f18f29dd688d45b234a9042cb102e78532 | Python | 4,723 | 121 | """
Analyze subject's performance over the course of the task sessions at the subject level.
"""
import argparse
import data_analysis_utils as dana
import matplotlib.pyplot as plt
import model_learner as model
import numpy as np
import os.path as op
import plot_utils as plut
import scipy.stats
FIGSIZE = (plut.A4_PAPE... |
a450831bc53dedc71e20933158f46fe0449bae806359c32cb59d1b34de2c2e24 | Python | 4,723 | 81 | """Donor/batch control for the interferon signature (round-3 Reviewer G #2).
Is the stim-vs-ctrl ISG separation the designed IFN-beta response, or could it be an ex-vivo handling /
donor-batch artefact? We compute a per-cell ISG score (mean log-CPM over canonical ISGs) on the Kang
GSE96583 batch-2 lanes, align each ce... |
af4aecb725ba1809c98faca794fbf64998b6fa0e721f0868ca67c8ec8d7e77aa | Python | 4,723 | 129 | import nltk
from nltk.chunk import conlltags2tree, tree2conlltags
#from sklearn.model_selection import train_test_split
try:
# Python <= 3.9
from collections import Iterable
except ImportError:
# Python > 3.9
from collections.abc import Iterable
from nltk import ChunkParserI, ClassifierBasedTag... |
51754c86c03afc236faa4cf20e061b0fc5ab5a5c710f08d539186d73665cde0f | Python | 4,724 | 120 | import torch
import torch.nn as nn
from torch.nn.functional import grid_sample
from ..utils.utils import get_gaussian_kernel
class ZephIR(nn.Module):
def __init__(self,
allow_rotation,
dimmer_ratio,
fovea_sigma,
grid_shape,
grid_... |
1a3ee72fcd5c0bd62ef14f07145131e3cf6183287f865372de9e2390d9bad01a | Python | 4,725 | 151 | from pathlib import Path
import numpy as np
import pytest
import torch
import torch.nn.functional as F
import chroma
from chroma.data import xcs
from chroma.data.protein import Protein
from chroma.layers.structure import backbone, conditioners, rmsd, symmetry
from chroma.models.graph_backbone import GraphBackbone
fro... |
9252929d0628cc33c6ec7ca61767f11bfc22c7d68f8eda2ef41b4a9fcdb74a7d | Python | 4,726 | 134 | """
Implementing the "blacklist" feature weighting metric proposed by
Tiedemann & Ljubesic.
Marco Lui, February 2013
"""
NUM_BUCKETS = 64 # number of buckets to use in k-v pair generation
CHUNKSIZE = 50 # maximum size of chunk (number of files tokenized - less = less memory use)
import os
import argparse
import nump... |
6fd0521f2e99f16de535fa9b2cac6b4abbdefd4d3969edd4d1d33c0f2f1881f2 | Python | 4,727 | 114 | """Module to test base parser implementations."""
from typing import Any, get_type_hints
import pytest
from typing_extensions import override
from langchain_core._api import LangChainDeprecationWarning
from langchain_core.exceptions import OutputParserException
from langchain_core.language_models import GenericFakeC... |
b49b1f4482df6123869b2767d19c6d99248f297545d30d502798e124ddc2cb85 | Python | 4,729 | 161 | # Import MKL for multi threading
try:
import mkl
except:
print("MKL not found, please pip install for best performance.")
import numpy as numx
from os.path import isfile
import sys, os
# Needed to load existing files, otherwise modules structure is not found
sys.path.append(os.path.split(os.getcwd())[0])
from... |
094381e050063ff2c20255eb380b272077356b0ed3619fe9343e1bef8e17d839 | Python | 4,733 | 136 | import itertools
import glob
from cgatReport.Tracker import *
from cgatReport.Utils import PARAMS as P
from cgatcore import pipeline as Pipeline
import cgatPipelines.PipelineTracks as PipelineTracks
###################################################################
####################################################... |
43e0f3b754704272fc147cd66d756bc43743f66214e7dede6ca5d99d7aad9b91 | Python | 4,734 | 138 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import shutil
import glob, os, sys
import random
from multiprocessing import Process, Manager, Pool, freeze_support
import subprocess
from mantis_ml.config_class import Config
from mantis_ml.modul... |
64010c1fe059b5f198fcbec27287e79e99c0a0e93a3a0f7f66c8da70a6396aa7 | Python | 4,739 | 101 | import gym
import random
from gym import spaces
import numpy as np
import logging
from random import sample,choices,uniform, randint
from math import ceil
from Environments.DSSdirect_13bus_loadandswitching.DSS_Initialize import *
from Environments.DSSdirect_13bus_loadandswitching.state_action_reward import *
from gym.u... |
cebf40615a983cb8adf69bca8d26f133b13c3d5bbb798267f7d2179aba9235a0 | Python | 4,740 | 121 | import numpy as np
def mse_loss_at_residue(V_hat, Y, residue_index):
# loss contribution of residue given current assignment
# assumes Y is symmetric
d = residue_index
# avoid double-counting the diagonal
return 2*((V_hat[d]@V_hat.T - Y[d])**2).sum() - (V_hat[d]@V_hat[d] - Y[d,d])**2
def null_ms... |
27045feb494c70793c19ea81d54593759f85607c3c4b18c2130d61edfad9ff30 | Python | 4,741 | 136 | ''' Example using GB-RBMs on a natural image patches.
:Version:
1.0
:Date:
06.06.2016
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2016 Jan Melchior
This program is free software: you can redistribute it and/or modi... |
0d1329945f81fe80917ff2e5851a89eb15b63ccd23460caa7490c13f99b919cf | Python | 4,743 | 156 | import re
import numpy as np
import torch
from utils.encoding_methods import onehot_encoding, pssm_encoding, position_encoding, hhm_encoding, cat
from torch_geometric.data import Data
def load_seqs(fn, label=1):
"""
:param fn: source file name in fasta format
:param tag: label = 1(positive, AMP... |
493631509cc7d74932ac464afb9a1ed6aca3037d720eda30dd586e90b748d022 | Python | 4,744 | 117 | import pandas as pd
from sklearn.base import clone
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from pgmpy.causal_discovery._base import BaseOrderDiscovery
class R2Sort(BaseOrderDiscovery):
r"""Causal discovery by sorting global R^2 values and regressing on predecessors.... |
05824fd41e10d90009cf50678a0759f9d4b5aaab122ed0c8a405b10fbc0fb207 | Python | 4,745 | 113 | import sys
import os
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import pandas as pd
import numpy as np
sys.path.insert(1, os.path.join(sys.path[0], '../../../../'))
import Articles.Sequential_Learning_Striatum.Figures.cfg_pdf as cfg
from NetworkModel.StriatumNeurons import params_MSN_Yim, pa... |
e9c17a9c06d322588b6e3f1b62e6764b05c7b22823efccdcf79bf71ef7cb0009 | Python | 4,745 | 116 | import os
import pandas as pd
if __name__ == '__main__':
import sys
sys.path.append(os.path.join('..'))
from morgana.DatasetTools.morphology import computemorphology
from morgana.DatasetTools.morphology import io as ioMorph
from morgana.DatasetTools.straightmorphology import computestraightmorphology
from mor... |
f0cdf8d89bf169899d653e829aef67e5f6ba66e9268f0ece36f15ed8ccc332ab | Python | 4,745 | 118 | # *_*coding:utf-8 *_*
import os
import json
import warnings
import numpy as np
from torch.utils.data import Dataset
warnings.filterwarnings('ignore')
def pc_normalize(pc):
centroid = np.mean(pc, axis=0)
pc = pc - centroid
m = np.max(np.sqrt(np.sum(pc ** 2, axis=1)))
pc = pc / m
return pc
class Par... |
43614c938d8db7b6ddc9ca17894538c5967de35e420b45c2c07cc337eb8059df | Python | 4,746 | 121 | import shutil
from ..utils.utils import *
def save_annotations(
container,
results,
save_mode,):
"""Save results to file.
Handles tracking results and compiles to an annotations data frame to save
to file according to save_mode: 'o' will overwrite existing annotations.h5,
'w' will write ... |
9751000cad949e063c57bbb9736cd8a7423518ef597e8949534810c10cca3629 | Python | 4,746 | 98 | from networks.efficientunet import Effi_UNet
from networks.enet import ENet
from networks.pnet import PNet2D
from networks.unet import UNet, UNet_DS, UNet_URPC, UNet_CCT
import argparse
from networks.vision_transformer import SwinUnet as ViT_seg
from networks.config import get_config
from networks.nnunet import initial... |
86c3b09fac9157c50450866b6bc0ebd52f2871a0002a33929ab44d139b751408 | Python | 4,748 | 158 | """Test XMLOutputParser."""
import importlib
from collections.abc import AsyncIterator, Iterable
import pytest
from langchain_core.exceptions import OutputParserException
from langchain_core.output_parsers.xml import XMLOutputParser
DATA = """
<foo>
<bar>
<baz></baz>
<baz>slim.shady</baz>
<... |
9219c7d6e3ef4de039c1a7c4f32a19788fed7da035e0887f400489cb19807a23 | Python | 4,750 | 156 | import numpy as np
from tensorflow.keras import Model
from tensorflow.keras.layers import AveragePooling2D, AveragePooling3D, GlobalAveragePooling2D, GlobalAveragePooling3D, \
Input
from explainability.layers import AveragePoolingLRP
def test_avgpool_2d_lrp():
input = Input((... |
1095680bce612d6bff7a7b27d828a2314b249a3e46182cac507437ec9e74709d | Python | 4,755 | 108 | import pathlib
import jax
print(jax.devices())
from CEL.utils.config_reader import config_summoner
from CEL.utils.args import args_parser
import torch
from CEL.data.data_manager import load_dataset, load_dataloader
from CEL.networks.model_manager import load_model
from CEL.experiments.exp_manager import load_experimen... |
952adb0046314dc7d2460e924deb9df0f5f58e4ec20563822281d9d72c96310f | Python | 4,757 | 165 | import logging
import os
import socket
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from configs.configs import get_config_dict
from helpers.data import normalize_array
from helpers.figures import set_size
from helpers.rockland import get_rockland_subjects, get_convolve... |
c8edeb6d4cd82f3f9b98106ddb81d7216eb81565079181b90dae80b7b7977be9 | Python | 4,757 | 106 | # 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... |
c5e77de61265fffc68ff906b261bc7b30574c8162acba50b621476e4fdf6bd57 | Python | 4,758 | 133 | import os
import sys
import re
import types
import itertools
import PeakcallingReport
from cgatReport.Tracker import *
from collections import OrderedDict as odict
##########################################################################
##########################################################################
####... |
aade903fcf4ede8c3ee8d434db7f884f37ab659bb276da408246c60012583510 | Python | 4,759 | 123 | """ Test module for cost functions.
:Version:
1.1.0
:Date:
13.03.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 so... |
c76a596da322233c8650ffd38e2335d978389de2c3a496910bfb8650c6054169 | Python | 4,759 | 137 | # -- coding: utf-8 --
# @Time : 2022/10/15 16:11
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : heco_config.py
import time
from yacs.config import CfgNode as CN
# --------------------------------------------------------------
# Config of model
# -----------------------------------------------------... |
62ac7cdb03d6178b125d1433d5060e8e8bfc43cd74f6e9d80bf056d64a63b4eb | Python | 4,760 | 135 | from absl import logging
import numpy as np
import tensorflow as tf
import cv2
YOLOV3_LAYER_LIST = [
'yolo_darknet',
'yolo_conv_0',
'yolo_output_0',
'yolo_conv_1',
'yolo_output_1',
'yolo_conv_2',
'yolo_output_2',
]
YOLOV3_TINY_LAYER_LIST = [
'yolo_darknet',
'yolo_conv_0',
'yolo... |
6b17d94d30f1a61c4ef145333ee3f19ff4a79876d4cd9f75799665d6323caa51 | Python | 4,761 | 140 | # %% Imports
from argparse import ArgumentParser
from pytorch_lightning import Trainer
from torch.utils.data.dataloader import DataLoader
from modeling.ProtBertPPIModel import ProtBertPPIModel
from typing import List
import pandas as pd
from pandas.core.frame import DataFrame
from transformers import BertTokenizer
from... |
966cbccb97267aa814017b1a315e2fe6690f187dbbc44dae54f35d4f848fd70f | Python | 4,761 | 97 | import sys
import os
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
sys.path.insert(1, os.path.join(sys.path[0], '../../../../'))
from Analysis.AP_Analysis import AP_protocol, add
from Articles.Sequential_Learning_Striatum.Figures.FigureSequential import *
np.random.seed(0)
y_label = ['mV', '... |
a40b78bb97b2132d712485dd21bf7081931d85944ccdab1dbaa8ecf9d07b02e8 | Python | 4,761 | 156 | import logging
import pathlib
import torch
import torch.nn as nn
from tqdm import tqdm
import torch.multiprocessing
import os
import pandas as pd
from collections import defaultdict
from pathlib import Path
##
# from apex.optimizers import FusedAdam, FusedLAMB
####
from config import config as hu_config # merge with ... |
ca16b2cc3268526f0cb87d62de82e9684a46d4d24db42fc071b64cfcaeeb6c80 | Python | 4,764 | 176 | #!/usr/bin/env python2
"""Filter and enrich the results of goatools
Usage:
python ./01_scripts/05_filter_goatools.py input_enrichment go_database output_enrichment fdr_threshold max_go_level
"""
# TODO Fix this for goatools 1.1.6 output
# Modules
import argparse
import sys
# Classes
class Go_term(object):
d... |
fa2929871958a53f438e0d02bb39f6d8b3dc3a4d03532f51884264ca37a86b4e | Python | 4,764 | 129 | from src.data import get_sim_data
from src.interpret_LSTM import Net
import torch.nn as nn
import torch
import torch.optim as optim
import numpy as np
import os
import copy
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
import matplotlib.pyplot as plt
from typing import List
plot_loss = ... |
ef671a7ca57d405e49609b7c109d9c9936d04f190438ec9a38313201f0d19444 | Python | 4,765 | 131 | from keras.models import Model
from keras.layers import Input, add, multiply, Conv3D, LeakyReLU, Lambda, UpSampling3D, UpSampling2D
import tensorflow as tf
from keras.layers import Layer
from keras import initializers
import keras.backend as K
import numpy as np
def XxGlobalAveragePooling(input):
return tf.reduce... |
63187a6a9b83a4b45cf52c6bb7acc35887993d0041d64c25381c2140d7ec05f3 | Python | 4,766 | 88 | import scipy.io
import numpy as np
import pandas as pd
from skspatial.objects import Line
from skspatial.objects import Points
def get_probe(probe_number, probe_coordinates):
probe_df = pd.DataFrame(probe_coordinates['pointList'][0][0][0][probe_number - 1][0], columns=['ML', 'DV', 'AP'])
probe_df = probe_df *... |
7e53665186b9069447e9823c01d7a6cb6960b32a6d7622455db86e4c4a2a1533 | Python | 4,767 | 118 | import os
import argparse
from tqdm import tqdm
import SimpleITK as sitk
from natsort import natsorted
import pydicom
TIMES = ['Preop', 'Intraop']
def parsing_data():
parser = argparse.ArgumentParser(
description='Conversion DICOM images from TCIA into NIFTI/NRRD')
parser.add_argument('--path_dicom',
... |
608393b4387f4e59f7ebca74813b6085343d9166af313605b948c411ff264d44 | Python | 4,772 | 126 | import numpy as np
import pandas as pd
import pytest
from pgmpy.causal_discovery import IGCI
@pytest.fixture
def nonlinear_data():
"""Generate near-deterministic data with X -> Y."""
rng = np.random.default_rng(0)
x = rng.uniform(0, 1, 500)
y = x**3 + rng.normal(0, 1e-3, 500)
return pd.DataFrame(... |
bb1835826ae96fdc4a92ddbadc386693b8a40461aa73060164b8dcd95f60a57b | Python | 4,772 | 117 | # Picks a certain number of probes from the EPIC array ranked in order of number of species we can cover with that
# probe design.
from __future__ import print_function
import sys
import gzip
from collections import defaultdict
import operator
def main():
if len(sys.argv) != 8:
print("Usage: python pickPr... |
8831ae87cd8321068efe1cef3f7648a95093eacb37e28a6538b33e47c8be9b21 | Python | 4,773 | 155 | """Abstract interface for document loader implementations."""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
from langchain_core.runnables import run_in_executor
if TYPE_CHECKING:
from collections.abc import AsyncIterator, Iterator
from langchain_tex... |
bde672fd90f24ab835397dacb0347287d7fe8db13a7e234b1c59e3502b42278c | Python | 4,775 | 133 | import datetime
import time
from logging import getLogger
from multiprocessing import Pool, cpu_count
from pathlib import Path
from typing import Dict, List
import hydra
import mlflow
import numpy as np
from mlflow import log_metric
from omegaconf import DictConfig
from tqdm import tqdm
from libs.function.utils impor... |
156d2174c0069c149630868612e791d0e07364abdc74159c80ab37d1ee6e1af8 | Python | 4,777 | 105 | import pandas as pd
import numpy as np
from sklearn.feature_selection import SelectKBest, f_classif
from statsmodels.stats.multitest import multipletests
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler, StandardScaler
import argparse
from pandas.api.types import is_string_dtype
de... |
27016a50bba4ddbb2a3ca3609c153105938e7b4f9f1ed0c9b0f9e0c7e3ada2c0 | Python | 4,777 | 147 | """Base classes for chain routing."""
from __future__ import annotations
from abc import ABC
from collections.abc import Mapping
from typing import Any, NamedTuple
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
Callbacks,
)
from pydantic import ConfigD... |
fd07ee7d5012d9b23f6b5e073474adde4a390c46b5145012490567588cc448b5 | Python | 4,777 | 125 | import argparse
import gzip
import pickle
from tqdm import tqdm
from pymatgen.core import Composition
from crystallm import (
extract_formula_nonreduced,
extract_formula_units,
extract_space_group_symbol,
)
import warnings
warnings.filterwarnings("ignore")
def load_cifs(fname):
print(f"loading data ... |
19f39573f0e827f85851265ada417baa093c624f30d35827d0ba80ca34829f35 | Python | 4,778 | 138 | #!/usr/bin/env python3
"""Average Network / Density / Total across independent efficiency_test repeats."""
from __future__ import annotations
import argparse
import json
import statistics
import sys
from collections import defaultdict
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
... |
7ed65635b3392840b68b301f87dd86675b8fd564e331a5fb3533248e5ec4acaf | Python | 4,779 | 138 | # -*- coding: utf-8 -*-
#~~~~~~~~~~~~~~IMPORTS~~~~~~~~~~~~~~#
# Standard library imports
import os
from collections import OrderedDict, namedtuple, Counter
# Third party imports
from pyfaidx import Fasta
# Local imports
from pycoMeth.common import *
#~~~~~~~~~~~~~~CLASS~~~~~~~~~~~~~~#
class CoordGen():
def __in... |
86276f49e0111d05b7e1e1e2f1b248b1ce18cbe45bd942f165077a1115e19ba7 | Python | 4,780 | 142 | """Utility scripts for pydeface."""
import os
import shutil
import sys
from pkg_resources import resource_filename, Requirement
import tempfile
import numpy as np
from nipype.interfaces import niftyreg
from nibabel import load, Nifti1Image
from shutil import copyfile
def initial_checks(template=None, facemask=None):... |
fef435c20e3f520c9663ac9721f4677e57116693a9a28c25a061f568a75d6e19 | Python | 4,781 | 118 | """SO(3) diffusion methods."""
import numpy as np
import os
from functools import cached_property
import torch
from scipy.spatial.transform import Rotation
import scipy.linalg
### First define geometric operations on the SO3 manifold
# hat map from vector space R^3 to Lie algebra so(3)
def hat(v):
hat_v = torch.... |
fdbd3f661b3c90ad7466574cbe05a4d2cf5c12061d32ae53a56347abe832c240 | Python | 4,782 | 97 | #! /usr/bin/env python
from __future__ import print_function
import numpy as np
import nibabel as nib
import argparse
from fernet.pipeline import *
from fernet.utils import nifti_image, read_dwi
DESCRIPTION = '''
Creates WM and CSF rois for running FERNET.
'''
def buildArgsParser():
p = argparse.ArgumentParser... |
496859a45420d8da4ed77f4410e6bb9287684c1a2f1f265d075a7053fc530137 | Python | 4,783 | 138 | import os
from typing import Union
import numpy as np
import torch
import torch.jit
from ase.calculators.calculator import Calculator, all_changes
from ase.data import chemical_symbols
import hienet._keys as KEY
from hienet._const import HIENET_0
import hienet.util
torch_script_type = torch.jit._script.RecursiveScri... |
b9ef776979fd8e3b284cc5dc6a73a3adfeb33e8f88698e47bf702b2a4cca28df | Python | 4,783 | 126 | """
Notes:
- Fast Weights under/overflows if using Relu with eta or lam > 0
"""
import numpy as np
import tensorflow.keras.datasets.mnist as mnist
from fastweights import FeedforwardNet, FastWeights, weights_to_vector, vector_to_weights
from dt_utils import Timer, numerical_gradient
from neural_net_... |
7aa8e7ea6afc8e3f78c8129e0d0859b9a9c22c10d6a6a364d3b93a60a9424841 | Python | 4,784 | 126 | from typing import Tuple
import numpy as np
import torch
def raster_scan_idx_3d(rows: int, cols: int, depths: int) -> np.ndarray:
"""Return indices of a raster scan"""
idx = []
for r in range(rows):
for c in range(cols):
for d in range(depths):
idx.append((r, c, d))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.