sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
351becf49ad0fdcd75361c6225e2d6ab6b445f02f1eb6ac18261c615dc0df56a | Python | 13,445 | 297 | # Usage example : python3 make_json_rnaseq.py -g gs://xyz/rna-seq/human/batch7_20220316/fastq_raw -o `pwd` -r batch7_qc_metrics.csv -a human -n 1 -d gcr.io/motrpac-portal/motrpac-rna-seq-pipeline/
import argparse
import json
import os
import sys
import gcsfs
import numpy as np
def main(command_args: argparse.Namespa... |
018668a953e13bb5e7add56d5ff9a50475b91a8af7c14cd7e344835f68df05d3 | Python | 13,446 | 312 | import tensorflow as tf
import numpy as np
import cv2
from skimage.segmentation import watershed
from DataGenerator import circ_region
from generate_network import generate_network
from scipy.ndimage import maximum_filter
#Dictionary key for text and variable translation for image_dict, used in SegmentPrediction, Upda... |
14128d6cc34ceb928e68db367a4684b11db305945438c95fc8d82b9609e62dfd | Python | 13,448 | 382 | """Module implements an agent that uses OpenAI's APIs function enabled API."""
from collections.abc import Sequence
from typing import Any
from langchain_core._api import deprecated
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.callbacks import BaseCallbackManager, Callbacks
from lang... |
4bfc0d9ce2e18d5a5249cebc1a740c67e492a6acff5714cffe2eaea1126415a8 | Python | 13,458 | 352 | """
Utility functions for handing small molecules
"""
__author__ = 'John D. Chodera'
import numpy as np
def sanitizeSMILES(smiles_list, mode='drop', verbose=False):
"""
Sanitize set of SMILES strings by ensuring all are canonical isomeric SMILES.
Duplicates are also removed.
Parameters
-------... |
2c47e15800db6a859a3f12102cfdd0f63062bf261f62be2e490c10186777f2fc | Python | 13,460 | 275 | import matplotlib.pyplot as plt
import mne
import os.path as op
import numpy as np
from mne.channels.layout import _merge_grad_data
from mne.channels import find_ch_adjacency
from mne.stats import spatio_temporal_cluster_1samp_test
import glob
from copy import deepcopy
from scipy import stats
from scipy.sparse import ... |
5db22ad92bda7b4dab88691da397a5b5a757c53e9ee14afb983ebf15b773ef3d | Python | 13,471 | 399 | from dataclasses import dataclass, field
from functools import cached_property
import numpy as np
import pandas as pd
from skbase.base import BaseObject
from skbase.lookup import all_objects
from sklearn.base import clone
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
class _ResidualMixin... |
c77a526cfc6ba5421d689b72026bf6fd940b4b97aa3105aafcbbe57dce7ac259 | Python | 13,482 | 291 | # %%
"""
==============================================================================================
Study of the effect of the duration of the signal on the classification performance
===============================================================================================
"""
# Authors: Marie-Constance Cors... |
722a37214be5fdb65a1c5d30f8c13af55a9e6983d9e66098ed2c40d65cf5741c | Python | 13,483 | 407 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 22 13:54:54 2021
@author: Bruno Caneco
Purpose: Main script to evaluate the current performance of Salmon Scale Circuli detector on fresh images.
Brief pipeline description:
(i) Convert annotations from pascal voc xml to text files
(ii) Convert detections from... |
c911533984aad2ca244bd325a0af0d7c4f0641b6746021b67d77853a05d13b73 | Python | 13,503 | 352 | """====================
Gene Info Pipeline
====================
Overview
========
This pipeline generates a database of annotations mapped to ensembl gene ids
for all current genes in Entrez Gene for a chosen species.
The annotations are downloaded from various APIs.
This database provides annotation information abo... |
2574ad1b899d65c0386c92aa1e7bcf05a815f96717cfee6d258a50c0300947da | Python | 13,513 | 400 | import torch
from EPI_MRI.ImageModels import *
from EPI_MRI.InitializationMethods import *
from EPI_MRI.Preconditioners import *
class EPIMRIDistortionCorrection:
""" Objective function and Jacobian correction for EPI-MRI.
Defines and implements a distortion correction model and optimization problem for
Echo-Plan... |
3d0eaa5ac8a6ee27df3c9a1cca8b0061d13ef2c503878a06c3ab85f72719d348 | Python | 13,522 | 353 | """
Utility functions for handing small molecules
"""
__author__ = 'John D. Chodera'
import numpy as np
def sanitizeSMILES(smiles_list, mode='drop', verbose=False):
"""
Sanitize set of SMILES strings by ensuring all are canonical isomeric SMILES.
Duplicates are also removed.
Parameters
-------... |
9558491fcda54d9b1c67ecb5fd431c4f4743376b02a5b2e34f24108e7a9e6efa | Python | 13,530 | 344 | from typing import Optional
import math
import os
import torch
import torch.nn as nn
from e3nn import o3
from scdp.model.density_synthesis import (
resolve_density_synthesis_mode,
synthesis_basis_from_phi,
synthesis_weights_from_coeffs,
)
from e3nn.util.jit import compile_mode
from scdp.common.constants i... |
a9535bbde3f74a735f875327fc559ae30e397b5db61d12e4b084f8976cd85c6f | Python | 13,538 | 405 | from abc import ABC, abstractmethod
from typing import Dict, Optional
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from tensorboardX import SummaryWriter
from torchvision.utils import make_grid
from ..utils import reshape_conv2d_weights
from .plotting import plot_conv2d_weights,... |
b024af247b928761347e1706f28cedffe9bb10fec36fb26cfb54c32cd8c9a1d7 | Python | 13,540 | 359 | """
Parse CCLE datasets
download link: https://depmap.org/portal/download/all/
version: Public 22Q4
"""
import pathlib
import numpy as np
import pandas as pd
import sklearn.preprocessing as skpre
class ParseCCLE:
"""
"""
def __init__(self, root=None, omics=None, model=None, transformed="MinMax", debug=F... |
63b62d5274bc90fd18d22914e8b95eedd046aa6854d4828c77f261c0a0309dcb | Python | 13,542 | 366 | """SO(3) diffusion methods."""
import numpy as np
import os
from data import utils as du
import logging
import torch
def igso3_expansion(omega, eps, L=1000, use_torch=False):
"""Truncated sum of IGSO(3) distribution.
This function approximates the power series in equation 5 of
"DENOISING DIFFUSION PROBAB... |
37ddc26e5d65e9017e8b5fd00eb552f9256a1eabc2c0ecc360161d778f9510d2 | Python | 13,550 | 329 | # Copyright 2024 DeepMind Technologies Limited
#
# AlphaFold 3 source code is 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... |
a3345889dfd8a08fa6d366f37a14017a3c628186ed2c02355e275ab3d84f2241 | Python | 13,553 | 345 | import torch
import os
import matplotlib.pyplot as plt
import src.data as data
from src.main import time_step_blow_up
import numpy as np
import pandas as pd
import seaborn as sns
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
name = "4_98"
model = torch.load(os.path.join("../model", f"model_{name}"), map_location=torch.d... |
d67dba049881e9d59df5fbabc7fee0083386e8821b44b559cc55e8d398b43522 | Python | 13,554 | 298 | import logging
import os
import socket
import sys
import numpy as np
import pandas as pd
from sklearn.metrics import explained_variance_score
from sklearn.linear_model import Ridge
from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_score, KFold
from configs.configs import get_config_dict
fr... |
ee98ccbc0560320a8db15e336cf9db04cce2a855aefce65a7defaf388e56ada9 | Python | 13,559 | 340 | #!/usr/bin/env python
"""
tokenize.py -
Tokenizer for langid.py training system. This takes a list of files and tokenizes them
in parallel.
Marco Lui, January 2013
Copyright 2013 Marco Lui <saffsd@gmail.com>. All rights reserved.
Redistribution and use in source and binary forms, with or without modificat... |
000641fd6f8ac77d5348a507a1474cbd414346708d6d75c4442fe5410ef29bee | Python | 13,585 | 328 | import torch
import torch.nn as nn
import torch.nn.functional as F
from opt_einsum import contract as einsum
import torch.utils.checkpoint as checkpoint
from rfdiffusion.util import get_tips
from rfdiffusion.util_module import Dropout, create_custom_forward, rbf, init_lecun_normal, find_breaks
from rfdiffusion.Attentio... |
0d11f04e1f7735f05ab66b2b402c73613a5b769c74df2c5f8eb168b8f8535560 | Python | 13,586 | 275 | from __future__ import print_function
import sys
import gzip
from collections import defaultdict
from itertools import combinations
def getMaxSpecies(positionComb, maxSpeciesSubset, curChunk, startPos, endPos, refSpecies, pt = False):
# Returns the maximal subset of species that can be covered with a probe startin... |
7490353ed267a35e88e8677504e9cf24803bb5ecb01eb6f87b988c7dab0bebb0 | Python | 13,586 | 285 | #!/usr/bin/env python
# Imports
import unittest
import os.path
import sys
import subprocess
import tempfile
path_to_script = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'bin', 'enrichm')
path_to_data = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data')
sys.path = [os.path.join(os.pat... |
51380de4ea8f660727219fcfb66f2734c4b4c7cc63a9158efe793a0ecdec7d7d | Python | 13,589 | 299 | # Rdkit import should be first, do not move it
try:
from rdkit import Chem
except ModuleNotFoundError:
pass
import build_geom_dataset
from configs.datasets_config import geom_with_h
import copy
import utils
import argparse
import wandb
from os.path import join
from qm9.models import get_optim, get_model, get_au... |
84383d983fecb20d2237087d7f3f6f80e4e599d9f88b617c4b6a6969968ba10d | Python | 13,590 | 349 | # Copyright (c) 2023, Albert Gu, Tri Dao.
import math
from functools import partial
import json
import os
from collections import namedtuple
import torch
import torch.nn as nn
from mamba_ssm.models.config_mamba import MambaConfig
from mamba_ssm.modules.mamba_simple import Mamba, Block
from mamba_ssm.utils.generation ... |
9cd897c8985dd78012ad62958da4789e9eed432c078a379ad86d4117e33485d5 | Python | 13,601 | 259 | #!/usr/bin/env python3
"""Pick targets recommended for testing."""
import argparse
import logging
from easyDesign import alignment
from easyDesign.prepare import cluster
from easyDesign import target_search
from easyDesign.utils import formatting
from easyDesign.utils import guide
from easyDesign.utils import log
fro... |
ee7e473e8102cd09905b7efe9d95ac7f06123d4b2e3a81eaae5e079fa217609b | Python | 13,608 | 225 | # 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... |
cd0ab3d43b377babd3e7473f249e95c26477f8c855bc2ea940177f035eb5f2e3 | Python | 13,610 | 459 | """Plasticity using SNN. Section ...."""
import csv
import dataset
import model
import matplotlib.pyplot as plt
import trainer
import torch
def check(
timesteps,
device,
batch_size,
num_samples_train,
num_samples_val,
num_samples_test,
hidden,
epochs,
):
"""Re-check test results.""... |
29f10ac925a72c1380bbe7d41b91a8b211eb190eb0351c4d4426830c59c54d3c | Python | 13,616 | 406 | """Serializable base class."""
import contextlib
import logging
from abc import ABC
from typing import (
Any,
Literal,
TypedDict,
cast,
)
from pydantic import BaseModel, ConfigDict
from pydantic.fields import FieldInfo
from pydantic_core import PydanticUndefined
from typing_extensions import NotRequir... |
b0d5b4c30448b4906993d3025ffe624c8472d7eab5d11b1afa325df29fce296e | Python | 13,626 | 375 | #!/usr/bin/env python
import pysam
import argparse, sys
import math, time, re
from collections import Counter
from argparse import RawTextHelpFormatter
__author__ = "Colby Chiang (cc2qe@virginia.edu)"
__version__ = "$Revision: 0.0.1 $"
__date__ = "$Date: 2015-09-27 09:31 $"
# --------------------------------------
#... |
dbdaa19fcb419796980954a1a9632b38c85979ec42f2ade86e7177a7ace973a9 | Python | 13,630 | 442 | import numpy as np
import scipy as sp
import scipy.stats
import scipy.spatial
import scipy.spatial.distance
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
import matplotlib.pyplot as plt
import os
import warnings
from pensa.preprocessing import sort_coordinates
def get_feature_subset... |
7d32ae99c3d7f166be807a834f237397228525ccfaebc08a6247b47b7bad9d0b | Python | 13,633 | 452 | """String distance evaluators based on the RapidFuzz library."""
from collections.abc import Callable
from enum import Enum
from typing import Any
from langchain_core.callbacks import Callbacks
from langchain_core.callbacks.manager import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from l... |
41e00b377cbacef4713d88697c06e419f3b8c208d9fcc55be78b53fd5a23c2c6 | Python | 13,636 | 335 | import torch
from functools import partial
_NORM_TYPE_LIST = [
'equivariant_layer_norm',
'sep_layer_norm',
'merge_layer_norm',
'merge_layer_norm_attn_rms_norm', # Use `EquivariantMergeLayerNorm` for the pre-norm layer
# and `RMSNorm` for attention re-normaliz... |
3a48154bf4bdfcbc9f7bc7dc39406039783104bbca36b909dec642ef4a00e9f7 | Python | 13,638 | 274 | import sys
import logging
import time
import numcodecs
import h5py
import numpy as np
import torch
from torch.utils.data import Dataset
from predmoter.core.constants import MAX_VALUES_IN_RAM
from predmoter.utilities.utils import log_table, file_stem, rank_zero_info
log = logging.getLogger("PredmoterLogger")
class P... |
860f86bdf5a22095c471368342eacda26f2214c2f5ab0dd338cefa9de0b72a59 | Python | 13,646 | 349 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 29 15:11:44 2022
@author: haleigh
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg
def runModel(networkSize=(30,30),nevents=40,index=0,add_noise=True,structured_input=None,structured_amp=0.01,strength_deformation=0.... |
9b02b80d63c08f6da1d9dc4f9c9954d33fc53d90a62253b8a32ff2bdbef230c4 | Python | 13,648 | 396 | """Fake chat models for testing purposes."""
import asyncio
import re
import time
from collections.abc import AsyncIterator, Iterator
from typing import Any, Literal, cast
from typing_extensions import override
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
)
... |
3ae3833e190133c9331342b4aa974188249aca00e1d8da9523014c347e4db8a2 | Python | 13,656 | 336 | # Copyright 2024 DeepMind Technologies Limited
#
# AlphaFold 3 source code is 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... |
429b7e9b18fdb1cb887b2f49a336bf22986fc1c7c048b401df543203fab669f2 | Python | 13,660 | 335 | # builtin modules
import logging
import json
from os.path import join as ospj
from collections import OrderedDict
import copy
# third party modules
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau, OneCycleLR, ExponentialLR
from torch_geometric.nn import DataParallel
# pnabind modules
from pnabind.... |
724ec41946055c196345cd2d16b57c2bfc1f2fc932d6ba8f1362ee893127cd3a | Python | 13,667 | 418 | """A chain for evaluating ReAct style agents.
This chain is used to evaluate ReAct style agents by reasoning about
the sequence of actions taken and their outcomes. It uses a language model
chain (LLMChain) to generate the reasoning and scores.
"""
import re
from collections.abc import Sequence
from typing import (
... |
8fca02891318d098d0ee61ae0de8ce632cec2415bfbbf8d12d5737f0b85b5e42 | Python | 13,679 | 407 | import argparse
import datetime
import functools
import getpass
import multiprocessing as mp
import multiprocessing.synchronize as mps
import pathlib
import shutil
import signal
import tempfile
import traceback
import warnings
import zipfile
from typing import Hashable, Tuple
import numpy as np
import pandas as pd
imp... |
68860a2f9085eba02f74b1ea1ad33ff7feaefe722d3fd121230768f441e705ba | Python | 13,681 | 289 | import torch
from CEL.networks.models.meta_model import ModelClass
from torch.autograd import Function
from itertools import chain
from copy import deepcopy
from tqdm import tqdm
from torch.func import stack_module_state
from torch.func import functional_call
from einops import rearrange, reduce, repeat, pack, unpack
i... |
e2e79c07298d73716fd72f2b66f26e21db2a0e907153751819ecb173a4ce88bc | Python | 13,682 | 345 | 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
import cProfile, pstats, io
import Bio.Data.CodonTable as bdc
from itertools ... |
c71077ee952df2b3cb3bc6136b3c6b59c5891a6054f8a7e83653b924aea5b29c | Python | 13,702 | 270 | from typing import Sequence, Union, Any
from collections import OrderedDict
from numpy import inf, exp
import pandas as pd
from hbayesdm.base import TaskModel
from hbayesdm.preprocess_funcs import hgf_ibrb_single_preprocess_func
__all__ = ['hgf_ibrb_single']
class HgfIbrbSingle(TaskModel):
def __init__(self, *... |
103bcf2bcc5715370f2faafdbccd032fcf46db9106f22fe61ef9ec7e6a9f3c4b | Python | 13,706 | 396 | ####################################################################################
#
# 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... |
57abfe7ff2c9088ad1f0c304efd1ad49de4fb3be0cf717715e940db1c9810ee7 | Python | 13,708 | 274 | import numpy as np
from scipy.optimize import curve_fit
import matplotlib.patches as patches
import scipy.stats
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['font.family'] = 'Arial'
matplotlib.rcParams['font.size'] = 7.
matplotlib.rcParams['text.usetex'] = False
matplotlib.rcParams['svg.fontty... |
ea9b5c2fd0ddc92a86d7571ae467ef4cf910a9e13848c46c2bbb636da2f8f34e | Python | 13,708 | 396 | import pytest
from pgmpy.base.ADMG import ADMG
from pgmpy.base.DAG import DAG
class TestADMGInitialization:
"""Test ADMG initialization and basic setup."""
def test_empty_initialization(self):
"""Test creating an empty ADMG."""
admg = ADMG()
assert len(admg.nodes) == 0
assert... |
00c4bacb553f64952c8698084bb71b21793fb28ed62cf76ef92bba69ccd25699 | Python | 13,709 | 349 | # Prediction analyses
# Copyright (c) 2021 Laurent Caplette
import numpy as np
import nltk
import csv, os, re
import torch
from torch import nn
from robustness.datasets import ImageNet
from robustness.model_utils import make_and_restore_model
import h5py, pickle
from sklearn.metrics.pairwise import cosine_similarity a... |
4533270a70c67e6b090cad714cac8d9391ee25a743b48d976e798024958bbfda | Python | 13,739 | 366 | """Example selector that selects examples based on SemanticSimilarity."""
from __future__ import annotations
from abc import ABC
from typing import TYPE_CHECKING, Any
from pydantic import BaseModel, ConfigDict
from langchain_core.example_selectors.base import BaseExampleSelector
from langchain_core.vectorstores imp... |
c0f00bc2b13c0122d12e0032d970c84fd5fb807ba7c5541897ff8c7f6dfa209e | Python | 13,745 | 272 | from typing import Sequence, Union, Any
from collections import OrderedDict
from numpy import inf, exp
import pandas as pd
from hbayesdm.base import TaskModel
from hbayesdm.preprocess_funcs import hgf_ibrb_preprocess_func
__all__ = ['hgf_ibrb']
class HgfIbrb(TaskModel):
def __init__(self, **kwargs):
su... |
4356431b002a20cc67dd3032e54e10d9ab3500a7ec92712fcac692899c37031b | Python | 13,747 | 386 | import time
s_t = time.time()
from dense_unet_ao import DUnet
import tensorflow as tf
#import tensorflow as tf
tf.compat.v1.disable_v2_behavior()
import tensorflow.compat.v1 as tf
import numpy as np
import os
from tqdm import tqdm
import scipy.io as io
import statistics
import argparse
import matplotlib.pyplot as plt
#... |
e2a823c9151fe9cc3cd12a86b85537a795faabdcf8acdb2e0fd583349960c112 | Python | 13,747 | 333 | import os
from torch import nn
import torch
import copy
import numpy as np
from tqdm import tqdm
from sklearn import metrics
import matplotlib.pyplot as plt
from torch.nn import BCELoss
from sklearn.model_selection import train_test_split
from src.PICNN.layers import activation_functions
import src.utils as utils
def ... |
e910d8b11aaba74a6e52907ff80ee2fd01847831825b75f7052128c8c09972af | Python | 13,754 | 249 | """
This script precomputes the gradients of the trained VAMPnet models with respect to the input simulation frames.
The script is supporting execution on HPC cluster, it can be run in parallel for example as an "array job" (as per
SLURM framework terminology) - to this end are presented two relevant arguments to this... |
ed91e6f0c1b8842bd29328b5d201743d967a1f925b2b159f1f17cb68f5ef899c | Python | 13,757 | 345 | import os
import numpy as np
import random
class Reader(object):
def __init__(self, dataset_dir, listfile=None):
self._dataset_dir = dataset_dir
self._current_index = 0
if listfile is None:
listfile_path = os.path.join(dataset_dir, "listfile.csv")
else:
list... |
5a70cc4ccddcdf30ed9308a1ed279c1e4cac9b910d80e77f5ff8e41e6622cfa4 | Python | 13,764 | 404 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.dom.minidom as dom
import xml.dom
import os
import socket
import re
import sys
import datetime
#Version 3
# Dokument erzeugen
implement = xml.dom.getDOMImplementation()
dbpedia_Server="http://greententacle.techfak.uni-bielefeld.de:5171/sparql?default-graph-uri... |
0b0d318b6cbfac1a9d1ba1f9997d6886e61601b91873cde0e9fc840d1867c848 | Python | 13,774 | 294 | # 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... |
f32dd359b391fd6b22f549a26a3b9061b7b48c53e0770ddf2caac62a713bee73 | Python | 13,778 | 319 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Any, Dict, List, Optional
import torch
from pytorch_lightning import LightningModule
from pytorch_lightning.cli import instantiate_class
import torch.distributed as dist
import os
from pdearena import utils
from pdearena.data.... |
e29302ef129b21470d7d67b7af43e2c6cd4980e72c7e41e2dc77fb85b895db27 | Python | 13,795 | 481 | from functools import partial
import fastremap
import numpy as np
import psutil
from tqdm import tqdm
from cloudfiles import CloudFiles, reset_connection_pools, compression
from cloudvolume import lib, chunks
from cloudvolume.exceptions import AlignmentError
from cloudvolume.lib import (
mkdir, clamp, xyzrange, V... |
1799fa117cf67ca689ebf0a38811827929beefed3f0e35abce669b50c376e2ed | Python | 13,797 | 344 | from mimic3models.multitask import utils
from mimic3benchmark.readers import MultitaskReader
from mimic3models.preprocessing import Discretizer, Normalizer
from mimic3models import metrics
from mimic3models import keras_utils
from mimic3models import common_utils
from keras.callbacks import ModelCheckpoint, CSVLogger
... |
768901eecb1354f1e6469491313002ddd5cd33e869a11bb1af8e2a6949b7d7c0 | Python | 13,797 | 332 | #!/usr/bin/env python3
# coding: utf-8
"""
Extract event files for ABCD-specific task-fMRI data processing
Greg Conan: gconan@umn.edu
Created: 2021-06-07
Updated: 2024-01-19 (WRAPPER_LOC fix); 2021-12-03 (the rest)
"""
# Import standard libraries
from datetime import datetime # for seeing how long scripts take to ru... |
2d944d06d9818119df0c258625c69813e571caa06668cb4de7fbcb53c0cd7f72 | Python | 13,801 | 393 | # -*- coding: utf-8 -*-
"""
The implementation is borrowed from: https://github.com/HiLab-git/PyMIC
"""
from __future__ import division, print_function
import numpy as np
import torch
import torch.nn as nn
from torch.distributions.uniform import Uniform
def kaiming_normal_init_weight(model):
for m in model.module... |
ac1d0e5c5b074364e1b3423a4f2a1fe2b5288cd760a6f64b1ebaa4be645c8247 | Python | 13,805 | 462 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pymaid documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 9 22:17:00 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
# aut... |
83ac8cb7559476aace36f3daedb44e1897297b6b84f45c3a971eedb9ddf67b2c | Python | 13,814 | 372 | import numpy as np
import networkx as nx
from tqdm import tqdm
from copy import deepcopy
from scipy.sparse.linalg import eigsh
from scipy.sparse import coo_matrix, csr_matrix, identity
from scipy import sparse
from numpy.random import randn
import os
import random
import torch
from torch_scatter import scatter_sum, sca... |
abf02d9b51d5b8c268aa050601f275146788d1b536c55a93b70d866bd693e53e | Python | 13,818 | 278 | ''' Test module for FNN layer methods.
:Version:
1.0
:Date:
08.02.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 modify
... |
1cd67c71a10c0c7dcaf8d6bfc62b76df0cbda3bce2de1b4f666b6d29e43cce2f | Python | 13,820 | 425 | import numpy as np
from collections import defaultdict
from mne.decoding import TimeDelayingRidge, ReceptiveField
from sklearn.model_selection import train_test_split, LeaveOneOut
from tqdm.auto import tqdm
import mne
mne.set_log_level('WARNING')
class FeatureTargetLoader():
""" Class to load feature (speech fea... |
a427ee8f27dd568bb3931fa2641695003fa0f20a09c4d43679f629a3e4d8be59 | Python | 13,831 | 334 |
"""
In this file the action is evaluated on the circuit to obtain result
"""
import os
import networkx as nx
from DSS_CircuitSetup import*
#------------------- User defined inputs to modify the standard test network ---------------------------------
sectional_swt=[{'no':1,'line':'L25'},
{'... |
36f177b9b1bed6e0c7440a54801045719efbf2776fdc4b2ec41dc604078f5eac | Python | 13,846 | 420 | ##################
# SimCLR networks from Chen et al 2020 in pytorch
#
# Chen, T., Kornblith, S., Norouzi, M., & Hinton, G. (2020). A simple framework for contrastive learning of visual
# representations. arXiv preprint arXiv:2002.05709.
#
# The original simclr weights were converted ported from tensorflow to pytorch u... |
c9b2eed6471797dc52f95d39c3ffb31fd3008b77d02b0eafd4d674f8b9cd48cc | Python | 13,850 | 290 | from typing import Tuple
from KineticAssembly_AD import ReactionNetwork
from KineticAssembly_AD import reaction_network as RN
import networkx as nx
import torch
from torch import DoubleTensor as Tensor
from torch import rand
from torch import nn
class VectorizedRxnNet_KinSim:
"""
Provides a lightweight cl... |
8f6af0735ca4d3419e8dd3860488e1ab6ac820e3dfec553a239af1da6479601d | Python | 13,859 | 426 | import random
import math
import numpy as np
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire, BRepBuilderAPI_MakeFace
from OCC.Core.gp import gp_Circ, gp_Ax2, gp_Pnt, gp_Dir
from OCC.Core.BRep import BRep_Tool
from OCC.Core.TopLoc import TopLoc_Location
from OCC.Core.GC import GC_M... |
e44a7665309bd5c10e46f591129e1e8dd6698f2ca8b5777581ddacb88c3ae641 | Python | 13,861 | 285 | """Check installation prerequisites without processing data or loading models."""
import argparse
from collections import Counter
import importlib
import os
from pathlib import Path
import re
import shlex
import shutil
import sys
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
MODULES = {'pyn... |
4e848368740d403339a3cb978dce4b860815bab759fedc7bdf68ea35acd017ee | Python | 13,862 | 340 | """Domain predictor classes.
"""
import os
import glob
import numpy as np
import pandas as pd
import torch
from torch import nn
from src.domain_assignment.util import make_pair_labels, make_domain_mapping_dict
import logging
LOG = logging.getLogger(__name__)
def get_checkpoint_epoch(checkpoint_file):
return int(... |
77a6805955349f0c9f774993dfcabca4b53105f5c2d3914e4b046d504b8c05d7 | Python | 13,864 | 346 | """
Module to compute pixel motion energy from side view video of the fly (camera 5).
Not used anymore. Use motion energy of SLEAP tracked keypoints instead.
Author: jonas.braun@epfl.ch
"""
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle
from tqdm import tqdm
i... |
ddcaa230cd4fb9c3037092011c4432476b12f85ba908db3ab2526073d4a01f06 | Python | 13,867 | 378 | ### #################################################################################
#
# 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 deta... |
3eb05a9452ab4eeeebb08199392c7050acad435bae57318d776b906d9ebedd83 | Python | 13,874 | 319 | import argparse
import logging
import os
import random
import shutil
import sys
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tensorboardX import SummaryWriter
from torch.nn import BCEWithLogitsLos... |
73802e57bcc0b5f6e737d9ffd3c5e5072c5db807583232108bea764b26a01ed5 | Python | 13,884 | 352 | """PipelineMetagenomeBenchmark.py
=================================
"""
import os
import collections
import sqlite3
import cgatcore.iotools as iotools
from cgatcore import pipeline as P
import cgatcore.experiment as E
import cgat.FastaIterator as FastaIterator
import cgat.Fastq as Fastq
import pysam
from rpy2.robject... |
287313f9aa567995b155d5ab4858c62935a077724fa75e08a3f0d05e29098e59 | Python | 13,890 | 389 | """
Periodic reconstruction QA while writing gt/sad coefficient sidecars.
Every ``interval`` newly computed graphs, reconstruct probe density from stored
coeffs (via ``orbital_inference``) and report nMAPE vs labels / SAD density.
"""
from __future__ import annotations
import pickle
import sys
from dataclasses impor... |
6d4fd10ea073d50f14c477757afa9739ef92568f80aaae7e658f3848a22a66b2 | Python | 13,903 | 394 | import math
from functools import partial
import torch
import torch.nn.functional as F
import torchmetrics.functional as tm_f
from sklearn.metrics import f1_score, roc_auc_score, matthews_corrcoef
from torchmetrics.classification import MulticlassRecall, MulticlassPrecision
from torchmetrics import Metric
class Cor... |
13bc5ad64ec81ebfb33e77548ba6ccb6d45dc8f8af87eea99502f9fc4e3d6e27 | Python | 13,913 | 305 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function
from ast import Load
import os
import pandas as pd
import numpy as np
import csv
import torch
impo... |
f8f06af8c4fc2ce1e20c2d69f5a04de50f37ccac737218ec3a9c53a026053324 | Python | 13,915 | 389 | # library of convenience plotting funcs that are used for making various plots for all optical photostimulation/imaging experiments
# imports
from typing import Union
import numpy as np
import functools
import random
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
from imagingplus.main.... |
31132eb03434b0a995dadc7f9e987b1aac0cce33ec9b724a437041c2050610ec | Python | 13,921 | 381 | import torch
import torch.nn.functional as F
import math
import numpy as np
class KANLinear(torch.nn.Module):
def __init__(
self,
in_features,
out_features,
grid_size=5,
spline_order=3,
scale_noise=0.1,
scale_base=1.0,
scale_spline=1.0,
enabl... |
c0467f5ae14014108027b8aa25e582f99da704dbafffebd84511028660970f64 | Python | 13,929 | 317 | from collections import Counter
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
import sys, os
import re
import pandas as pd
from mantis_ml.modules.pre_processing.data_compilation.process_features_filtered_by_disease import ProcessFeaturesFilteredByDisease
from mantis_ml.config_cl... |
7f6b65d75dfde344c7bc7086a7c543b6551d3a01ea4c4a5d12d1585bdd4b5816 | Python | 13,932 | 430 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 19:45:28 2021
@author: Bruno Caneco
Module for utility functions dealing with data/image preparation and processing
"""
# import standard libraries
import os
import glob
from pathlib import Path
import concurrent.futures
import logging
import math
# import installe... |
2c53730d24cc21f1db4f1b6f5dd9bf79265f9bffdc5697e4ff97c2265028a8aa | Python | 13,942 | 454 | """Shared redaction utilities for middleware components."""
from __future__ import annotations
import hashlib
import ipaddress
import operator
import re
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from typing import Literal
from urllib.parse import urlparse
from typing_extensions... |
6763c20c1733a068c06850a30d0e69e0670ca74baa6f869feec8b94f853c0aa6 | Python | 13,956 | 379 | """
2023.08.30
author: sibo.wang@epfl.ch
This script sonstructs the following from CSV files from the Codex data dump:
1. Graph representations of:
(i) The full FlyWire dataset;
(ii) The subset of it containing only central, descending, and ascending
neurons;
(iii) The subset of it contain... |
7971fa758429570906cfcff5f3a3b292723cab8ec7938a6d1d1e6a5e44c4a931 | Python | 13,961 | 307 | # Rdkit import should be first, do not move it
try:
from rdkit import Chem
except ModuleNotFoundError:
pass
import copy
import utils
import argparse
import wandb
from configs.datasets_config import get_dataset_info
from os.path import join
from qm9 import dataset
from qm9.models import get_optim, get_model, get... |
7b457173e7f5cfbbc3e7a8ffe85d7a5597bec2c24f0df806a6d12ab71b039098 | Python | 13,976 | 392 | """V1 parity tests: `stream_events(version="v3")` must match `model.stream()` output.
These are the acceptance criteria for the v3 streaming API — if any test fails,
v3 has a regression vs v1.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import pytest
from typing_extensions import ov... |
f702b213df826fed86ca56055f1da6bea489fcd01f940458d3b3c2edccac1c4d | Python | 13,979 | 381 | """LLM Chain for turning a user text query into a structured query."""
from __future__ import annotations
import json
from collections.abc import Callable, Sequence
from typing import Any, cast
from langchain_core._api import deprecated
from langchain_core.exceptions import OutputParserException
from langchain_core.... |
cde66a7e119c4d25fe44d5e03dd582024eded452e4a37e4189b964e58aaa42a0 | Python | 13,990 | 394 | from __future__ import annotations
import logging
import warnings
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
from scvi import REGISTRY_KEYS, settings
from scvi.data import AnnDataManager
from scvi.data.fields import CategoricalObsField, LayerField, NumericalObsField
from scv... |
0708a02e4db39e62d9ee5cadb9bc25d1d18388b643340eb74742ca5ec93d8340 | Python | 13,995 | 394 | import torch
from torch import nn
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
from data import generate_recog_data, recog_chance, check_recognition_data
from net_utils import binary_classifier_accuracy, load_from_file
def verify_no_repeats(train, test):
for x1 in ... |
15650101a066e5b12cfbea0e0b5b30de4ea13d8af9b2397fc42eaf35c3bd3ad5 | Python | 14,001 | 386 | """`Runnable` that retries a `Runnable` if it fails."""
from collections.abc import Callable
from typing import (
TYPE_CHECKING,
Any,
TypeVar,
cast,
)
from tenacity import (
AsyncRetrying,
RetryCallState,
RetryError,
Retrying,
retry_if_exception,
retry_if_exception_type,
st... |
6317a16dffedf5a4b0d9d8d1ab1749b40b8b89c7e2415bcec6e9e9396640a5d7 | Python | 14,006 | 426 | """rnaseq.py - Tasks for RNAseq analysis
==============================================
This module provides tasks related to RNAseq analysis.
Requirements:
* HiddenMarkov >= 1.8.0
* MASS >= 7.3.34
* RColorBrewer >= 1.0.5
* featureCounts >= 1.4.3
* samtools >= 1.1
Reference
----------
"""
import cgatcore.experim... |
d01c3dd290b639a219f023f38dbc57c18d289301303125ff9418b2fb42df8340 | Python | 14,021 | 307 | """ Test module for numpy extensions.
: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 ... |
5b118a0d1392a09e89dd8b5ada5894eb2364b7354136bdb1e2bbf610e0a5bea8 | Python | 14,030 | 321 | import argparse
import logging
import os
import random
import shutil
import sys
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tensorboardX import SummaryWriter
from torch.nn import BCEWithLogitsLos... |
aa225a86358f1923a1a40a78cf591fddb455a7bbf138d1407322657a923a50d3 | Python | 14,031 | 381 | """
Plot an illustration of the normative posterior updating and the effects
of change-point probability and uncertainty in this updating process.
Illustrate those effects in each of the two learning tasks.
"""
import data_analysis_utils as dana
import matplotlib as mpl
import matplotlib.pyplot as plt
import model_lea... |
4e372fd59cf9e446098c104a8aecb0fe1150f215e8975609f0c4f20e40d7c2c1 | Python | 14,035 | 296 | from typing import Tuple
from KineticAssembly_AD import ReactionNetwork
from KineticAssembly_AD import reaction_network as RN
import networkx as nx
import torch
from torch import DoubleTensor as Tensor
from torch import rand
from torch import nn
class VectorizedRxnNet_KinSim:
"""
Provides a lightweight cl... |
fb0c0a88587d718a0cdb955af450efa72a805b958bd7c7b23b339e9d5dd4d443 | Python | 14,041 | 461 | """===============
Chains pipeline
===============
:Author: Andreas Heger
:Release: $Id: pipeline_chains.py 2900 2010-04-13 14:38:00Z andreas $
:Date: |today|
:Tags: Python
Purpose
-------
build pairwise genomic alignments from a set of multiple alignments or
combine several pairwise alignments into new pairwise ali... |
a639cf61210a0806067124afc86188a08fe63b6df1bf5d513a294149b3c1e5a0 | Python | 14,049 | 341 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from sklearn.metrics import log_loss
from SMdRQA.RQA_functions import doanes_formula
from SMdRQA.RQA_functions import binscalc
from SMdRQA.RQA_functions import mutualinfo
from SMdRQA.RQA_functions import time... |
4db82a1478d33aa7a710f24ed1fc12589aa654f90ab18de9ccaa32c886b1ea56 | Python | 14,050 | 496 | from typing import Optional
import torch
import torch.nn as nn
class WSConv2d(nn.Conv2d):
def __init__(self, *args, max_norm: Optional[float] = None, **kwargs):
self.max_norm = max_norm
super(WSConv2d, self).__init__(*args, **kwargs)
def __repr__(self):
if self.max_norm is not None:
... |
e4204eff4c3ec675ba23f2a4615592fa9e258363e15c0d4744880e1269ede639 | Python | 14,055 | 355 | import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.backends.backend_pdf import PdfPages
import pickle
from tqdm import tqdm
from scipy.stats import mannwhitneyu
import params, summarydf, loaddata, stimulation, behaviour, plotpanels, fig... |
1f3f8ace9dd08e86f1f72e4c1ab85f337bcc8bb5d9f9414a46e3952a80bf665c | Python | 14,059 | 418 | """Model utilities for numpy implementation."""
import copy
import time
import numpy as np
import scipy
from ._numpy_linalg_utils import (
one_hot_encoding, matern_type_kernel, matrix_inv_cholesky,
matrix_block_indexing, matrix_trace_of_product,
matrix_blockdiag_rotation, matrix_block_trace,
)
def get_h... |
36b18e62b375c015bc29dd809c2c068014b4df24902eb8bad2a998769d37643b | Python | 14,087 | 311 | import argparse
import logging
import os
import random
import shutil
import sys
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tensorboardX import SummaryWriter
from torch.nn import BCEWithLogitsLos... |
8e62c19240f6486c154dc8155e8c1f3175a8b69470c2bf9feed055380bfc159e | Python | 14,098 | 435 | """Contains all visualization methods."""
import os
import numpy as np
from math import sqrt, ceil, floor
import pickle
from datetime import datetime
from .utils import GuidedBackprop, get_notable_indices
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
import matplotlib
from mpl_toolkits.axe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.