sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c8afabb30b267c005cea7350fcc7c285c1079485848ed403ade9e7018dda1762
Python
11,076
251
# -*- coding: utf-8 -*- """ Created on Wed Sep 20 16:48:57 2023 @author: Ed""" import sys import pandas as pd import numpy as np from scipy.optimize import curve_fit import matplotlib.pyplot as plt import cv2 import os #Main function is here def CalcWarpRemap(pointFile, remapfile, projx, projy, im...
4913ae19eab682b6449a18657888ee2fc06c60e81edef39f55cf8431356f2868
Python
11,079
318
""" Convert PASCAL VOC XML-type dataset to TFRecords for Tensorflow object_detection. Example usage: python convert_pascal_to_tfrecords.py \ --images_dir "./data/scales_data_sample/images/"\ --annotations_dir "./data/scales_data_sample/annotations/"\ --image_set_file "./data/scales_data_sample/image_s...
a05e3275295522df168492d1c390a680081d36447172285e0388ee8d94b5092b
Python
11,079
407
from chreyesees import plot_utils import seaborn as sns import numpy as np import proplot as pplt from itertools import product from chreyesees.palettes import CMAP_CELLS from chreyesees.plot_tetrahedron import plot_tetrahedron RADIUS = 0.1 WIGGLE = 1 TRANSFORM_FUNC = lambda x: x POINT_SIZE = 3 POINT_OFFSET = 3.5 def...
7b956d3bcc3581ee5ff369369d4ef2f1f45567d5ffda38c2735304b707ad1947
Python
11,085
192
import os import pytest from perses.tests.utils import enter_temp_directory @pytest.mark.gpu_needed def test_RESTCapableHybridTopologyFactory_repex_neutral_mutation(): """ Run ALA->THR and THR->ALA repex with the RESTCapableHybridTopologyFactory and make sure that the free energies are equal and opposite. ...
8c47b4950854709c412049f91cd44b2f2226e918c6499224e9f16ca9f5c9c8f6
Python
11,087
207
"""DDSurfer surface prediction for white-matter and pial cortical surfaces.""" from __future__ import annotations import argparse from contextlib import nullcontext import logging from pathlib import Path import sys import time import nibabel as nib import numpy as np import torch from inference.coordinates import G...
e34247aced0043cb85a74dbffaf0fe3df9395909985d4fafbea92303d928f856
Python
11,090
252
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 dbdm_preprocess_func __all__ = ['dbdm_prob_weight'] class DbdmProbWeight(TaskModel): def __init__(self, **kwargs):...
01978b7dba644b77e9f4477a1ade29376a108a9c68a5ca3deb3eca44ac19fa0d
Python
11,098
344
import torch import torch.nn as nn from torchvision import models import torch.nn.functional as F from .resnet_model import * class RefUnet(nn.Module): def __init__(self,in_ch,inc_ch): super(RefUnet, self).__init__() self.conv0 = nn.Conv2d(in_ch,inc_ch,3,padding=1) self.conv1 = nn.Conv2...
324a05f257448d19b4f35043497750feb809a80fe07f5e004491ac0181560214
Python
11,098
258
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 B...
14a6794c904b81a4f80f173101adce2022ba0cc137f4792e55b2b6c28b8bee90
Python
11,100
453
from collections.abc import AsyncIterator, Iterator from typing import Any from langchain_core.messages import AIMessageChunk from langchain_core.output_parsers.openai_functions import JsonOutputFunctionsParser GOOD_JSON = """```json { "foo": "bar" } ```""" JSON_WITH_NEW_LINES = """ ```json { "foo": "bar" }...
59de8f46324c2a72f39fbabbea0b7bd41dbad0458405f4b685e18dc121091739
Python
11,100
249
import torch from stable_baselines3.common.policies import BasePolicy import torch as th import gym from gym import spaces import math import random from stable_baselines3.common.preprocessing import get_action_dim, is_image_space, maybe_transpose, preprocess_obs from stable_baselines3.common.type_aliases imp...
2c7cefe8bc109338fb36714ad155d57013be74ec86f08de9b1df79943bc55a9e
Python
11,102
251
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 ts_preprocess_func __all__ = ['ts_par7'] class TsPar7(TaskModel): def __init__(self, **kwargs): super().__...
075bc5b60fb364f9d0eb55171c2248c172458852143ff97f678d77cc1e1ba499
Python
11,103
334
#!/usr/bin/env python # command line args import argparse PARSER = argparse.ArgumentParser() PARSER.add_argument("data_file") PARSER.add_argument("extras_file", nargs='?') PARSER.add_argument("--color_map", dest='color_map', default='seismic', help="Name of a matplotlib color map.") PARSER.add_argument("--mult...
7c2a49f72776f10a2603247304c0d38e7e9e465d1e0e6d210918ff59edbdfcda
Python
11,104
266
#!/usr/bin/env python # coding: utf-8 """ Original Author: Anthony Juliano, acjulian@uvm.edu Wrapper Author: Greg Conan, gconan@umn.edu Wrapper Created: 2021-06-22 Wrapper Updated: 2021-11-12 """ # Import standard libraries from glob import glob import os import pandas as pd import shutil import subprocess import sys...
8d234c4dc80b22a4a511247155c168ed21df6612c794dbcac344c84291e16bfc
Python
11,109
261
import sys import argparse import pyBigWig import pyfaidx import subprocess import pandas as pd import numpy as np import itertools import warnings from termcolor import colored import os from modisco.visualization import viz_sequence import chrombpnet.training.utils.one_hot as one_hot from chrombpnet.data import Defau...
e2f62fca764eaad85d727320877d005e0898cf602c26ec281190426698a6a311
Python
11,112
152
"""FINAL confirmatory CPU run (5 seeds). Produces: results/final_point.csv Ridge / GBDT (abs, anchored) x P1-P4 x fold x seed x test dataset (MAPE, RMSE, MAE) results/final_conformal.csv GBDT-anchored intervals under P3 and P4: split / mondrian(dataset) / cqr / weighted / shift-matched ...
a3484442b658981b21d02d1eea8014cf03852ca817669971cd78ded5477723e8
Python
11,118
301
"""Output parser for XML format.""" import contextlib import re import xml import xml.etree.ElementTree as ET from collections.abc import AsyncIterator, Iterator from typing import Any, Literal from xml.etree.ElementTree import TreeBuilder from typing_extensions import override from langchain_core.exceptions import ...
dc226fbe8c15feab60ef6ffdc051a872c05509becac8c044b5b8ce81dc235272
Python
11,122
249
import torch from stable_baselines3.common.policies import BasePolicy import torch as th import gym from gym import spaces import math import random from stable_baselines3.common.preprocessing import get_action_dim, is_image_space, maybe_transpose, preprocess_obs from stable_baselines3.common.type_aliases imp...
c4eef37f2c19ff3c583b9d663838e23e9581db3a61a8110b2adb2558903640fa
Python
11,123
294
import torch import numpy as np import torch.nn as nn from timm.models.layers import trunc_normal_ from pdearena.models.transolver.model.Embedding import timestep_embedding from pdearena.models.transolver.model.Physics_Attention import Physics_Attention_Structured_Mesh_2D from pdearena.configs.config import CFDConfig f...
87d1f9c2ab965a948adee4416ea3f44477aa9c79cccd27f63926d7bbc2a0a78e
Python
11,128
249
import torch from stable_baselines3.common.policies import BasePolicy import torch as th import gym from gym import spaces import math import random from stable_baselines3.common.preprocessing import get_action_dim, is_image_space, maybe_transpose, preprocess_obs from stable_baselines3.common.type_aliases imp...
e5f0b9ddfcfcebca23b7c98ace5ffff93801db4189ea12573c4225a1498f024a
Python
11,134
297
import torch from torch.distributions.categorical import Categorical import numpy as np from egnn.models import EGNN_dynamics_QM9, EGNN_encoder_QM9, EGNN_decoder_QM9 from equivariant_diffusion.en_diffusion import EnVariationalDiffusion, EnHierarchicalVAE, EnLatentDiffusion import pickle from os.path import join def...
558c2900ad853545632d120b91dddc17cd57cb9101dceb8dbed3abdb5dce4892
Python
11,139
324
"""Parsers for OpenAI functions output.""" import copy import json from typing import Any import jsonpatch # type: ignore[import-untyped] from pydantic import BaseModel, model_validator from pydantic.v1 import BaseModel as BaseModelV1 from typing_extensions import override from langchain_core.exceptions import Outp...
7e2e42ef05ebf6e8b659e98cbb627916884f0f081d837afc06990a7d8f0c2ce1
Python
11,147
392
# 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...
3cbf77d15b6def4548d4f89140ba1e69fd4f08ce733732def5053c991c5f4e32
Python
11,151
269
"""Test all ConvNet capabilities.""" import pytest import numpy as np import copy import logging import os import shutil import torch import torch.nn as nn from torch.utils.data import DataLoader, Subset, TensorDataset import vulcanai from vulcanai.models import BaseNetwork from vulcanai.models.cnn import ConvNet, Co...
18898029d76f283b073b1600df3a50908346e3ba558110e5104000d93acc797b
Python
11,154
338
#!/usr/bin/python ############################################################################# #Package: stamp #Updated by Yiqin Wang #Usage: #summarize read coverage for whole-genome sequencing data # ############################################################################## import os, sys import time ...
41d89515bd238459f43f0b7e857db0321ea25464faa8d17d358e8c1095fe5865
Python
11,154
347
"""Base classes for media and documents. This module contains core abstractions for **data retrieval and processing workflows**: - `BaseMedia`: Base class providing `id` and `metadata` fields - `Blob`: Raw data loading (files, binary data) - used by document loaders - `Document`: Text content for retrieval (RAG, vect...
da6130e7c5f140d165c8c7382b54aa3bbd26b19ee358ade58e6da76ef38f3565
Python
11,166
256
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F device = torch.device("cuda" if torch.cuda.is_available() else "cpu") thresh = None # neuronal threshold decay = None # decay constants num_classes = None batch_size = None learning_rate = None lr_decay = None num_epochs...
8f8b3b3578c90f2a480cbc8eb50a728db7f130eea8cbffb20794a47bb0fa4a49
Python
11,169
402
import scipy.stats as ss from SMdRQA.RQA_functions import entropy from SMdRQA.RQA_functions import average from SMdRQA.RQA_functions import maxi from SMdRQA.RQA_functions import mode from SMdRQA.RQA_functions import percentmorethan from SMdRQA.RQA_functions import diaghist from SMdRQA.RQA_functions import onedhist from...
640891adff1c045bed111a4d461ce23b9ec815067cef447a9d04b3e64239f0dd
Python
11,170
316
import torch import torch.nn as nn import torch.nn.functional as F from time import time import numpy as np def timeit(tag, t): print("{}: {}s".format(tag, time() - t)) return time() def pc_normalize(pc): l = pc.shape[0] centroid = np.mean(pc, axis=0) pc = pc - centroid m = np.max(np.sqrt(np.s...
ae70a0b4b4a979d8e777fa04514b229f1ce9868891eaaabe39a2dd1126d02958
Python
11,171
246
""" Analyze relationship between the subject's learning rate and model variable (cpp, uncertainty) at the group level. """ import argparse import data_analysis_utils as dana import itertools import matplotlib.pyplot as plt import matplotlib.ticker import model_learner as model import numpy as np import os.path as op i...
19e2ae45b5a5777d83f4b457d93179dec4183b27994810c56f2757e983b82222
Python
11,177
328
"""**Retriever** class returns `Document` objects given a text **query**. It is more general than a vector store. A retriever does not need to be able to store documents, only to return (or retrieve) it. Vector stores can be used as the backbone of a retriever, but there are other types of retrievers as well. """ fro...
094ef0fed8474969c9bdcd97a1c679f3afff0afa242519152a2a61d6ad94c890
Python
11,181
318
"""SSRF protection policy with IP validation and DNS-aware URL checking.""" import asyncio import dataclasses import ipaddress import os import socket import urllib.parse from langchain_core._security._exceptions import SSRFBlockedError # --------------------------------------------------------------------------- # ...
3e2644a68f69df6b7d0eacec31b3e02124b9bc3eb10ec73db6fc24c480c8083d
Python
11,182
418
import warnings 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.example_models import load_model from pgmpy.factors.discrete import TabularCPD from pgmpy.models import DiscreteBayesianNetwork from pgmpy...
43956a5507f05a72ae80a8a33a1841e35d0927a6df106d6a085bb941246588a1
Python
11,184
303
# MIT License # Copyright (c) 2021 Yuyang Wang # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, pu...
71cddc47a87306326ab44babcf3b873ba22ec4a31f0dd207f30d0d2c697cadbe
Python
11,185
299
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ae_head_predictor.py ==================== Drop-in leaderboard-compatible wrapper that: 1. Trains a BERNN AE encoder (using TrainAEClassifierHoldout). 2. Freezes the encoder and extracts train / test embeddings. 3. Sweeps all classification heads (XGBoost, RF, SVC...
a6eebad898e7ddcc4888428dbd87c3d87b3001964473193cea527bdb0cb5f100
Python
11,188
272
"""Test all DenseNet capabilities.""" import pytest import numpy as np import copy import logging import os import shutil import torch import torch.nn as nn from torch.utils.data import DataLoader, Subset, TensorDataset import vulcanai from vulcanai.models import BaseNetwork from vulcanai.models.dnn import DenseNet, ...
ade9054a8231c3e01cf24dba0a82ba849cbdf498eaf80cd6a2b8ad64cc95e8f0
Python
11,195
254
import torch import numpy as np import copy from ._base import register_transform, _get_CB_positions from rde.utils.transforms.select_atom import chi_atom15_index_map,atom15to37_index_map from rde.utils.protein.dihedral_chi import atom37_to_torsion_angles, AA_TO_INDEX, ALL_ATOMS, ALL_ATOM_POSNS,ONE_TO_THREE, CHI_PI_P...
204bad1c59e3bd3b8378b4c708d7d00945eb0412a28f4225b8216acac772af1a
Python
11,203
258
# this script runs image segmentation of AMF dataset based by transfer learning # Mask-RCNN on detectron2: import argparse import os import random import shutil import time import warnings import pickle import numpy as np import math import sys import copy import re import pandas as pd import matplotlib.pyplot as plt i...
42ffb98a31f0b7898d22bbd57d5dbcaa83eb916bb9759963873a4a7d9dd0adc1
Python
11,211
409
# Flask server to provide read access to image volumes and read/write access # to annotations stored in a provided path. # # This file can be run in two ways: # 1. For development, use flask run annotator.py # 2. For production, use annotator [OPTIONS] """ This provides a webpage to label key-points in a given datase...
b928e8578779eb2ba7abf800d486a81977df9ef02853604293931fe64cd0a287
Python
11,212
316
import torch import torch.nn as nn import torch.nn.functional as F from time import time import numpy as np def timeit(tag, t): print("{}: {}s".format(tag, time() - t)) return time() def pc_normalize(pc): l = pc.shape[0] centroid = np.mean(pc, axis=0) pc = pc - centroid m = np.max(np.sqrt(np.s...
790cefce3cff88a1e7d77fe4e41070eca64c8440f98a2c093a4644f1db3f8889
Python
11,213
216
"""TabFM / XGBoost vs DeepMapper head-to-head, classification metrics (exploration). Adds two tabular classification METHODS alongside DeepMapper's differentiable backbones and compares them on the four-way CD4 T-subtype task (Helper / Treg / Naive / Memory): - TabFM: the Google-Research tabular foundation model (in...
f8c82432c057e0b8815036580d41db39aef283f617d0fe1218408e6add4562d1
Python
11,215
281
""" 2023.09.11 author: jonas.braun@epfl.ch Plotting functions to analyse which behaviours and VNC projections are included in which cluster """ import os, sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl import pickle import tqdm import params linewidth = 2 mpl.rcPa...
f5acb6b066c1eb20141ebf350512a959c039dc719b2b9d59e70ea7fbce8ab196
Python
11,220
302
from collections import namedtuple import h5py import numpy as np from scipy.signal import convolve2d from torch.utils.data import Dataset from ..transforms import DataTransform, Delay, MovieTransform, Subsequence from ..utils import recursively_load_dict_contents_from_group from .base import ( AttributeTransform...
f6810f3961c19863d311526c9aa5f8c5b4e61caa33fe657d4e9691e53204efda
Python
11,226
312
import numpy as np import torch import torch.nn as nn ################################################################################ # Custom attention layers. # ################################################################################ class TransformerLay...
479d72c880714df78551bacc78cd63d3b44cbe21973e7036ecb6fab7fad0419b
Python
11,229
301
# coding=utf-8 import torch import torch.distributed as dist from torch.utils.data import Dataset, DataLoader, Sampler, DistributedSampler from typing import Iterator, List, Optional, Union from collections import Counter from operator import itemgetter import numpy as np class _InfiniteSampler(torch.utils.data.Sample...
542ea107a7cd0c2d8a7f5f09c7ee83eab6e6ef2c9fe6b4405f145706cdc0be64
Python
11,240
348
from copy import deepcopy from typing import Dict, Optional, Sequence, Union import numpy as np import torch import torch.nn as nn from torch.nn.modules.utils import _pair import bindsnet.network.nodes as nodes import bindsnet.network.topology as topology from bindsnet.conversion.nodes import PassThroughNodes, Subtra...
c774c0ab822982844f51a05a71e6e6a45476d7a810aa0597a7ab4560b5e64ebc
Python
11,242
259
# this script runs image segmentation of dataset based by transfer learning # Mask-RCNN on detectron2: import argparse import os import random import shutil import time import warnings import pickle import numpy as np import math import sys import copy import re import pandas as pd import matplotlib.pyplot as plt impor...
e9236fa8a01d6538efae077c05dcc7136d59b78158eaa6f60505d1bb87df76c5
Python
11,246
231
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ POCIF-BAT R2 — H-R2-1, transformation T2 : contrôle d'histoire identique. MOTIF DE LA TRANSFORMATION, déclaré avant retest, fondé sur une mauvaise spécification statistique de T1-b et non sur son résultat. T1-b comparait des η² entre facteurs comportant 4, 12 puis 24...
64c3bed04bd29af0b9dd57a07085c6df8ce2483fbb377c01ce5ef9b38f6156b7
Python
11,247
310
import MDAnalysis as mda import numpy as np from MDAnalysis.analysis import align # -- Functions to preprocess trajectories -- def extract_coordinates(top, pdb, trj_list, out_name, sel_string, start_frame=0, rename_segments=None, residues_offset=0): """ Extracts selected coordinates ...
b69d05ed4c871165d47caf099e211488157f3892113c2a0c44d7e380e365a022
Python
11,252
337
# -*- coding: utf-8 -*- # # Gpipe documentation build configuration file, created by # sphinx-quickstart on Mon Jul 20 11:17:20 2009. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All...
7c6f2f6058bc0d4c9901bedefc9fbc678549795c955a37b2fbe5756033af4222
Python
11,254
330
'''cgat_ruffus_profile.py - analyze ruffus logfile ================================================== Purpose ------- This script collects information about tasks that have completed or are still running in a pipeline. It works by examining the logfile :file:`pipeline.log` looking for the last active run. It will c...
d1cdeb4d8118ec0ca9d0e8dede17b8efd644510f4755a4ce0d9cd959d2689bc9
Python
11,255
310
import errno import json import random import shutil import tempfile import zipfile from collections import defaultdict from pathlib import Path import pydicom from MRdataset.dicom_utils import is_bids_file from MRdataset.tests.config import compl_data_xnat from MRdataset.utils import convert2ascii # from bids import...
f20135882204c17ce0130ee94a39ea21578040a5c7709f1e9cf1f2dec7a813c2
Python
11,256
277
import logging from pathlib import Path from functools import wraps, partialmethod from typing import Tuple, List, Optional import haiku from alphafold.model import model, config, data from alphafold.model.modules import AlphaFold from alphafold.model.modules_multimer import AlphaFold as AlphaFoldMultimer logger = log...
6955c8c5108fdb946accb86bcc0a1ea638ba58d581f9827c30595fdba2741744
Python
11,259
406
'''ucsc.py - Tasks for accessing UCSC data ================================================== This module provides methods for accessing ucsc_ data via the public UCSC relational database server and building UCSC track hubs. The function :func:`connectToUCSC` establishes a connection. Data import ----------- The fu...
e1500d879655533cfb9aadbeb7dafd088b68e78e0b7a86bebba81eee0006884d
Python
11,259
373
''' This is a simple pipeline to demonstrate how ruffus is used to control the flow of data through a series of functions. There is a PowerPoint presentation with details of all the ruffus decorators and which goes through the functions in this pipeline one by one at https://www.cgat.org/downloads/public/training/cgat...
b316f4b5dab307542835236f5bc2b4af29bbb24ea2dd082395a270ad43ede222
Python
11,264
288
"""Equations related to Navier Stokes Equations with coordinate transformation """ from sympy import Symbol, Function, Number from modulus.eq.pde import PDE from modulus.node import Node from typing import Optional, Callable, List, Dict, Union, Tuple from modulus.key import Key class NavierStokes_CoordTr...
c4d392243b90e9d678504e08751c83faaf430c99a8df6c640182fdc7260811ba
Python
11,278
325
# A collection of tools to remotely access a CATMAID server via its API # # Copyright (C) 2017 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of ...
8647bd7cb7fe098696634f4875f04de301f9c792107add4a3b65b0d87cf3416a
Python
11,283
221
"""Validate a pipeline run before starting expensive image processing.""" import hashlib from importlib import metadata import json import os from pathlib import Path import shutil from preprocessing.inputs import fingerprint, validate_diffusion_inputs, validate_mask from utils.files import sha256_file ROOT = Path(_...
5d8c052643bb71c978f4b3a1a2d4efe4918b233531508b2f0434b7e512ee9a6f
Python
11,294
313
""" :AUTHOR: Jonas Scherer :ORGANIZATION: Department of Neurobiology and Department of Cognitive Neuroscience, Bielefeld University, Germany :CONTACT: jonas.scherer@uni-bielefeld.de :SINCE: Mon Dec 12 11:08:00 2022 :VERSION: 0.1 This module contains helper functions. """ import numpy as np import pandas as pd import ...
dc0cc33e5615158bea326278746a4c49197af0fcd5b5c95165fbc7bd814078b6
Python
11,313
288
import math from typing import Callable import numpy as np import torch import torch.nn as nn ############################################################################### # Adapted from diffusion transformer: https://github.com/facebookresearch/DiT # ##############################################################...
5a2ad5713cdc7db3414735127a846732a3014b7caa31240cb6685aa5acb46f8a
Python
11,322
269
from typing import Optional, Any import torch from torch import Tensor from torch.nn.parameter import Parameter, UninitializedParameter, UninitializedBuffer from torch.nn import functional as F from torch.nn import init from torch.nn.modules._functions import SyncBatchNorm as sync_batch_norm from torch.nn.modules.laz...
160d99a5384258c8ff26de4e5fab9a6f0085924a155024a4709421f86123f12c
Python
11,329
301
""" Create Hypergraph (H: incidence matrix) GeneHypergraph: return Hypergraph SmileHypergraph: return Hypergraph, subgraph per smile """ import numpy as np import pandas as pd import networkx as nx import pathlib import pickle import re from rdkit import Chem as rdkChem import sklearn.feature_extraction as skfet imp...
7a0c2efd54b33b713154d9801a0d5ba35dcf6b17a201cc8753f9a86f647e356c
Python
11,335
252
"""Tests for motornet.skeleton — PointMass and TwoDofArm.""" import numpy as np import pytest import torch from motornet.skeleton import PointMass, TwoDofArm from motornet.effector import ReluPointMass24, RigidTendonArm26 from motornet.muscle import RigidTendonHillMuscleThelen # ====================================...
b9bb0257b6be5700fa2d3421ee7c540504220a330902656186004775d8c36fe1
Python
11,335
253
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 cgt_preprocess_func __all__ = ['cgt_cm'] class CgtCm(TaskModel): def __init__(self, **kwargs): super().__i...
99085070bc0c997b1d71afb5928c9369d60ca5b9b8112acade5030036717a816
Python
11,339
309
# Calibration methods including Histogram Binning and Temperature Scaling import numpy as np from scipy.optimize import minimize from sklearn.metrics import log_loss import pandas as pd import time from sklearn.metrics import log_loss, brier_score_loss from keras.losses import categorical_crossentropy from os.path im...
7b96b7cb204ea470cb74c63432b4bd00c9db5ca2834089e3a527233e798b75ab
Python
11,347
311
import shap import argparse import os import shutil import numpy as np import matplotlib.pyplot as plt import torch from torch.utils.data import DataLoader import torch.nn.functional as F from matplotlib.colors import LinearSegmentedColormap import alg from alg import alg, modelopera from utils.util import set_random...
d421f31cca676fbfa4342c97fc6bb012480851b4d5910cdb5e40b0f81edcd4e4
Python
11,350
307
import os import sys import time import warnings import zipfile from urllib.request import urlretrieve import cv2 import numpy as np from torch.utils.data import Dataset from bindsnet.datasets.preprocess import ( BoundingBox, Rescale, bgr2rgb, crop_sample, cropPadImage, ) warnings.filterwarnings(...
87c1c3ae13a04ed84f1eaeeb04ffd49eeda4fb94487001f2f73660d3d689308c
Python
11,351
277
#!/usr/local/bin/env python """ Test iodrivers.py facility. """ # ============================================================================================= # GLOBAL IMPORTS # ============================================================================================= import numpy as np try: from openmm imp...
c86de8831e4d3d2f57bf9fac332b8f890abea3a939e905bb9fe04a779aebf1ba
Python
11,354
296
import matplotlib.pyplot as plt import numpy as np import skvideo.io import mediapipe as mp import os from tqdm import tqdm import pkg_resources from mediapipe.framework.formats import landmark_pb2 from mediapipe import solutions from PoET.mediapipe_landmarks import prepare_empty_dataframe def load_models(min...
72f48031ccff0df76c81b0462436b5bc44290a2faae10f60c740d94ef1fa908a
Python
11,358
300
import logging import time import dask.distributed as distributed # Instantiate logger logging.basicConfig(level = logging.NOTSET) _logger = logging.getLogger("parallelism") _logger.setLevel(logging.INFO) class Parallelism(object): """ This class maintains a running parallelism (with support for the paralleli...
196b0dccc11b83324e474ffb479bbf9ca498d73564a9b394e3d097d3e62dd571
Python
11,359
413
# -*- coding: utf-8 -*- """ Created on Mon May 24 15:13:58 2021 @author: xiao208 """ # -*- coding: utf-8 -*- """ Created on Mon Nov 11 10:54:28 2019 @author: dalan list of unit and default parameters: time: ms voltage: mV current: uA/cm^2 capacitance: uf/cm^2 conducrance: mS/cm^2 Cm = 1 uF...
35f7b1541a58a004900592cc3caa17eb7425ff3435a158d9b098d0601e9e6110
Python
11,367
315
"""Chain that interprets a prompt and executes python code to do math.""" from __future__ import annotations import math import re import warnings from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainR...
2733bbd7cafba40f0450d7fe0d86a4baeed5ad49303e65773e0baf29fa23d706
Python
11,369
274
import math from e3nn import o3 from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from torch import Tensor from torch_sparse import SparseTensor import torch.nn as nn from torch_geometric.nn.conv import MessagePassing from torch_geometric.typing import Adj, OptTensor, PairTensor f...
7b6845ba31dac2cac43e08459367cb58d504bd4ae2368fd4a4730c880393ecd0
Python
11,371
230
#! /bin/env python # # Michael Gibson 17 July 2015 # Modified Adrian Foy February 2021 # Modified jz103 Dec 20 2021 # Modified jz103 Feb 10 2022 import sys, struct, math, os, time import numpy as np from .intanutil.read_header import read_header from .intanutil.get_bytes_per_data_block import get_bytes_per_data_block...
6a4701e76da2f2882930fecf27f0144245cd4c490304db34ace222ab20eb0395
Python
11,374
244
"""entry point for the standalone exe. runs the same FastAPI app as a local server and opens it in a native window with pywebview. this file (plus a pyinstaller spec) is basically the entire desktop-specific part of this project - everything else is shared with the web version. """ import json import os import platfo...
052d970762cebcc2a9c7beab358bfb3aeac9d3f681896c2912bb137b57b97f42
Python
11,379
239
""" Plot the individual sequences (outcomes, estimates, and generative value) for each session of the given subject data file. """ import argparse import data_analysis_utils as dana import matplotlib.pyplot as plt import numpy as np import os.path as op import plot_utils as plut FIGSIZE = (plut.A4_PAPER_CONTENT_WIDTH...
d178c731cdf0444f9d596a4754bbd66aa980fc991d5b297436ab8e448d61aae8
Python
11,387
233
""" Functions to generate plots to analyse the imaging of command neurons in intact and headless flies. Author: jonas.braun@epfl.ch """ 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...
132d0260f9189396779113a9ec7ac6abfa1b438b576f73fb5c6b238824d42031
Python
11,388
249
""" This module implements `tensorflow.keras.callbacks.Callback` subclasses. For more information from the tensorflow package on what callbacks are and what they can achieve, feel free to refer to the tensorflow documentation on callbacks at: https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/Callback. """ ...
2bc368b3fc80721ab95dd6a3625283bf7a098a3786a2304feaa5a0ae7100ed00
Python
11,388
333
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 Interva...
94274fdab3f5a3ec172e78d184813c70cfc0c00458d36cd3ab66770fe215bb29
Python
11,389
234
""" return processed data 1. drugcomb summary data 2. drugcomb drug data 3. drugcomb cell data 4. drug target data """ import argparse import pathlib import numpy as np import pandas as pd import pickle import scipy.stats as scistat import sklearn.preprocessing as skpre import sklearn.feature_extraction as skfet imp...
336cdb6f3543b76591542995992d3252b5af29d39b0c92c5768f673d1eee88f4
Python
11,392
262
import math import matplotlib.pyplot as plt from matplotlib import gridspec from torch.utils.tensorboard import SummaryWriter import torch from data import generate_recog_data from net_utils import load_from_file from plotting import maxval, maxabs, plot_W, plot_B, ticks_off, plot_train_perf, plot_recog_gene...
fbb8a30c18153f196a81d61cf01f5dd86ad104e67a1f013861c941f1c33fd86c
Python
11,396
321
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Callable import torch from torch import nn from torch.nn import functional as F from .activations import ACTIVATION_REGISTRY # from .fourier import SpectralConv2d #############################################################...
3735317f2c2f6377a8a5b43f408bca3214a6cbea388ff04028775fc82481c4ed
Python
11,400
255
""" In this file the functions to evaluate the state, reward are defined and also the action is implemented """ import numpy as np 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 contain...
e740e23808c8c25586e9744258635ad2e2233d7a693d679c00a71f0dc6965bb8
Python
11,407
265
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 B...
295be44a595f339371cea8022d2d0fdefcc4430ba50830d5ffe95b8067d656d1
Python
11,411
352
"""Ensemble Retriever. Ensemble retriever that ensemble the results of multiple retrievers by using weighted Reciprocal Rank Fusion. """ import asyncio from collections import defaultdict from collections.abc import Callable, Hashable, Iterable, Iterator from itertools import chain from typing import ( Any, ...
b100cde624f1f8cc74e6d311dcd165aee718f96b8ebd7ef05bc90748b56611c5
Python
11,415
273
import copy import logging import os import socket import sys import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from configs.configs import get_config_dict from helpers.hcp import get_human_connectome_project_subjects, rename_variables_for_plots from helpers.figures import g...
c834af6916d8525bf22b8d455e7f179af0ab4bd944822fd8d2b17a828688be43
Python
11,417
237
from copy import copy import numpy as np import pandas as pd from statsmodels.stats.multitest import multipletests def ttest(self, params): """Perform a T-test on the data Args: params (list): list containing control and experimental groups, normalized dataframe and if the variables are dep...
5bbcc59c7bcafd953c3be918abffdd04f7da30ab40fd1bad4f80dbd59decba42
Python
11,420
338
""" A vanilla 3D resnet implementation. Based on Raghavendra Kotikalapudi's 2D implementation keras-resnet (See https://github.com/raghakot/keras-resnet.) """ from __future__ import absolute_import, division, print_function, unicode_literals import six from math import ceil from keras.models import Model from keras.l...
aa0fa3867b6a3816fda2bc61784b2b476b29603b7b27aa0e59cc6bc54a6d267c
Python
11,422
315
"""Methods to evaluate peptide-spectrum predictions.""" import re from typing import Dict, Iterable, List, Tuple import numpy as np from spectrum_utils.utils import mass_diff def aa_match_prefix( peptide1: List[str], peptide2: List[str], aa_dict: Dict[str, float], cum_mass_threshold: float = 0.5, ...
d12b54799271cace96dd6ac6f9e35fab70cba1ff66b3235f23ea8d3392fd1d37
Python
11,423
279
# Copyright 2022 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, s...
12a3b51294e770d77f35bc63f340579bbb5ea68f8753328036add3e82e012fd3
Python
11,432
362
import seaborn as sns from SMdRQA.RQA_functions import entropy from SMdRQA.RQA_functions import average from SMdRQA.RQA_functions import maxi from SMdRQA.RQA_functions import mode from SMdRQA.RQA_functions import percentmorethan from SMdRQA.RQA_functions import diaghist from SMdRQA.RQA_functions import onedhist from SM...
75ea46673cc9011453861d99669816292500c27534f272b66479d1c3911002c9
Python
11,432
307
import cv2 import torch from skimage import measure import numpy as np from scipy.ndimage import binary_fill_holes from utils.geometry import close_contour, find_recist_in_contour, recist2det from visualizer.visualizers import vis_img, plt_show from .bbox_operator import BBoxes from functools import reduce def read_m...
2bd3cb0df4886aabccc89f4b1f96d9b73e1da6e0f01934d6b50b71992637c139
Python
11,439
347
import argparse import os from time import time as t import matplotlib.pyplot as plt import numpy as np import torch from torchvision import transforms from tqdm import tqdm from bindsnet.analysis.plotting import ( plot_assignments, plot_input, plot_performance, plot_spikes, plot_voltages, plo...
0e8cf07eb1a37a1ad7d8139597e2ced1bd4dd1266a8e04a40f285dbccdb75695
Python
11,440
263
""" This module contains the model class for DBMs. :Implemented: - DBM model :Version: 1.0.0 :Date: 26.05.2019 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2019 Jan Melchior This file is part of the Pyt...
572807a9e5ce441f5105bff3d833b3dc152dfd6cb675ab445dbe7dbcb50b540c
Python
11,441
380
""" gtfsubset.py - Tasks for GTF subsetting =============================================== Reference --------- """ import os import pysam import cgatcore.experiment as E import cgatcore.iotools as iotools import cgat.GTF as GTF import cgatcore.pipeline as P import cgatcore.database as Database class SubsetGTF(): ...
6efb713198a4ebed6c315baee480f0832913897f5b238e881978d1f393f237e0
Python
11,441
279
from collections import deque from collections.abc import Hashable import networkx as nx import pandas as pd from sklearn.base import clone from tqdm.auto import trange from pgmpy import config from pgmpy.base import DAG from pgmpy.causal_discovery import ExpertKnowledge from pgmpy.causal_discovery._base import BaseC...
dbbbf0c99988c95c737d1ba80c8467dc215503c366c74714865cbe8543a51275
Python
11,444
308
# Copyright (c) 2019 Mwiza Kunda # Copyright (C) 2017 Sarah Parisot <s.parisot@imperial.ac.uk>, Sofia Ira Ktena <ira.ktena@imperial.ac.uk> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, eithe...
38c3d03cf9d81c286549a956a28574937ac5d75901d8a45af1d8c781649644fd
Python
11,446
255
""" In this file the functions to evaluate the state, reward are defined and also the action is implemented """ import numpy as np from Environments.DSSdirect_34bus_loadandswitching.DSS_Initialize import* # To get the details of switches and their status def switchInfo(DSSCktobj): #Input: DSS Circuit Object ...
4fb5bad72dc63cf429e150a664b18ef8fc0f39ac3720c86d10d8245f465612aa
Python
11,448
292
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 from pensa.features import * def residue_visualization(names, data, ref_filename, pdf...
b35bdf6d2e3f0452ed436ef8468f3c6d965e1e6865806d742706213cbf082fbc
Python
11,448
189
import pandas as pd import numpy as np import re import argparse def data_filter(rawdata_path,embedding_data_path,reference_path,sample_id_path,save_path,cancer): # RNA print('RNA') data_mRNA=pd.read_csv(rawdata_path+cancer+'.mRNA.csv',sep=',') sample_mRNA_data=pd.read_csv(sample_id_path+'/sample_mRNA...
bb1b7c8d7f011ab7ec6dc5bec05aa8baff7ecc31cadd13797dc37cda54825f16
Python
11,461
292
# Extension of MXNet Module import logging import mxnet as mx import numpy as np import mxnet.ndarray as nd from collections import OrderedDict from mxnet.module import Module def nd_global_norm(t_list): """Computes the global norm of multiple tensors. Given a tuple or list of tensors t_list, this operation ...