sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0531a4c54d0b35a8b0480b1928cf9d6b0d2977ce77638c08dc54b7474c292bdd | Python | 18,658 | 509 | import os
import random
from time import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from gymnasium import spaces
# Mappings for changing direction if reflected.
# Cannot cross a row boundary moving right or left.
ROW_CROSSING = {1: 2, 3: -2, 5: 1, 6: -1, 7: 1, 8: -1}
# C... |
4ded4f914e614c5db695a3cd823c19129b1a7f2464603f050649807645a6e700 | Python | 18,660 | 525 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
a3a25116feb0b5bfd02e59dd67c8425571d6b396b3f3e0919caf5e91f80a2b85 | Python | 18,666 | 411 | """
python
GNNExplainNode.py
Purpose: Load trained networks, mount in device and explain node of interest.
"""
import argparse
import matplotlib.cm as mcm
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import os
import pandas as pd
import re
import random
import sys
import time
import torch... |
616da04bc1224119356ff247ca86f6fc6cb54f2ff23837ff1af7e87334af723e | Python | 18,689 | 543 | """Mermaid graph drawing utilities."""
from __future__ import annotations
import asyncio
import base64
import random
import re
import string
import time
import urllib.parse
from dataclasses import asdict
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, cast
import yaml
from langchain_core.ru... |
afc521c4e7c5cb4865e71e565be123faf1f00981c16f0c34d826796483f6f2e6 | Python | 18,689 | 512 | import numpy as np
import pickle
import numpy as np
import scanpy as sc, anndata as ad
import scipy.sparse as sp
import pandas as pd
import sys
import matplotlib.pyplot as plt
import re, seaborn as sns
from collections import OrderedDict
import os
import time
import sklearn
import scipy
from collections.abc import Ma... |
c0bddcbf27b17e8307cb568c10e663f88e28a8f0fcf9843186f751fd3d9f593a | Python | 18,690 | 553 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import datetime
import io
import logging
import os
import pickle
import random
import socket
import struct
impo... |
ef8d8928314bd05a833a43bbf4ae6db290f9a4974b1048ae1b3b6ecc741f67ab | Python | 18,690 | 630 | # 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... |
73ca9d347aeacfd93ec9c46c004137df5426e47b8a0df177c380d70a3facd9f1 | Python | 18,709 | 402 | #######################################################################################
import tensorflow as tf
import numpy as np
import os,sys,datetime
import gc
from pathlib import Path
from DataGenerator import circ_region, CreateGenerator, HPinputGenerator
from saved_model_functions import convert_param_to_outputs... |
a2fee0bca7f88bc06dcbd14c17299a38ec39535802e522aa97723617d8858ddb | Python | 18,713 | 458 | from typing import Optional, Tuple
import torch
from torch import Tensor, nn
from torch_geometric.data import Data
from torch_geometric.nn import MessagePassing
from torch_scatter import scatter
from .utils import (
NeighborEmbedding,
EdgeEmbedding,
CosineCutoff,
Distance,
Sphere,
VecLayerNorm,
... |
d4563e332468175f3e05a34739cbbc3e6bc7c3148cad2b84c1a92a5173424fe0 | Python | 18,719 | 525 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
24751f9e942b4aa2f78f43dd34c4246d2ae33efe58ce6c98d0f8250ccedc6a6a | Python | 18,724 | 611 | """Datasets for all experiments"""
import torch
import torch.utils.data
import tqdm
# from pprint import pprint
def isotropic_hardening(
strains,
yield_stress=torch.as_tensor(300),
elastic_modulus=torch.as_tensor(2.1e5),
hardening_modulus=torch.as_tensor(2.1e5 / 100),
):
"""1D isotropic hardening... |
ac2d5e56bdfb313b4803bd8c93677a63196233236c30f9b57eb0e0095e08e6d4 | Python | 18,735 | 339 | import os
import pytest
import unittest
from perses.rjmc.atom_mapping import AtomMapper, AtomMapping, InvalidMappingException
from openff.toolkit.topology import Molecule
################################################################################
# LOGGER
#########################################################... |
2fa76858bd4c9a8e98038caf32effc952c0d247628953d22b8e0fb0fd70326aa | Python | 18,765 | 521 | #=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Thermodynamic ensemble utilities.
DESCRIPTION
This module provides a utilities for simulating physical t... |
59ee52e154b9cd3f63e55d3345b7ef03ade59a8d5e749a13fb6c1e1a885376cf | Python | 18,769 | 521 | """A tracer implementation that records to LangChain endpoint."""
from __future__ import annotations
import logging
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Any, cast
from uuid import UUID
from langsmith import Client, get_tracing_con... |
380ac6f2900fb73f2804a1eed355b498dcde1f6b8000efaecad4b75fe1de734a | Python | 18,775 | 388 | # %%
"""
==========================================================================================================================================================================================
Attempt to classify EEG data in the source space from temporal lobe epilepsy patients vs healthy subjects - neuronal avalanc... |
ec2d3d3a257fa5274f9d06409922a02d799bdb92973dd3c4691e6897cf4447c2 | Python | 18,782 | 423 | import math
import torch
from torch import nn
import torch.nn.functional as F
import lightning.pytorch as pl
from predmoter.core.constants import EPS
class LitHybridNet(pl.LightningModule):
def __init__(self, model_type, cnn_layers, filter_size, kernel_size, step, up, dilation, lstm_layers,
hidd... |
c981b43e425e82bf69dbf15e0b4876fb05dcf5c113f4bd11fff41f974020521f | Python | 18,783 | 670 | import itertools
import random
import sys
import time
from pathlib import Path
from typing import Optional
import os
import torch
import numpy as np
import pandas as pd
from jarvis.core.atoms import Atoms
from jarvis.core.graphs import nearest_neighbor_edges, build_undirected_edgedata
from jarvis.db.figshare import d... |
973b81a9dc9fe6b9e20ce2897a4c3a1ec13a2e370f86c18cec68aa74732718bc | Python | 18,784 | 483 | # 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... |
fff7a2e3b9f5dc4300a05ca01f7e3b2a4a50f436d2f17a22deeff4669dbc3f85 | Python | 18,788 | 545 | """====================
ReadQc pipeline
====================
The readqc pipeline imports unmapped reads from one or more input
files and performs basic quality control steps. The pipeline performs
also read pre-processing such as quality trimming or adaptor removal.
Quality metrics are based on the FastQC tools, see... |
26f5efca1d75e12e75424ce018724fddf3a544c3a11be713ada0b72d202722c5 | Python | 18,802 | 546 | import torch
import pandas as pd
import numpy as np
import random
# Normalization of data. Input is arrays
def normalize(data):
means = data.mean(dim=0, keepdim=True)
stds = data.std(dim=0, keepdim=True)
normalized_data = (data - means) / stds
return normalized_data
# Given the old Gamma (projections)... |
7ec9468ecc1a25d86ca1720371c6b9289b6257c70b35bde9a335655ca93d105e | Python | 18,806 | 317 | """Build per-cycle physics indicators + the 16 PINN4SOH charge-curve statistics from RAW curves.
Sources
data/raw/batterylife/<DATASET>/*.pkl (BatteryLife_Processed: 12 lab datasets, one pickle per cell, raw I/V/Q/t per cycle)
data/raw/nasa/extracted/B00xx.mat (NASA PCoE, charge/discharge/impedance records)
... |
e0c65764fca08233e75e177cc7f43266457e86c6cbb173168cb21082d8f787a1 | Python | 18,815 | 472 | """This scripts will run the training loop for optimal transport"""
from time import time
import json
import numpy as np
import os
import logging
import torch
from torch.utils.data import DataLoader
from sklearn.model_selection import train_test_split
import src.utils as utils
from src.dense_net import DenseNet
cla... |
4a4b801d24d92f437f11f6500819330ef8b8a236034c19f8e77655e9417a909a | Python | 18,816 | 438 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 22 21:08:02 2022
@author: Shencong Ni
"""
import mydata
import numpy as np
#import brian2.numpy_ as np
#from brian2.only import *
#import post_analysis as psa
import firing_rate_analysis as fra
#import frequency_analysis as fqa
import get_onoff_cp... |
0d89098b423c0fc8f39337400d252717a5e1d49032c5702dc71f119f83b09ae2 | Python | 18,824 | 543 | import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import scipy.optimize as optimize
from scipy.special import erfc, erfcinv
import joblib
import torch
from torch import nn
from net_utils import load_from_file
from data import generate_recog_data, recog_chance
def plot_loss_acc(net, chanc... |
9ef16c9362c4b3b715f63fe51eb4c86d5654a0c7ddb789dafd52686414fc0bef | Python | 18,829 | 420 | import os
import shutil
from pkg_resources import resource_filename
from simtk import unit
from perses.dispersed import feptasks
from perses.app import setup_relative_calculation
import mdtraj as md
from openmmtools import states, alchemy, testsystems, cache
import pytest
from perses.tests.utils import enter_temp_dir... |
a6e9f8d68caf289f5550a579ac02c665e5956062f4bcafe54e4080f0d07b5c3a | Python | 18,834 | 470 | """
EquiformerV3 backbone adapted for OrbFlow GTO coefficient prediction.
Vendored transformer blocks from https://github.com/atomicarchitects/equiformer_v3
(MIT / Meta FAIR lineage). Graph edges come from the dataset (same as eSCN), not fairchem OTF.
Interface matches ``scdp.model.scn.eSCN``: ``forward(data) -> (coe... |
caede65ca686a62d42d4ecb4dd8fcdfcf4820c034a635d4fd6c0b6e5c9188ffe | Python | 18,853 | 541 | import torch
import os
import pickle
from h3xsemble.utils.protein import Protein, to_pdb
def split_output_loss_dic(loss_dic, batch_size):
memo = [{} for x in range(batch_size)]
for x in loss_dic.keys():
for y in range(batch_size):
memo[y][x] = loss_dic[x][y]
return memo
def from_mask... |
3b82f4a917043ddfd6986615621c45a4c653965167430c2983b79463e1e4cf50 | Python | 18,860 | 257 | """Experiments on the raw-derived corpus (data/processed/physics_features_long.parquet; 'corpus B').
Stages (run separately so they can share the machine):
point GBDT (and optionally a deep backbone) under P1 / P3 / P4 for feature sets
stats = 16 charge statistics + anchored ratios + cycle index (... |
67725554f8b8fa54d3955f3a98d9ff2d9e9240c9c130476a2331e40caa49a49d | Python | 18,867 | 597 | from collections import Counter
from collections.abc import Hashable, Iterable
from pgmpy.utils.sets import _variable_or_iterable_to_set
class _TreeNode:
"""
Private base class for all expression tree nodes.
Not part of the public API. Provides the shared interface that makes uniform tree traversal
... |
3b08f6ec1c591134c5b796e8e86cee7f7edfa3566f5adaf342bf9e777809da17 | Python | 18,913 | 367 | from __future__ import print_function
import numpy as np
import copy
import logging
from perses.dispersed.feptasks import compute_reduced_potential
from perses.storage import NetCDFStorageView
from perses.annihilation.relative import HybridTopologyFactory
from openmmtools.constants import kB
from openmmtools.cache impo... |
35ee9a411d45ae090866bc54313efc95de29ddc4b6ad02d49fdcb5b17569c527 | Python | 18,915 | 496 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 20 18:54:54 2021
@author: Bruno Caneco
Purpose: Main script to run the Salmon Scale Circuli detector via a command-line interface.
Brief pipeline description:
(i) Convert scale image's format to jepgs
(ii) Detect focus location on each scale image
(iii) Ext... |
31a0f4280079491d1a062bfe5edab89e394eeb3d49e6ae326809c782ca854001 | Python | 18,918 | 394 | #!/usr/bin/env python3
"""Design guides naively for diagnostics.
This can be used as a baseline for the output of design.py.
"""
import argparse
import logging
import heapq
from easyDesign import alignment
from easyDesign.utils import log
from easyDesign.utils import seq_io
logger = logging.getLogger(__name__)
de... |
be4f4173a099ab9c76ca7f57cd2ffc2c97a3c5a5885acdd19a32c5a5a18df82d | Python | 18,925 | 388 | import math
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.python.framework import ops
# >>>>>> Formatter functions:
def create_placeholders(n_x, n_y):
"""
Creates the placeholders for the tensorflow session.
Arguments:
n_x -- scalar, size of vector
... |
cb5a3eaabc1df2c1f59adf5b485695a71aea6f8ff855c772e6beb7367414d46f | Python | 18,929 | 487 | # pypl2api.py - High level functions for accessing
# .pl2 files. Mimics Plexon's Matlab PL2 SDK
#
# (c) 2016 Plexon, Inc., Dallas, Texas
# www.plexon.com
#
# This software is provided as-is, without any warranty.
# You are free to modify or share this file, provided that the above
# copyright notice is kept intact.
fr... |
ceca9fcb3d9df78a098f391af6a31d65d7db5f8b7610b81c241ff4b678a680da | Python | 18,930 | 768 | """===========================
Single Cell RNASeq QC
===========================
Overview
========
This pipeline takes in both Fastq and aligned reads files (BAM),
and performs a number of QC steps. These output metrics and statitistics
that can be used to filter out problematics cells in a
single cell RNA-seq exper... |
dfefe0f968dbba19a223324c05c1b2a195e4596eecb428819db46722418e9eb9 | Python | 18,935 | 397 | """
Finding the best parameter
objective(trial): validate on validation set and return the best parameters
detailed_objective(trial): evaluate on test set by combining the train, valid data and refit with the best parameters
"""
import argparse
import time
import pickle
import pathlib
import numpy as np
import... |
6e76b076f37b65787294ed90428389ba532766aa9a39e68833d9c433f4dc8562 | Python | 18,944 | 492 | # Code adapted from https://github.com/luost26/3D-Generative-SBDD/tree/6f9c7d92784e58474b9c22a74c8113f0344ca795 and https://github.com/mattragoza/liGAN
import numpy as np
from openbabel import openbabel as ob
from rdkit.Chem import AllChem as Chem
from rdkit import Geometry
from scipy.spatial.distance import pdist
f... |
9d35c2bfb0d6bc9b36940b54ddff469c2ebef55a1aac57c2c3bd8a98dec6b5f2 | Python | 18,970 | 396 | """
Do a decomposition analysis of the mean squared error between the subjects' estimates
and the normative model's estimates. The analysis is performed here at the group level.
The mean squared error represents the mean of the squared difference between
a subject's estimate and the normative model's estimate, across d... |
84b86f1bb6e8f210e2256e419d7e6e5118a8f46ea376355c7ffbaad4647f957d | Python | 19,022 | 546 | #!/usr/bin/env python
#
# pumpsim: numerical model for electrogenic transport
# Copyright (C) 2024 David Stokes
# stokes@nyu.edu
# Dept. of Biochemistry and Molecular Pharmacology
# NYU School of Medicine
# 550 First Ave
# New York, NY 10016 USA
#
# This progr... |
952b3ad65c7dd9a7070f95a6de6e6e925b92d0c2171e1ea49a9cff4de27ffb81 | Python | 19,054 | 601 | import math
import torch
import torch.nn as nn
from torch.nn import init
import torch_geometric
from torch_cluster import radius_graph
from torch_geometric.utils import remove_isolated_nodes
from torch_scatter import scatter
from e3nn import o3
from e3nn.util.jit import compile_mode
from ._tensor_product import CPTe... |
598649d0b16134b64b2a6b2a02682c981965200d4671c6c0898f984d687752aa | Python | 19,075 | 544 | import os
os.environ["CUDA_VISIBLE_DEVICES"]="1"
import sys
sys.path.insert(0,"/examples")
from modulusDL.models.arch import CustomModuleArch, InheritedFullyConnectedFlexiLayerSizeArch, FullyConnectedFlexiLayerSizeArch, SingleInputInheritedFullyConnectedFlexiLayerSizeArch, CaseIDtoFeatureArch
from modulusDL.eq.pde impo... |
9a75d00c4185fbbba4a085c21f0bfc5e2c855f924ea4a8527241ad30b028069d | Python | 19,075 | 544 | import os
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import sys
sys.path.insert(0,"/examples")
from modulusDL.models.arch import CustomModuleArch, InheritedFullyConnectedFlexiLayerSizeArch, FullyConnectedFlexiLayerSizeArch, SingleInputInheritedFullyConnectedFlexiLayerSizeArch, CaseIDtoFeatureArch
from modulusDL.eq.pde impo... |
bab3eb6a84ac0bd83935fdae50a926356a9ec8ad52272919f44197022e8227a2 | Python | 19,077 | 544 | import os
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import sys
sys.path.insert(0,"/examples")
from modulusDL.models.arch import CustomModuleArch, InheritedFullyConnectedFlexiLayerSizeArch, FullyConnectedFlexiLayerSizeArch, SingleInputInheritedFullyConnectedFlexiLayerSizeArch, CaseIDtoFeatureArch
from modulusDL.eq.pde impo... |
ab00fecc5d09731296c19106ad8b889fab394cde6c6b011880fbddea574df421 | Python | 19,081 | 558 | """Module to generate networkx graphs."""
"""Implementation based on the template of ALIGNN."""
from multiprocessing.context import ForkContext
from re import X
import numpy as np
import pandas as pd
from jarvis.core.specie import chem_data, get_node_attributes
# from jarvis.core.atoms import Atoms
from collections im... |
0dda4d0eb7b8152362f756ac9251e1a407d5107572795f9fcaec441be3c2493a | Python | 19,117 | 474 | import os
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pickle
from math import isnan
import datetime
import torch
from torch.nn import MSELoss
from torch.utils.data import random_split, Dataset, DataLoader
import pytorch_lightning as pl
from pytorch_lightning import Train... |
5679347173caf22ac504eba19ba1583a5c410f5ff02ddffbdaa885e9ee57856f | Python | 19,131 | 428 | # 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... |
d27f67d4f9e4ef1a63763c73e20039e14dc3352f747d371e1da0382af5bfbb36 | Python | 19,146 | 562 | """ Provides a thread/script pooling mechanism based on ssh + screen.
:Version:
1.1.0
:Date:
19.03.2017
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2017 Jan Melchior
This file is part of the Python library PyDeep.
... |
d051c6b063eeff296d172a103e9341198268250def00ac3d9fa4b1ba2a396c49 | Python | 19,162 | 356 | import numpy as np
import torch
from torch.utils.data import Dataset
import os
import pandas as pd
import networkx as nx
from networkx.algorithms import tree
from math import pi
from rdkit import Chem
from rdkit.Chem.rdchem import BondType
from Bio.PDB import PDBParser
import warnings
from Bio.PDB.PDBExceptions import... |
d452dee016781a1566b5d8bdbee4218908afc91588ccff4fdf3208d9e7f2c971 | Python | 19,180 | 401 | """
GPT model:
- the initial stem consists of a combination of token encoding and a positional encoding
- the meat of it is a uniform sequence of Transformer blocks
- each Transformer is a sequential combination of a 1-hidden-layer MLP block and a self-attention block
- all blocks feed into a central residual p... |
1b7c45e503dab2ae89a4ecc7c1f8b417629e8f9bb7f2590003cd65143495f400 | Python | 19,185 | 528 | import itertools
import xml.etree.ElementTree as etree
import numpy as np
from pgmpy.factors.discrete import TabularCPD
from pgmpy.models import DiscreteBayesianNetwork
from pgmpy.readwrite._base import BaseReader, BaseWriter
from pgmpy.utils._warnings import _warn_external
class XBNReader(BaseReader):
"""
... |
d14bfa6194b92142b85397d9dbdc23e752d2634f820b5146f2d489f4eeb7ff65 | Python | 19,185 | 458 | ## - archived on may 21 2022
import os.path
from dataclasses import dataclass
from typing import List
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.ticker as mticker
import matplotlib.pyplot as plt
from scipy import io
from packerlabimaging.utils.utils import threshold_detect
def p... |
b5a3f859078e8fc41bc279524b682978412d15e3bec20eab052cbe85056d50a2 | Python | 19,207 | 544 | import os
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import sys
sys.path.insert(0,"/examples")
from modulusDL.models.arch import CustomModuleArch, InheritedFullyConnectedFlexiLayerSizeArch, FullyConnectedFlexiLayerSizeArch, SingleInputInheritedFullyConnectedFlexiLayerSizeArch, CaseIDtoFeatureArch
from modulusDL.eq.pde impo... |
e4a33022ccd0e99eee68476433bc7bd8ceb0d71b767c608a6da8eb5424685097 | Python | 19,216 | 523 | '''PipelineIDR.py - Tasks for IDR analysis
=============================================
Reference
---------
'''
import os
import re
import pysam
import random
from cgatcore import pipeline as P
import cgatcore.iotools as iotools
import cgatPipelines.PipelineTracks as PipelineTracks
from cgat import WrapperIDR
def... |
5febd6665505fb257e855001eaaeba1984fa4404cd3c0238ed549f3e6b5817cd | Python | 19,230 | 492 | # -*- coding: utf-8 -*-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~IMPORTS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Standard library imports
from collections import OrderedDict, namedtuple, Counter
import gzip
import itertools
# Third party imports
from tqdm import tqdm
import numpy as np
import pandas as pd
from scipy.stats ... |
d9ddf07fa0789652f00bf27d59cf61c0a57d4f04f98424196e10c0a2684a8cbb | Python | 19,230 | 436 | '''
The MSN class defining the cell
'''
from neuron import h
import numpy as np
import json
# Distributions:
'''
T-type Ca: g = 1.0/( 1 +np.exp{(x-70)/-4.5} )
naf (den): (0.1 + 0.9/(1 + np.exp((x-60.0)/10.0)))
'''
def calculate_distribution(d3, dist, a4, a5, a6, a7, g8):
'''
Used for setting the maximal c... |
19a2edc394ccece184c13ae6572d75087bcfa618e027a0b07e3b4cabc180a4ea | Python | 19,247 | 377 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 12 17:02:26 2023
@author: weihan
"""
import os
import gc
import time
import torch
import random
import argparse
import pandas as pd
import numpy as np
from model.PygLinkPrediction import PygLinkPrediction
from model.MLP import MLP
from model.MakePyg... |
b18d13418d2760553d6fcaca765ef87c2d34e6018c204abab2bebf38a8e9100d | Python | 19,261 | 629 | """
Utility functions
"""
from itertools import product
from numbers import Number
import numpy as np
import cvxpy as cp
from numpy.random import default_rng
from scipy import linalg
import pandas as pd
import puffbird as pb
import torch
import os
from dreye.api import spherical
from dreye.api.convex import in_hull
fr... |
e7594841a3e46cd1f70923ea37a77847631f526a01b46f80b6f686eb698b2f8a | Python | 19,270 | 405 | import torch
from torch.nn import functional as F
import numpy as np
import matplotlib.pyplot as plt
import psutil
from KineticAssembly_AD import VecSim
from KineticAssembly_AD import VectorizedRxnNet
from torch.optim.lr_scheduler import StepLR
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.optim.lr_... |
9f6f47d8b88c6d43df8eb0987c2f3091988837aa6fb046a322e02e9492a1e57c | Python | 19,275 | 542 | from typing import Iterable, List, Optional, Sequence, Tuple, Union
import numpy as np
import torch
from scipy.spatial.distance import euclidean
from torch.nn.modules.utils import _pair
from bindsnet.learning import PostPre
from bindsnet.network import Network
from bindsnet.network.nodes import DiehlAndCookNodes, Inp... |
62e487bd33712111567525874b05151e64b9afe0a7e8f969e07407482ba20279 | Python | 19,283 | 299 | # Copyright (c) 2008-2026 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Covered Software is provided under this License on an "as is"
#... |
96a9a847a6523f9485aa8219bdcf6bdf2461aabf2a26842da54bce01fd2685d7 | Python | 19,296 | 420 | #from datagenerator import DataGenerator
from csvreader import readcsv, writecsv
import numpy as np
import torch
from math import ceil
try:
from torchdiffeq.__init__ import odeint_adjoint as odeint
except ImportError:
from torchdiffeq import odeint_adjoint as odeint
import matplotlib.pyplot as plt
from matplot... |
5e8f9500e890f3059615a46ace7f871ff9193776f8ce9c317458235420c1c46e | Python | 19,297 | 568 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
from typing import List
import torch
from e3nn import o3
from e3nn.o3 import FromS2Grid, ToS2Grid
# Borrowed from e3nn @ 0.4.0:
... |
b2c5647d338c7420846ca0c22e82cb32fcddcbf8ffa9522a462c57afba300d57 | Python | 19,302 | 565 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as ss
from nolitsa import d2, dimension, surrogates
import numpy as np
from scipy.fftpack import fft, ifft
from scipy.signal import find_peaks
from scipy.interpolate import interp1d
from numpy.random import rand, randn
from dateti... |
782c0887c750f7f1c401a5e8527c92d1415a679a02ec8540b0d63f56cf4d0085 | Python | 19,319 | 576 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from colorsys import hls_to_rgb
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from matplotlib import cm
from pandas import DataFrame
from .base import init_app
from .pdb import init_app_pdb
class Visualizator:
SYMBOLS = [
... |
ab2cce365d4a68fb56683a10eee7f30960ceed9a959be331c7d5495ff24d4cb4 | Python | 19,322 | 567 | import numpy as np
import os
import sys
sys.path.append("./protein_autoencoder/")
import torch
from torch_geometric.utils import from_networkx
from torch_geometric.nn import radius_graph
from torch_geometric.data import Batch
from torch_geometric.loader import DataLoader
import matplotlib.pyplot as plt
import... |
098b71e918b95f92412d4aa13791a9299475edc981e58834fb6e5761c828cf50 | Python | 19,340 | 495 | """Tool call limit middleware for agents."""
from __future__ import annotations
from typing import TYPE_CHECKING, Annotated, Any, Literal
from langchain_core.messages import AIMessage, ToolCall, ToolMessage
from langgraph.channels.untracked_value import UntrackedValue
from langgraph.typing import ContextT
from typin... |
5a3acc7140b89a94693e0bf573a9f3e5be3e6e93b5fd24c29998d63213fe16cf | Python | 19,342 | 608 | from PeakcallingReport import *
import cgatcore.iotools
class FoldChangeTracker(TrackerSQL):
'''the fold change tracker ignores unstimulated tracks.'''
def __init__(self, *args, **kwargs):
TrackerSQL.__init__(self, *args, backend=DATABASE, **kwargs)
def getTracks(self, subset=None):
tr... |
526ba588c51829f915b1cc1547f8466dafbbca0096ce718ed9cf6952c6271638 | Python | 19,343 | 411 | # -- coding: utf-8 --
# @Time : 2023/5/13 13:28
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : pipline_analysis_alignment.py
# @Description: This file is used to ...
import pickle
import numpy as np
import scanpy as sc, anndata as ad
import scipy.sparse as sp
import pandas as pd
import sys
import ... |
caf44adf62b2052a32bf15bec311905ec031d9904ed4e98eb5992c50affa41f3 | Python | 19,349 | 425 | """
python
GNNExplainNode.py
Purpose: Load trained networks, mount in device and explain node of interest.
"""
import argparse
import matplotlib.cm as mcm
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import os
import pandas as pd
import re
import random
import sys
import time
import torch... |
3fa27ece60b9d7c64fcb919b3dcf545ccdc30f9eceef270c393330a6dbaf38e3 | Python | 19,367 | 476 | import rdkit
import rdkit.Chem as Chem
import numpy as np
import random
from edit_mol_direct import get_product_smiles
from collections import defaultdict
elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', 'Co', 'Se',... |
d6b2d5591b277b3c595ed77a44a83670c8b26adfda68212d005e56116b21ec59 | Python | 19,383 | 493 | from matplotlib import pylab
import joe_and_lili
import pickle
import os
import spiketools
from time import process_time as clock
from sklearn.model_selection import StratifiedKFold
from sklearn.linear_model import LogisticRegression
from GeneralHelper import (
Organiser, find,
off_gray, yellow, green, red
... |
b0a10add63039b495a65a5689914790ac05d3940af8b84d54cf7ee17e3576c3f | Python | 19,386 | 485 | # Inspired by https://github.com/NVIDIA/NeMo/blob/main/nemo/collections/common/metrics/perplexity.py
# But we compute the perplexity correctly: exp(average(nll)), not average(exp(nll))
# Also adapted from https://github.com/Lightning-AI/metrics/blob/master/src/torchmetrics/text/perplexity.py
# But we pass in the loss t... |
1ad4b97e9f3d88dd3ffa31263b93dec2fab955e35038ed55b0fae87dfeef542d | Python | 19,417 | 504 | from itertools import combinations
import numpy as np
try:
from pyparsing import Combine, Literal, Optional, Regex, Word, alphas, nums
except ImportError as e:
raise ImportError(
f"{e}. pyparsing is required for using read/write methods. Please install using: pip install pyparsing."
) from None
f... |
906f2a316fbda9f5b813e3805f4b14d43fecf16e09e90ce18296c23d71c2f77e | Python | 19,428 | 498 | "Registry for ToolkitWrapper objects"
__all__ = ("ToolkitRegistry", "toolkit_registry_manager")
import inspect
import logging
from collections.abc import Callable
from contextlib import contextmanager
from openff.toolkit.utils.ambertools_wrapper import AmberToolsToolkitWrapper
from openff.toolkit.utils.base_wrapper ... |
497d37bc8d59be36f26a7cf2d4134c5b4598826189000520978a83ab6f62d3c6 | Python | 19,432 | 561 | """
Created by
@author Shengze Cai
Modified by
@author Mitchell Daneker
Contact Mitchell Daneker with any questions via mdaneker@seas.upenn.edu
"""
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import tensorflow as tf
if tf.__version__ >= "2.0.0":
import tensorflow.compat.v1 as tf
tf.disable_v2_beha... |
e75b1656512d5a23f441aa7c2a32cf500cc1c0dde26da930e2386aeef5738868 | Python | 19,447 | 550 | import collections
import heapq
import os
import platform
import shutil
import tempfile
import einops
import github
import numpy as np
import pytest
import torch
from casanovo import casanovo
from casanovo import utils
from casanovo.data import ms_io
from casanovo.data.datasets import SpectrumDataset, AnnotatedSpectr... |
3c60a7cafe458fa5fba256547ec2a9aa5565eae8a1f286c5afe6930af418d67d | Python | 19,453 | 590 | from typing import Any, cast
from langchain_core.load import dumpd, load
from langchain_core.messages import AIMessage, AIMessageChunk
from langchain_core.messages import content as types
from langchain_core.messages.ai import (
InputTokenDetails,
OutputTokenDetails,
UsageMetadata,
add_ai_message_chunk... |
5df8d63a3b6efa3bd309585982864cd2af8cf4d1a6f681636be6da35ab77f1c0 | Python | 19,475 | 450 | import sys
import numpy as np
import random
class ContigMap:
"""
Class for doing mapping.
Inherited from Inpainting. To update at some point.
Supports multichain or multiple crops from a single receptor chain.
Also supports indexing jump (+200) or not, based on contig input.
Default chain outp... |
322e1893c7a359227b52ddbc9acf8689339c729cbd53d8d70cd4dc09228f7280 | Python | 19,483 | 517 | # pylint: skip-file
import copy
from absl.testing import absltest
import numpy as np
import pytest
from .embanded_numpy import EMBanded
from . import _numpy_model_utils
from . import _numpy_linalg_utils
class EMBandedTests(absltest.TestCase):
"""Test cases for EMBanded."""
def test_compare_model_settings(se... |
cd7a01eb2dafd6cdf7d74e4c8fe3cee2f40c7762fa70a999463d989abc9f2eb6 | Python | 19,493 | 566 | import os
import tempfile
import numpy as np
import numpy.testing as np_test
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.factors.discrete import TabularCPD
from pgmpy.models import DiscreteBayesianNetwork
from pgmpy.readwrite import BIFReader, BIFWr... |
ba58b48df36e05e66bfcfbd21eac09b4cf5a8c209ce4e30ce5867979c0d5dbc7 | Python | 19,508 | 581 | """Access to image data as ``xarray.DataArray``s.
CATMAID's image source conventions are documented here
https://catmaid.readthedocs.io/en/stable/tile_sources.html
"""
from __future__ import annotations
from functools import wraps
from io import BytesIO
from typing import Any, Literal, Optional, Sequence, Type, Union,... |
d4056493fab4291511d74cf824471af04d61192bff4c65c1542b162a4ce14860 | Python | 19,526 | 335 | import pandas as pd
import os
def label_conditions(df, plate_columns_map, plate_rows_map):
"""Assigning the conditions used in each well, according to the plate maps.
Receives dataframe, plate_columns_map, plate_rows_map.
Returns the dataframe."""
# add strain and moi info
df['strain'] ... |
d92cc414fcce4ddad3907473631b96d73c9eef338ec5bf2234bb10bf9bd772e3 | Python | 19,566 | 718 | # %%
# This notebook-style script requires a ~500 MB download from https://www.ebi.ac.uk/biostudies/files/S-BIAD1063/PTI-BIA/Anisotropic_target_small.zip
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import zarr
from iohub import open_ome_zarr
from numpy.fft import fftshift
import waveo... |
070e51d4b6eed421062da28c2b0490ab4de73651c4bc86cf39ddcf6acf83b30b | Python | 19,568 | 472 | import rdkit
import rdkit.Chem as Chem
import numpy as np
import random
from edit_mol_direct_useScores import get_product_smiles
from collections import defaultdict
elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', '... |
0773a7c369aa0bc631f9cced03a62ea576ad98235b2cf5281052aba27d07cfe6 | Python | 19,577 | 399 | import json
import os
from collections import OrderedDict
import typing
import traceback
# from time import time
# from copy import deepcopy
# import gc
import numpy as np
import pandas as pd
# import matplotlib.pyplot as plt
# import matplotlib.gridspec as gridspec
from utils.misc import construct_firings_from_spktr... |
8ce1595e5693b4235a50512c089e96e28269e3b32648937175794cda3ab2f9ab | Python | 19,601 | 430 | import os
import pathlib
import time
from typing import Union, List, Literal
import equinox as eqx
import numpy as np
import torch
import torch.nn.functional as F
import wandb
from einops import rearrange, repeat, pack, unpack, reduce
from torch_scatter import scatter, scatter_std
from torchdiffeq import odeint as nn_... |
dfe3f0275e27a7fb54ac068ec13eea2b53922b9e7d328028b1768d671c76ab95 | Python | 19,620 | 605 | from typing import Any
from langchain_core.messages import AIMessage, AIMessageChunk, HumanMessage
from langchain_core.messages import content as types
def test_convert_to_v1_from_anthropic() -> None:
message = AIMessage(
[
{"type": "thinking", "thinking": "foo", "signature": "foo_signature"}... |
d74a448e54b00e043f3ab13ab8cd009e18e0dc1ac4705efd54989fcb053df11f | Python | 19,647 | 510 | """
braincell_panel.py
Tkinter GUI for deploying the BrainCell Docker container to a remote
cluster. Built on top of `cluster_session.py` which does the actual SSH
work.
Launch:
python braincell_panel.py
Dependencies:
pip install paramiko
(tkinter ships with Python on all standard installs.)
Design:
... |
63c6ba284200314bfa4c63803e2cf4cfc48f30727d99aec65be4a14a3f8a037a | Python | 19,658 | 636 | from __future__ import annotations
import collections
import math
import os
from dataclasses import dataclass
from typing import Dict, Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from e3nn import o3
from e3nn.o3._tensor_product._codegen import _sum_tensors
from e3nn.util.jit import... |
49fe5cd3c29bdafa62a41927d1b9245cf680a588a65c376caec0e2c7c41efe83 | Python | 19,668 | 353 | # 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... |
c50d5e44556681fd7ede68fcf4ead97fa921d5a16d4c7e1a840020d5179c9490 | Python | 19,690 | 455 | # Imports
import sys
import os
import argparse
import inspect
from datetime import datetime
import numpy as np
from tqdm import tqdm
from math import ceil
from time import perf_counter, process_time
import torch
import torch.optim as optim
try:
from torchdiffeq.__init__ import odeint_adjoint as odeint
except Impo... |
02b57ee02f85d33ad8bdcafebce07cef12fdd0c65c458fbab8662c92c6a151dc | Python | 19,696 | 524 | import jax
import jax.numpy as jnp
import jax.random as jrng
import jax.tree_util as jtu
import flax
import wandb
from clu import metrics
from flax import struct
from flax.training import train_state
from flax.traverse_util import path_aware_map
from flax.core.frozen_dict import freeze
from typing import Dict, Any
from... |
42d8293c92056376924aae362352d9056ebbfa932938172e824fa29e42fcafa7 | Python | 19,704 | 595 | import pickle as pkl
import itertools
import seaborn as sns
import pandas as pd
import numpy as np
import scipy
from scipy import special, integrate
from scipy.signal import find_peaks
from pathlib import Path
import time
import sys
import model_output_manager_hash as mom
memory = mom.Memory('make_plots_cache')
# memo... |
19c7c1bc690344c7057d169334b38ca469c992e164c2cb3b0aa49abbc703bab6 | Python | 19,720 | 513 | from typing import Tuple
import itertools
from copy import deepcopy as copy
import torch
import numpy as np
from ase.data import chemical_symbols
from pymatgen.core.structure import Structure, Molecule
from pymatgen.analysis.graphs import StructureGraph, MoleculeGraph
from scdp.common.constants import COVALENT_RADII,... |
16372a20314284699c9c38566ad615b5175c5ff6b6a9344485a29fffbbef8e4c | Python | 19,749 | 614 | import pickle
import os
from typing import Any
import numpy as np
from typing import List, Dict, Any
import collections
from omegaconf import OmegaConf
import dataclasses
from data import chemical
from data import residue_constants
from data import protein
from data import so3_utils
from openfold.utils import rigid_uti... |
b2bf313419ca195a1f5223812df4a05fe50a64759be5606471e4790f9554c5db | Python | 19,761 | 528 | # 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... |
dc493e9f5599199c36e37fe90aa54c5d146f001d1876d15cf8492eb223d0c159 | Python | 19,768 | 403 | # STA Movie Maker
# Lloyd Russell 2017
# No GUI edit Rob Lees 2020
import sys; sys.path.append('/home/pshah/Documents/code/Vape/')
sys.path.append('/home/pshah/Documents/code/PackerLab_pycharm/')
from _utils_ import paq_utils
import os
import ctypes
import json
import numpy as np
import difflib
import glob
import colo... |
8d19a5810b4c9697e7d688665be8a6826b9ecf3108aab580a779c92274c60fe9 | Python | 19,771 | 467 | from typing import Optional, Tuple
import torch
from torch import Tensor, nn
from torch_geometric.data import Data
from torch_geometric.nn import MessagePassing
from torch_scatter import scatter
from .utils import (
NeighborEmbedding,
EdgeEmbedding,
CosineCutoff,
Distance,
Sphere,
VecLayerNorm,
... |
71588674263b7311ab471fee72c1885b43f73b2b970206ac18e3e893632e0e17 | Python | 19,779 | 415 | import copy
import torch
import os
from tqdm import tqdm
import numpy as np
from CEL.utils.register import register
import torch.nn as nn
import optax
import equinox as eqx
import jax
from CEL.data.data_manager import MyDataLoader
from CEL.networks.models.meta_model import ModelClass
import pathlib
from munch import M... |
d60257022192574ab141f8d468450de943234c85bf5fae093bdc63b35a49cf30 | Python | 19,801 | 515 | """LLM-based tool selector middleware."""
from __future__ import annotations
import logging
from collections.abc import Callable
from dataclasses import dataclass
from typing import TYPE_CHECKING, Annotated, Any, Literal, TypeGuard, Union
from langchain_core.language_models.chat_models import BaseChatModel
from lang... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.