sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
bbc7207c252d97697777a4f00f4b3a79cb660328209d0113d352ea6f9a08394c | Python | 9,300 | 245 | # coding: utf-8
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description:
'''
# Libraries
# ---------------------------------------------------------------------------- #
from collections import OrderedDict
from torch import Tensor
from re import X
import torchvis... |
96b020511dd2b44e9daecd6787bc4c9c974551d033519a7b4d7a8c787fd8ec69 | Python | 9,302 | 267 | """Call tracking middleware for agents."""
from __future__ import annotations
from typing import TYPE_CHECKING, Annotated, Any, Literal
from langchain_core.messages import AIMessage
from langgraph.channels.untracked_value import UntrackedValue
from typing_extensions import NotRequired, override
from langchain.agent... |
cf40016ecf371b7f7471c4473bb2af143bfe4e0b00bffadedfd650ff6a26c9a2 | Python | 9,303 | 208 | import sys; sys.path.append('../src')
epsilon = sys.float_info.epsilon
import matplotlib.pyplot as plt
from matplotlib import pylab
import numpy as np
import pandas as pd
import scipy.stats as ss
# Local imports (not installed packages)
from GeneralHelper import (
extract_info_from_keys,
nice_figure, simpleaxi... |
41f600d5cb9333cd8d198e7583ed656ffd0950fc1d593a4844cfa3e5150ef34c | Python | 9,309 | 229 | """Combine documents by doing a first pass and then refining on more documents."""
from __future__ import annotations
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from langchain_core.prompts import BaseP... |
4ddaf6f63598125f068587f3e2fbc7661acb0e37421e62304bfd1d99d6b5742b | Python | 9,310 | 199 | """
The fitness function, solution implementation, and penalty for constraints are also defined .
"""
from DSS_Initialize import*
# To get the details of switches and their status
def switchInfo(DSSCktobj):
#Input: DSS Circuit Object
#Returns: A list of dictionaries which contains:
# ... |
e7d1e9dca831ea67268b08b583489c3d09d54728a6f34d688c0e5464f7b16f3f | Python | 9,315 | 292 | import os
from os.path import join as opj
import yaml
import numpy as np
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
from MuTILs_Panoptic.utils.TorchUtils import transform_dlinput
from MuTILs_Panoptic.utils.MiscRegionUtils import get_configured_logger
import MuTILs_Pano... |
aa039de88a673d933959bde8d9a7939afba11f10c43e824e66cb8acbabe3421c | Python | 9,317 | 227 | from __future__ import print_function
import tensorflow as tf
from .nn import linearND, linear
from .mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph_list as _s2g
from .models import *
from .ioutils_direct import *
import math, sys, random
from collections import Counter
from optparse import ... |
e1b7a665bfaf7980b94cac292ae53314beb8ef2fa8c69a3dac6a5bfe5647f0e9 | Python | 9,317 | 266 | """Helper functions for marking parts of the LangChain API as beta.
This module was loosely adapted from matplotlib's [`_api/deprecation.py`](https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/_api/deprecation.py)
module.
!!! warning
This module is for internal use only. Do not use it in your own ... |
e081a71bcad826035cdac2c314bc26de93b0dcb95a70ce8b7668f3e61490b7d2 | Python | 9,321 | 202 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import trunc_normal_, DropPat... |
37386fed029be30040d0d62536953bfb6354b5439b585abc78076e25695fd22b | Python | 9,323 | 228 | import random
import numpy as np
import tensorflow as tf
from collections import OrderedDict
from dipgnn.utils.register import registers
@registers.data_provider.register("data_provider")
class DataProvider:
"""
Note: A significant portion of the code is adapted from dimenet (https://github.com/gast... |
5478af3a4c2f461cfc77924d2e6a53eda97e67c4709b885cf87a496aac8dafc9 | Python | 9,325 | 279 | """Experiment YAML loading, validation, and config management.
An experiment consists of named cases, each specifying a phantom,
reconstruction config, and case type. Cases can inherit shared
``base_phantom`` and ``base_config`` from the experiment level.
"""
from __future__ import annotations
from pathlib import Pa... |
7e4a3abf49bcd13df9ffa8435835a8a6b036e09f5f211dbbb6ab590c319f7eca | Python | 9,329 | 244 | import hashlib
import os
import urllib
import warnings
from typing import Union, List
import torch
import torch.nn as nn
from PIL import Image
from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize
from tqdm import tqdm
from .model import build_model
from .simple_tokenizer import SimpleTo... |
524f94322044ed2cb8b33fb74851f7483aef6f38a8e56d46a49df8f7783f0a51 | Python | 9,334 | 221 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import scipy.stats
import numpy.ma
import Stats
import Histogram
from cgatReport.Tracker import *
from cpgReport import *
##########################################################################
class replicat... |
17e59b904f32a3312cfd3750e92e116bf7aaa33d3e71bb41ec0b34dd13761a14 | Python | 9,337 | 239 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# RuntimeError: Pin memory thread exited unexpectedly
import resource
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
resource.setrlimit(resource.RLIMIT_NOFILE, (10_000, hard))
# >>> print(resource.getrlimit(resource.RLIMIT_NOFILE)... |
d2fa03b99151f0fab464c2b12bca6e63ad93d44b85328b1c491c4973c76f3175 | Python | 9,338 | 252 | from collections.abc import Callable
from itertools import islice, permutations
from math import factorial
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from pgmpy import config
from pgmpy.base import DAG
from pgmpy.causal_discovery._base import BaseCausalDiscovery
from pgmpy.ci_tests import get_c... |
d3475936f318059c229b1a92561594f0490a8297f606e082ddf4b17f1afe1500 | Python | 9,338 | 232 | """
Stochastically estimate (partitioned) LD scores.
Reference: https://github.com/sriramlab/SUMRHE/blob/main/src/gw_ldscore.py
"""
import numpy as np
import pandas as pd
from bed_reader import open_bed
import multiprocessing as mp
from tqdm import tqdm
import scipy
import gc
def _read_with_optional_header(file_path... |
974c2d81a629499b039a5f1064f00da373e75dce0d13ca914a626fec9068e135 | Python | 9,340 | 290 | import os
import sys
import re
import types
import itertools
import math
from cgatReport.Tracker import *
from cgatReport.Utils import PARAMS as P
from cgatReport.odict import OrderedDict as odict
from RnaseqReport import *
##############################################################
##############################... |
a65c151deee4323faca2dcaa04237090e87bf92a568d2e708c6b03fd26a4adf4 | Python | 9,340 | 231 | # -*- coding: utf-8 -*-
"""
Methods to obtain a timeseries distribution for the water pockets which respresents
a combination of the water occupancy (binary variable) and the water polarisation (continuous variable).
Water pockets are defined as radius 3.5 Angstroms (based off of hydrogen bond lengths)
centered on the... |
f454976a2ae62ac3a5eac15cb1755477db62095b413f735ec781ced5415acab9 | Python | 9,340 | 240 | import os.path
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from collections import defaultdict
import sys
from torch.optim.lr_scheduler import StepLR
sys.path.append('../../')
from BrainAlign.SR_RSC.embedder import embedder
from BrainAlign.SR_RSC.layers import *
from BrainA... |
a963e0bb2fceb4c3ff288bc837a7363e160a0dd8ec9819629d067b5fdcfb5ab4 | Python | 9,341 | 281 | #
import time
import numpy as np
import torch
import torch.nn.modules.loss
import torch.nn.functional as F
from sklearn.cluster import KMeans
from .SEDR_module import SEDR_module, SEDR_impute_module
from tqdm import tqdm
def target_distribution(batch):
weight = (batch ** 2) / torch.sum(batch, 0)
return (weig... |
840377c24de800338e10cc7adb9a9e3bbf25fb7d87d104839524cc53d719594b | Python | 9,346 | 163 | import pandas as pd
import numpy as np
import argparse
def get_sample(smaple,type='RNA'):
smaple=pd.DataFrame(smaple)
smaple.columns=['ID']
smaple['sample_id']=smaple['ID'].map(lambda x:x.split('-')[0]+'-'+x.split('-')[1]+'-'+x.split('-')[2])
smaple_over=list(set(smaple['sample_id']))
smaple_1=pd.D... |
de9e81cf70cabf161afc592052ab8788df9b351cd94e3452c64f77770da660bd | Python | 9,348 | 244 | import copy
import tqdm
import os
import numpy as np
import torch
import torch_geometric
from torch_geometric.loader import DataLoader
from src import data_loader
from src import utils
from src import constants
class GatedGraphConv(torch_geometric.nn.conv.MessagePassing):
def __init__(self, in_channels, out_chan... |
af67e64631eca49018e263fb82fa465e04370cd825d6f7a03c9d0daac10657c2 | Python | 9,352 | 254 | """Interface for a rate limiter and an in-memory rate limiter."""
from __future__ import annotations
import abc
import asyncio
import threading
import time
class BaseRateLimiter(abc.ABC):
"""Base class for rate limiters.
Usage of the base limiter is through the acquire and aacquire methods depending
on... |
f7f6533d55c1dfd0250e3f064c7302a70862b7c08db372a2ed95592872988391 | Python | 9,355 | 211 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import ptitprince as pt
import seaborn as sns
from configs.configs import get_config_dict
from helpers.figures import get_palette
def plot_likelihoods_raincloud(
config_dict: dict,
test_l... |
b17e1561399b38cc8210011a9299fd69ebbab58cb6c57b9b1c0633b0f1123f2b | Python | 9,356 | 233 | from collections.abc import Callable
import networkx as nx
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, clone
from pgmpy.base import DAG
from pgmpy.causal_discovery._base import BaseCausalDiscovery
from pgmpy.causal_discovery.bivariate_scores import BaseBivariateScore, get_bivariate_... |
c1e5516e84a7a83d8ed412e61a4b42d4fd146efc035b19b4a4950560273ffbd4 | Python | 9,356 | 265 | # Based on the code from: https://github.com/klicperajo/dimenet,
# https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet_utils.py
import numpy as np
from scipy.optimize import brentq
from scipy import special as sp
import torch
from math import pi as PI
import sympy as sym
devic... |
ff81fe2d5f85d7009cdb704cf52288502f3eda0de1c604b83091fc03dcf36ee7 | Python | 9,360 | 247 | #!/usr/bin/env python3
# AUTHOR: Sirio Bolaños Puchet <sirio.bolanospuchet@epfl.ch>
# CREATION DATE: 2023-05-30
# LAST MODIFICATION: 2024-05-13
_PROGNAME = 'flatplot'
import logging
# setup logger
LOGGER = logging.getLogger(_PROGNAME)
logging.basicConfig(level=logging.INFO)
# parse arguments early
if __name__ == "_... |
1c0c8162aab89210ec407c4728d620a4f670854d663ede2b30eeb2855f22307a | Python | 9,366 | 183 | # 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... |
480ce60311a4be246d2207e34f2394c9406938530c24c5551555845c3dcc4478 | Python | 9,369 | 268 | """SE(3) diffusion methods."""
import numpy as np
from data import so3_diffuser
from data import r3_diffuser
from scipy.spatial.transform import Rotation
from openfold.utils import rigid_utils as ru
from data import utils as du
import torch
import logging
def _extract_trans_rots(rigid: ru.Rigid):
rot = rigid.get_r... |
02a17adcf1ca80891e6a5dfba9c58a6e454b08903acf5295cd420ee2b3a01285 | Python | 9,371 | 208 | import copy
import logging
from collections import OrderedDict
import numpy as np
import torch
logger = logging.getLogger(__name__)
def copy_state(model):
"""
Given PyTorch module `model`, makes a copy of the state onto CPU.
Args:
model: PyTorch module to copy state dict of
Returns:
... |
6d00abd98ba524db7ff84c2fa791277405fa8ce6308b8d665df6405398141fbd | Python | 9,371 | 248 | #!/usr/bin/env python
"""
IGWeight.py -
Compute IG Weights given a set of tokenized buckets and a feature set
Marco Lui, January 2013
Based on research by Marco Lui and Tim Baldwin.
Copyright 2013 Marco Lui <saffsd@gmail.com>. All rights reserved.
Redistribution and use in source and binary forms, with ... |
2e296d7b724f2b61ec3b5c8491b25a8b44bebd61ebf37a408e2e24fc86118464 | Python | 9,379 | 245 | """Combining documents by mapping a chain over them first, then reranking results."""
from __future__ import annotations
from collections.abc import Sequence
from typing import Any, cast
from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Doc... |
a5140f270171b5de15ce1d4df688c6ae6f0803694839b2b4701f7df2686f2dbb | Python | 9,384 | 227 | import networkx as nx
import random
import os
import tqdm
from src import constants
from src import utils
def filter_workflows(workflows):
# Filter out workflows that are too short or too long
return [workflow for workflow in workflows if len(workflow["nodes"]) >= constants.MIN_WORKFLOW_LENGTH and len(workflo... |
c700eed85aa752d7d44755dc43578f2d9080c74bda73de017769aa0bfa012758 | Python | 9,388 | 209 | ''' Test module for preprocessing methods.
:Version:
1.1.0
:Date:
04.04.2017
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2017 Jan Melchior
This file is part of the Python library PyDeep.
PyDeep is free sof... |
c20bce321464ad273a31f3ec5848824e043efc4fe807d93edc27cc0f21156322 | Python | 9,394 | 200 | import argparse
import time
from pathlib import Path
import sys
import cv2
import torch
import torch.backends.cudnn as cudnn
from numpy import random
from models.experimental import attempt_load
from utils.datasets import LoadStreams, LoadImages
from utils.general import check_img_size, check_requirements, check_imsho... |
d3c889946becd6037fab8b26bc06d7e9bfed2243cf4aa9e96e4781cd7dfa953a | Python | 9,394 | 193 | """De-novo-hybrid assembly, recover NON-DOCUMENTED transcripts and fold them into the
expression "sc table" so DeepMapper sees features a reference-only pipeline discards.
Pipeline (validated on tissue-resident vs circulating memory T-cell bulk RNA, where the
top discriminators turned out to be novel DENOVO transcript... |
00bb3523418b8f4590fce8528ec321973249c21dabb52c5ea0f3d323ae9b02dd | Python | 9,395 | 266 | """functions to denoise, downsample, re-order, label, and transform the input functional
time series data. These are applied prior to any further processing."""
import csv
import numpy as np
import nitime.algorithms as tsa
import matplotlib
matplotlib.use("PS")
import matplotlib.pyplot as plt
from ..utils import pat... |
147364ff09de602c3f3f071b283dbee709b1da4d87dd3e30eb8c68c6653941db | Python | 9,397 | 425 | """A fake callback handler for testing purposes."""
from itertools import chain
from typing import Any
from uuid import UUID
from langchain_core.callbacks.base import AsyncCallbackHandler, BaseCallbackHandler
from langchain_core.messages import BaseMessage
from pydantic import BaseModel
from typing_extensions import ... |
19ed721347e3528c89076887044679ae6910f2e193a3ed53ae79d6c3d834d973 | Python | 9,400 | 296 | #!/usr/bin/env python3
#
# openff-toolkit documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 3 23:12:54 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.... |
2cc75e4e33d2874ac1104558e97cd591180dd0006d201a9f26ec443b35fb8c26 | Python | 9,401 | 201 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 12 14:55:35 2023
@author: biener
"""
import torch
from torch import Tensor
import numpy as np
import mAECell_Utils as utils
#%%
class Param_fromInFile:
Model_Mat: torch.Tensor = None
nTPoints: int = None
nInterms: ... |
97a55c1516b67b975f52cdc22cb8f96820d97cff9e64586e46a2194266f54793 | Python | 9,406 | 241 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
import os
import numpy as np
import torch
import torch.nn as nn
import lib.utils as utils
from lib.diffeq_solver import DiffeqSolver
from generate_timeseries import Periodic_1d
from torc... |
d46490b1a475a23cc3ce099efcf83a44802c35c1a95ccbacc2af05e1d7945117 | Python | 9,406 | 203 | """
Author: Benny
Date: Nov 2019
"""
import argparse
import os
from data_utils.S3DISDataLoader import ScannetDatasetWholeScene
from data_utils.indoor3d_util import g_label2color
import torch
import logging
from pathlib import Path
import sys
import importlib
from tqdm import tqdm
import provider
import numpy as np
BAS... |
c461a37f197ecbeffc824591862159e5b0fc1f198c315dce1ef0bb63c616f5f5 | Python | 9,407 | 240 | import re
from typing import Optional, Tuple
import torch
from torch import nn, Tensor
from torch_geometric.data import Data
from . import output_modules
import warnings
import numpy as np
from torch_geometric.utils import to_dense_batch
from .visnet_block import ViSNetBlock
def create_model(args):
model_args = di... |
e7289bc94c19b4ce3becb82d82b8d92b1328c836660bbcbcd04b757505652a98 | Python | 9,407 | 272 | import importlib
import smtplib
import ssl
from abc import ABC, abstractmethod
from email import encoders
from email.mime import base, multipart, text
from pathlib import Path
import jinja2
from mrQA import logger
class Formatter(ABC):
def __init__(self):
self.type_report = None
self.sender_emai... |
1ac1043875d8874d7bac480738e3c83c8424ba05bad940a34d56d242f66a108f | Python | 9,408 | 185 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import scipy.stats
import numpy.ma
import Stats
import Histogram
from cgatReport.Tracker import *
from cpgReport import *
##########################################################################
class cgiInte... |
410b81eea85e6e29cbeeabac1d4d95930bbd90271422cfc4354d32f5a14fb16f | Python | 9,409 | 207 | 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 qm9.visualizer as vis
from qm9.analyze import analyze_stability_for_molecules
from qm9.sampling import sample_chai... |
59db0b67419f376746d9d69b74e91849318b515f164ecfab907b942d1163ad55 | Python | 9,414 | 189 | import os
from copy import deepcopy
from collections import OrderedDict
from itertools import groupby
import warnings
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.font_manager
from matplotlib.cm import get_cmap
import scipy.stats as stats
print("- matplotlib version:", matplo... |
7a1d49a33d68d63870b96ada1c598e9c54a5396b785c676e4e2edc83d0e7ee67 | Python | 9,414 | 236 | 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 task2AFC_preprocess_func
__all__ = ['task2AFC_sdt']
class Task2AfcSdt(TaskModel):
def __init__(self, **kwargs):
... |
afaa7045079e974bf3d141011cdf6e4e79ff484f27413e2231e02f483e669b8b | Python | 9,414 | 232 | import sys,os,gc
sys.path.insert(1, os.path.join(sys.path[0], '../../../'))
import numpy as np
import pickle
from Simulator.SimulatorPatternDual import simulatorPatternDual
from FiguresFunctions.FiguresPattern import *
import matplotlib.pyplot as plt
import argparse
import itertools
from datetime import datetime
parse... |
bf557c88db12c39c817466cede890b218a92cdbb1680903138db0b85d17e8e6d | Python | 9,421 | 264 | import time
import sys
import os
import yaml
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import math
from torch.nn.modules.loss import _WeightedLoss
from scipy.optimize import nnls
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import OneHotEnco... |
4baf408430243994ce32b8f20cc8be6d2eab4144f7255266bf5684317528247d | Python | 9,430 | 242 | import numpy as np
import pandas as pd
from sklearn import metrics
import matplotlib.pyplot as plt
from scipy import interpolate
from joblib import Parallel,delayed
from tqdm import tqdm
from io import StringIO
import scipy.stats
import scipy
from analyze_results.path_to_results import get_path
from constants import M... |
70d0c404798a684cca5b65a1b348b4093d421ce95da344439fc5a6aa6f1a1c7d | Python | 9,430 | 227 | import os
import argparse
import numpy as np
import pandas as pd
import yaml
import random
random.seed(49297)
from tqdm import tqdm
def process_partition(args, definitions, code_to_group, id_to_group, group_to_id,
partition, sample_rate=1.0, shortest_length=4,
eps=1e-6, fut... |
4308322d564b5cdd5a59a0e3985906905d40c439d8c2a72fafd35228179d7dc7 | Python | 9,434 | 207 | 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 qm9.visualizer as vis
from qm9.analyze import analyze_stability_for_molecules
from qm9.sampling import sample_chai... |
0a3ab5d063cba738c060cce45980bea835e26b7a8cadeadc545e7a9f3664ea34 | Python | 9,436 | 229 | """
Extract replica or state trajectories from a perses replica exchange simulation.
This requires the same version of perses used to generate the simulations to be installed.
"""
import rich
import click
import openmm
from openeye import oechem
from simtk.openmm import unit, app
import os
import pickle
import mdtr... |
0bf1bbe79ab819457fb66f1ca758dfe325e1fb0d31ef4984431b9572c2fba184 | Python | 9,440 | 214 | from EPI_MRI.utils import *
from EPI_MRI.LeastSquaresCorrection import LeastSquaresCorrection
from EPI_MRI.Regularizers import TikRegularizer, QuadRegularizer
from EPI_MRI.LinearOperators import *
import matplotlib.pyplot as plt
import torch
from optimization.OptimizationLogger import *
class EPIOptimize:
"""
... |
462938383f6a046df71215ed6fbf171d499a7cbb19b12e34264f6264251f2440 | Python | 9,444 | 279 | """
Script to collect rna-seq qc metrics from different summary and report files from the rnaseq
pipeline
Usage : python rnaseq_qc.py --multiqc_prealign multiQC_prealign_report --multiqc_postalign
multiQC_postalign_report 8019468197_summary.txt 8019468197_mapped_report.txt
8019468197_rRNA_report.txt 8019468197_globin_... |
5402499f6f8b6082f33e553e1e8b19fcb0c66084cfa425a9e5db01a05d74970b | Python | 9,444 | 209 | import pandas as pd
import argparse
from utils import set_seed
import numpy as np
import wandb
import os
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.nn import functional as F
from torch.nn.utils.rnn import pad_sequence
from torch.cuda.amp import GradScaler
from transformers imp... |
5bee4237d9c546b4394ee695190b77cfe377c292735e7efdf45e5b37d051a4ef | Python | 9,457 | 333 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
43b28312287d0cdb8110ce134b50e98a973aef688d4fc9a2fb74f3fba80dc655 | Python | 9,458 | 232 | # -*- coding: iso-8859-1 -*-
"PDF Template Helper for FPDF.py"
from __future__ import with_statement
__author__ = "Mariano Reingart <reingart@gmail.com>"
__copyright__ = "Copyright (C) 2010 Mariano Reingart"
__license__ = "LGPL 3.0"
import sys,os,csv
from .fpdf import FPDF
from .py3k import PY3K, basestring, unicod... |
a520323934b122f4e46bfde5e2874703fe5c5e67b58f9fdc068b0751ac1f6c29 | Python | 9,458 | 202 | # Script from https://gist.github.com/mvoelk/ef4fc7fb905be7191cc2beb1421da37c
import numpy as np
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Flatten, Activation, add
from keras.layers.normalization import BatchNormalization
from keras.models import Model
from keras im... |
4bfcf5070c18f49fb1ade36a0de42222f3af136d020819fdfacda4919e39e739 | Python | 9,464 | 314 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
c3f138078ef3120334afe0785625c909ff661fc73d171040f447b86591b1cd11 | Python | 9,464 | 292 | # `CleanSamples` model
# srun --nodes=1 --ntasks=1 --cpus-per-task=24 --mem=100g --time=04:00:00 --pty bash -i
# Sconda conda activate tensorflow2; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/results/cross_validation_allsamples; python
import json
import re
import matplotlib.pyp... |
e675c26dad25f554e3e341fecc4c047c20e2260f4b1e1b33a1886d661ad99a3b | Python | 9,465 | 198 | # 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... |
224660c17e9a400e64921a56cf32a36e0a16c71db0a62ddcf24135b0c1ba762d | Python | 9,473 | 244 | import torch
import re
import os
import numpy as np
import gc
import argparse
from transformers import BertModel, BertTokenizer, T5Tokenizer, T5EncoderModel
from tqdm import tqdm
from bio_embeddings.embed import SeqVecEmbedder
from featurization import load_seqs, load_mll_seqs
import time
def save_single_feature(mod,... |
a508942c61e739e12bae04b926fff800e5465003c941de099d8050c894de65b4 | Python | 9,475 | 246 | 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... |
01f7d549d399ec80283419599e0281f763eb48b33bd2ef1dadec04ae419bab57 | Python | 9,478 | 256 | import adv
import argparse
import array
import ClearMap.Alignment.Annotation as ano
import ClearMap.Alignment.Elastix as elx
import ClearMap.Alignment.Resampling as res
import ClearMap.Analysis.Measurements.Voxelization as vox
import ClearMap.IO.IO as io
import numpy as np
import os
import skimage.io
import sys
import ... |
7aecc614471364aa934c2e6be3d1320a7dc1255c2fde04a5627b2cc5099cd1e4 | Python | 9,481 | 292 | import argparse
import pathlib
from typing import Optional
import numpy as np
import pandas as pd
import yaml
import networkx as nx
import json
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
import seaborn as sns
def parse_arguments(
key: Optional[str] = ... |
81404f4307e264aa1fadd695f26f9159f6941e555700339a3569c91923efd3bc | Python | 9,481 | 275 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
import torch
import torch.nn.functional as F
from torch import nn
from pdearena.modules.activations import ACTIVATION_REGISTRY
from .condition_utils import ConditionedBlock, EmbedSequential, fourier_embedding
from .f... |
3c26effb018a3b4715a317004b53b260d87d48f19f41db5cf1db445435841bc9 | Python | 9,483 | 229 | import argparse
import multiprocessing as mp
import os
import sys
from datetime import datetime, timedelta
from pathlib import Path
from MRdataset import DatasetEmptyException, valid_dirs, load_mr_dataset
from mrQA import monitor, logger, check_compliance
from mrQA.config import PATH_CONFIG, status_fpath, DATETIME_FO... |
22b75653f3e56412eb0f772c0b7043b99d5a47779a50143b52e565b5ef496a37 | Python | 9,488 | 201 | '''
Count chronic stats of a mouse
8/30/2022
'''
import os
import json
import re
import datetime
import traceback
from collections import OrderedDict
# import typing
import shutil
import numpy as np
import matplotlib.pyplot as plt
from utils.read_mda import readmda
POSTPROC_NAME = "postproc_220913"
MERGE_NAME = "mer... |
331c810661e61f397baadb9b9c52d97e56aed5c961b4c1c2038f687657393e88 | Python | 9,503 | 276 | import argparse
from pathlib import Path
from datetime import datetime
import logging
import quantities as pq
import neo
from neo.utils import get_events, cut_segment_by_epoch, add_epoch
from elephant.signal_processing import butter
from elephant.spectral import welch_psd
import numpy as np
import matplotlib.pyplot... |
9b161646381e91770d0f2f8d9a95900a1750a3f160d5963ed317fa2a60044418 | Python | 9,512 | 214 | import pandas as pd
import argparse
from utils import set_seed
import numpy as np
import wandb
import os
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.nn import functional as F
from torch.nn.utils.rnn import pad_sequence
from torch.cuda.amp import GradScaler
from transformers imp... |
ca287358e79f6b9ad95a45d5169d120ec18fff1e2b4652d84d6e97aeb0ec0b93 | Python | 9,513 | 276 | from collections import abc as container_abc
from inspect import getfullargspec
import functools
import numpy as np
import torch
from torch.nn import functional as F
class GraphTensorPacking:
def __init__(self, X, E, y=None):
self.X = X
self.E = E
self.y = y
def to(self, device=None,... |
c17ebbaa22775ffe41ead72ec738f7f97d54b85c8ad9cf76b8527568e0f34718 | Python | 9,528 | 279 | #!/usr/bin/env python3
"""Quick CUDA-synced inference timing for a flow-matching checkpoint.
Reports per-molecule wall time for:
- Euler coeff integration (predict_coeffs)
- density eval on the LMDB probe grid (orbital_inference)
- total (both)
Example:
python scdp/scripts/bench_flow_infer.py \\
--ckpt_pa... |
6e6da071136af89aeb4a5641d5c168121b281c2e69a36bd04120c1cd491535e0 | Python | 9,535 | 237 | import torch
from torch import nn
from torch.nn import functional as F
from torch_cluster import radius_graph
from torch_geometric.data import Data, Batch
from torch_geometric.nn import MessagePassing, global_mean_pool, InstanceNorm, avg_pool_x, BatchNorm
class Swish(nn.Module):
"""
Swish activation function
... |
efa02cd31770f0d763d449133e4d46948faff8af1d9b10b0c8fae64b2039147b | Python | 9,538 | 277 | # Copyright Generate Biomedicines, Inc.
#
# 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 ... |
9f06ef331999dfefd17bbf274ea9ad48a7bc614a4b14f26b202018072e6e1657 | Python | 9,541 | 258 | import torch
from torch import nn
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self, n_stages, n_filters_in, n_filters_out, normalization='none'):
super(ConvBlock, self).__init__()
ops = []
for i in range(n_stages):
if i==0:
input_cha... |
10223564a2e681f5765336ded73575749e60dca5a32b42cad0dcd1ffa2388df1 | Python | 9,547 | 280 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 28 23:11:36 2022
@author: Agus
"""
import scipy
#matplotlib.use('Qt5Agg')
import os
import numpy as np
import glob
import sklearn.decomposition
from scipy.optimize import curve_fit
'''
FUNCTIONS
'''
def deltaf_f(traces):
#calculate delta F/F for every trace
#tr... |
a1e4934c3de27f9ea721e32b1e0e50a532b3c617602a66fc0e7b62e9446e69af | Python | 9,553 | 276 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import os
import math
import statistics
#import tensorflow_addons as tfa
from tensorflow.keras import layers,Model
from sklearn.model_selection import train_test_split
from tensorflow.keras import backend as K
from plot_pd_re... |
3bdc6e43f8b594cad7e050d55167b810c4ee776a8b84b367cd3bf0fd1da27707 | Python | 9,554 | 329 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import weight_norm
class Conv2dWithConstraint(nn.Conv2d):
def __init__(self, *args, max_norm: float = 1.0, **kwargs):
self.max_norm = max_norm
super(Conv2dWithConstraint, self).__init__(*args, **kwargs)
def... |
6e7c8ce0745594b6f946ae00b6d80b818545e0c915ff46fa75dfe2ad1f22e619 | Python | 9,554 | 218 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
POCIF-BAT R2 — Moteurs d'opérateurs : construction de l'état densité et
estimation de canaux complètement positifs préservant la trace.
Ce module fournit les briques de calcul communes aux hypothèses H-R2-2, H-R2-3
et H-R2-4. Il ne contient aucune décision ; les tests... |
d51c32b3902accf24698f2b3abdfdf0e1a5d3150b90515a1b8d1b13d3e7d229b | Python | 9,554 | 249 | import argparse
from pathlib import Path
import numpy as np
import torch
import torch.nn.functional as F
from Bio.PDB import PDBParser
from rdkit import Chem
import pandas as pd
import random
from torch_scatter import scatter_mean
from openbabel import openbabel
openbabel.obErrorLog.StopLogging() # suppress OpenBabel... |
7f14c085ebeb26a590ee01e4c25f3f44e38cbe5ae3c909aae05fd247d4ec9f77 | Python | 9,557 | 277 | import munch
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import statistics
from CEL.utils.utils import fix_seed, make_basedir, convert_tensor
from CEL.utils.utils import CalculateNorm, Logger
import matplotlib
import matplotlib.pyplot as plt
# matplotlib.use('Agg')
# matplotl... |
783f80de76cc22567e52d07c7375be0c70c06e95b107934f39db8975a53c3f48 | Python | 9,559 | 176 | import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from skimage import measure
import seaborn as sns
try:
from .functions import *
except ImportError:
from functions import *
def cycledegreesCross(input, pxpermicron, filename, restrictdeg, outputimg, outputpath):
print("lets... |
2827d26453d044ded749589806e915459e37f9a529320b44b39c0a9bc03f9922 | Python | 9,565 | 278 | from typing import Callable
import math
import numpy as np
import torch
import torch.nn as nn
from sam.nn.transformer import TransformerLayer as TransformerLayerIdpGAN
from sam.nn.transformer import TransformerTimewarpLayer
################################################################################
# Transforme... |
599292883f2927ab71640b629e2cd2f52dda0f73fc924400fe43ac3badc213bb | Python | 9,567 | 232 | import numpy as numx
import pydeep.base.numpyextension as numxExt
from pydeep.base.activationfunction import Sigmoid
import pydeep.misc.measuring as MEASURE
import pydeep.misc.visualization as VIS
import pydeep.misc.io as IO
from DBMModel import Weight_layer, Convolutional_weight_layer, Binary_layer
# Set the same see... |
c5e6bf95001bb6ce1be9de162b975332a2d42682da72691622f186d3be017f68 | Python | 9,569 | 200 | """Tests for the ID algorithm of Shpitser & Pearl (AAAI 2006)."""
import pytest
from pgmpy.base import ADMG, DAG
from pgmpy.identification import ID
from pgmpy.identification.probability_expression import (
DivisionNode,
MarginalNode,
ProbabilityExpressionTree,
ProbabilityNode,
ProductNode,
)
# F... |
f2d29e4f0a374b23ceedace2cc1526db7750cfb749843bdb16c6e3a6135e498d | Python | 9,580 | 268 | import json
import os
import random
import numpy as np
import torch as tr
from datetime import datetime
import pandas as pd
import shutil
import pickle
from torch.utils.data import DataLoader
from sincfold.dataset import SeqDataset, pad_batch
from sincfold.model import sincfold
from sincfold.embeddings import NT_DICT
... |
c32e4b76f56b38f91e25970274cc3d0ea198138056d504713146008839063558 | Python | 9,585 | 224 | ####################################################################################
#
# 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... |
742df936f6c4537fe26f3a5ac81f3899b4a8142591b52627d8e71d8ff4d1c62c | Python | 9,587 | 224 | ####################################################################################
#
# 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... |
2748b686c7024bb7db0299ea2529e3fe3540332117f33efe2b7f4db3f3831e0b | Python | 9,595 | 232 | """
"""
import json
import pathlib
import requests
import numpy as np
import pandas as pd
class ParseDrugComb:
"""
"""
def __init__(self, root=None, debug=False):
self.debug = debug
if root is None:
raise Exception(f'Error, file path is required!!!')
else:
i... |
762e45aba7abd7b24e1b8da7fdf26b1c44384a9fd31825fdea29ded9b0e57dbe | Python | 9,598 | 240 | import numpy as numx
import pydeep.base.numpyextension as numxExt
from pydeep.base.activationfunction import Sigmoid
import pydeep.misc.visualization as VIS
import pydeep.misc.io as IO
import pydeep.base.numpyextension as npExt
from scipy.signal import convolve2d
from pydeep.dbm.unit_layer import *
from pydeep.dbm.weig... |
cb574157ea675ecf94a036874be5d5d5c35163e8ff60431e90b8873cda36579a | Python | 9,598 | 277 | """Shared helpers for ``gt_coeff_excluded.json`` (preprocess skip + training filter).
Global indices are **cumulative** over LMDB shard lengths (same convention as
``datasplits.json``, ``LmdbDataset.__getitem__``, and ``preprocess_mp_scdp.scan_sharded_lmdb``):
global_idx = sum(len(shard_i) for i < shard) + local_... |
2ceb36d7157606b2e9565a9ee43ff4647bf7bf17c43080f43e1f670118aea80a | Python | 9,599 | 242 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 3 10:57:50 2019
@author: ngritti
"""
from PyQt5.QtCore import Qt
from PyQt5 import QtCore
from PyQt5.QtWidgets import (QApplication, QVBoxLayout, QDialog,
QGridLayout, QLabel, QPushButton,
QWidget, QSizePolicy, QSpinBox, QDoubleSpin... |
1203edaf812dfb67cc2abdb54f17b037699039b6bb8039cefe1f4d7adbf8e02f | Python | 9,605 | 281 | import os,shutil,subprocess,sys
from tqdm import tqdm
from rdkit import Chem
from rdkit import rdBase
import rdkit.RDLogger as rdl
# Disable RDKit warnings and error messages
rdBase.DisableLog('rdApp.warning')
rdBase.DisableLog('rdApp.error')
import os,shutil,subprocess
def find_bad_C(mol):
bad_atom_list = []
... |
2587652643072da3de4567543e8e0ff35b1b7ca8e67ba451b5bba4a620bda825 | Python | 9,608 | 257 | # Copyright 2024 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... |
ecec036be5a79cea8cf54725aa2d11ed4decdc71cf122365514731dc9cad4b18 | Python | 9,609 | 281 | #!/usr/bin/env python
# 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 ... |
04fa6560f3dfa4e3b1dcb03b29b195b1b3955d8a2bc2c95ab48ff8f56cf8cc68 | Python | 9,611 | 238 | 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 ug_preprocess_func
__all__ = ['ug_bayes']
class UgBayes(TaskModel):
def __init__(self, **kwargs):
super().... |
6af86700a830eceab6030960fe04449162e4dedee7d57e578e822eec88a98137 | Python | 9,614 | 296 |
"""Module for Feature IO classes.
Copyright (c) 2014, Ying Jin <yjin@cshl.edu >
This code is free software; you can redistribute it and/or modify it
under the terms of the Artistic License (see the file COPYING included
with the distribution).
@author: Ying Jin
@contact: yjin@cshl.edu
"""
# --------------------... |
726b1cd57b00f8ab81e178a39d670600875bdca3485e7d87a01ecb563454cc00 | Python | 9,616 | 261 | # More ordering studies
import pickle
from multiprocessing import Pool
from sklearn.utils import shuffle
import torch
import os, json
import os.path as osp
from itertools import repeat
import numpy as np
from rdkit import Chem
from torch_geometric.data import InMemoryDataset, Data
from tqdm import tqdm
import re
import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.