sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6f2a78d3d60dd3ccf42e0174335c225e17023d57d778537fc8237fe2a173fcf3
Python
11,477
266
# -*- coding: utf-8 -*- """ ################################################ MIT License Copyright (c) 2021 L. C. Lee 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, inc...
19ab6a0b7f66e974e7d31ca53ef4ba18543d733aff9bae6c1a4a128e7d8a49ea
Python
11,480
252
""" 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 wh...
30185be20f114583b670f6682b9463b2a2cbfbd9021de396ca031a54423c9f3e
Python
11,480
383
#!/usr/bin/env python3 """ Analyse mutual volume overlap of lesion labels with probabilistic atlas labels - Outputs relative and absolute volume overlaps - Overlap volumes relative to both lesion and atlas labels Usage ---- atlas_lesion_analysis.py -l <3D lesion label image> -a <4D prob atlas image> [-lk <...
29798c689b07ee79dd535f038e87e0119149ad04b4707579a1937b9804f08886
Python
11,485
317
# This file uses sklearn library to setup ML model comparison experiment with cross validation # It will write out files to an 'out' directory that it will try to create import time import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import PolynomialFeatures, F...
f77065fb06778cb2e14640001b70d8569aabcd092d54f2c540560d15031fc703
Python
11,485
293
import numpy as np import MDAnalysis as mda import matplotlib.pyplot as plt def residue_visualization(names, data, ref_filename, pdf_filename, pdb_filename, selection='max', y_label='max. JS dist. of BB torsions', offset=0): """ Visualizes features per resid...
03b2033d683cca99e1b3c6efa5c2659177d3628f9add7ec11d62e94f188ee2f6
Python
11,489
329
"""Contains tests for the Dense-layer LRP implementations""" import numpy as np import tensorflow as tf from tensorflow.keras.initializers import Constant from tensorflow.keras import Model from tensorflow.keras.layers import Dense, Input, LayerNormalization from explainability.layers import DenseLRP from explainabi...
54865b9e8f13e24f252f6a06b279ddd0bd9e26ca9fd4e6d064ce9744ea84f048
Python
11,494
324
# Copyright 2022 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...
c81d7939f2c7016e4747394abfa5e4074f999ae982df40871a31f909753a6a2b
Python
11,494
243
import os from time import time from copy import deepcopy import gc import json import re import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from utils.read_mda import readmda plt.rcParams["font.weight"] = "bold" plt.rcParams["axes.labelwei...
9eee5fd962d5d9fc725c025c30475b855508be29e112d662b668054aee543262
Python
11,498
303
import sys sys.path.append(".") import pickle as pk import gzip import tarfile from collections import Counter from pymatgen.symmetry.groups import SpaceGroup from pymatgen.core.lattice import Lattice from pymatgen.core.structure import Structure from pymatgen.analysis.structure_matcher import StructureMatcher import n...
4aa28de81446a4e3367d08bfd348b5ed6e65ec4823ae525bcbb46d2b06850691
Python
11,499
287
import numpy as np import networkx as nx from tqdm import tqdm from copy import deepcopy from scipy.sparse.linalg import eigsh import matplotlib.pyplot as plt from numpy.random import randn import os import random import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import ReLU from torch_sc...
e971abbb8f3313e9f6d6baa911095037766be56591f7c9c87c8512979ae4c35f
Python
11,500
302
# Copyright (c) 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, so...
2e20bf7c4d729290ba70194e714a7107b40f5820f05240a19f6d03f11c2247e2
Python
11,511
304
import logging import time # Instantiate logger _logger = logging.getLogger("parallelism") _logger.setLevel(logging.INFO) class Parallelism(object): """ This class maintains a running parallelism (with support for the parallelism libraries and schedulers specified in `supported libraries`). The class...
46a1b5f329cb79d71acb19dbc74926438212a562ebe366fcbe724f39a5c2b093
Python
11,521
315
# 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 ast import collections import logging import os import re import shutil import traceback from typing imp...
4c5051107fe4c2efe92cf11eaa8d4c19d1f6eb3e941e04aa3b2019fd34887806
Python
11,521
302
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.animation as animation import matplotlib.transforms as transforms import numpy as np from tensorflow.keras.preprocessing import image from PIL import Image import zipfile, os # Reconstructs an image given the tracks of female...
fc104d02ff7b1ed251382d84e0b9f11ba9b82418768b457033f418aa361da689
Python
11,522
275
import math import torch from torch.optim.optimizer import Optimizer version_higher = torch.__version__ >= "1.5.0" class AdaBelief(Optimizer): r"""Implements AdaBelief algorithm. Modified from Adam in PyTorch Arguments: params (iterable): iterable of parameters to optimize or dicts defining ...
d3f496ec793b6c2bd82649a98f47f3ee2bb10234d1471e5ce532f67d23253a19
Python
11,526
280
import numpy as numx import pydeep.base.numpyextension as numxExt from pydeep.base.activationfunction import Sigmoid import pydeep.base.costfunction as Cost import pydeep.misc.measuring as MEASURE import pydeep.misc.visualization as VIS import pydeep.misc.io as IO class SoftMax(object): ''' Soft Max function. ...
98f86340043e42a0efd7fd9993d3d2b23de13a5cfbe89e59da2d9901f1742b05
Python
11,527
252
""" 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_123bus_loadandswitching.DSS_Initialize import* # To get the details of switches and their status def switchInfo(DSSCktobj): #Input: DSS Circuit ...
9e2fb96e9462b6fd90a80f8c997b459ad77a5412448a3185a684821f52bc6b1c
Python
11,531
295
import albumentations as A from albumentations.pytorch import ToTensorV2 from joblib import Parallel, delayed from torch.utils.data import DataLoader from CNN2D import CNN2D import os import torch from torch import nn import numpy as np from skimage.io import imread, imsave from CustomDataset import CustomDataset fro...
ce885978652bb535177ef77397c289f2f2d529e12243ea2a9970845eb3ad928e
Python
11,533
320
import sys import torch import torch.nn as nn from typing import Optional, Tuple from copy import deepcopy from h3xsemble.model.primitives import Linear, ipa_point_weights_init_ from h3xsemble.utils import residue_constants as rc from h3xsemble.utils.residue_constants import ( restype_rigid_group_default_frame, ...
80441181c2c4a72cba0acb914ef7a5ef3c1825ac0ec61523dbd14a828e5b4053
Python
11,536
278
# -*- coding: utf-8 -*- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~IMPORTS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Standard library imports from collections import OrderedDict, namedtuple, Counter import gzip # Third party imports from tqdm import tqdm import numpy as np # Local imports from pycoMeth.common import * from py...
7aaad3bd261440691709ee67252a159af85f31b1bc72931fa7859eb3a2efae94
Python
11,537
380
# Copyright 2023 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 ...
865a321aa0d842319d73f18d3e3736eaeaf6de2411788bb513ab8d247ddef65c
Python
11,537
370
# 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. """ Wrapper around various loggers and progress bars (e.g., tqdm). """ import atexit import json import loggin...
2292f4fd32df58dcf5e494e2602c16b0d991aa84f9130e9c9c027743122aa3c1
Python
11,542
291
"""Chain that combines documents by stuffing into context.""" 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.language_models import LanguageModelLike from langchain_core.output_parsers i...
cc4d1a907e0c9f2c0a97c3b9b8379d46756ace7d1fd71de43b4504a4942e7be3
Python
11,548
408
#!/usr/bin/env python3 ''' Interpolate label between sparse sections - Speeds up manual labeling for larger label volumes Usage ---- interp_labels.py <label image> <index list> interp_labels.py -h Example ---- >>> interp_labels.py -i labels.nii.gz -l 1,3,4 Authors ---- Mike Tyszka, Caltech Brain Imaging Center Date...
f88ae69b838b338630231666e0e25bfefeba826a10a2f0a985136b51d6052dfa
Python
11,548
276
from __future__ import print_function import tensorflow as tf from .nn import linearND, linear from .models import * from .ioutils_direct import * import math, sys, random from collections import Counter from optparse import OptionParser from functools import partial import threading from multiprocessing import Queue i...
f51b385fabe49d9ad9b4fa8103b037a66dd7b954e3513d5727f13bc41e7c7251
Python
11,555
342
######################################################################## # 1D diffusion in a finite tube with fully-reflective boundary. # Circular "point source" from one face. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetexact' in the context of the Bounded Diffus...
323c9cb82bfe04e5143a9772438c8bbae484b9390db6cdaee26586c1bcca9685
Python
11,556
295
from tqdm import trange import torch import numpy as np import pandas as pd import torch.nn as nn import os import copy from sklearn.metrics import ( mean_absolute_error, mean_squared_error, r2_score, roc_auc_score, accuracy_score, log_loss, f1_score, matthews_corrcoef, precision_sc...
d03104ad58336b0207e544277745e07b94012f16ea252e32de54e113deb4e091
Python
11,564
222
# Sconda conda activate plot_gc; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/results/cpg_composition_differences; python import pybedtools import pyfaidx import matplotlib.pyplot as plt import pandas as pd import os # Function to TPM normalize the gene counts def tpm_normalize(d...
64ec960b8683e7989a247f881aff3ced51335f95bc4cd252b415546177660060
Python
11,565
320
import itertools from typing import Callable, Dict, Optional, Tuple import torch from tqdm import tqdm from bindsnet.analysis.pipeline_analysis import MatplotlibAnalyzer from bindsnet.environment import Environment from bindsnet.network import Network from bindsnet.network.monitors import Monitor from bindsnet.networ...
0e49dbd91c20cc40a529ebaf3e5f0b8d4a57db33fa3029456a6da332ad8fa2c7
Python
11,574
282
import sys import os import matplotlib.pyplot as plt from matplotlib.lines import Line2D import itertools sys.path.insert(1, os.path.join(sys.path[0], '../../../')) from Simulator.SimulatorDMS import simulatorPatternDMS from Articles.DMS_DLS.Code.FiguresDMS import * Apostpre_list = np.array([-1., 0.0, 1.]) def f_S...
72c372370e54b650c3170e93a295ff3de0a9485f38e4baaa970299b475eca9cd
Python
11,574
338
import yaml import numpy as np import mne import textgrid from pathlib import Path from scipy.io import wavfile class SpeechWaveExtractor: """ Class to load audio data from a wav and TextGrid. My wavs are stereo wav files, with the first channel containing the speech and the second channel containing an ...
3cc23c177b045a7311459ed761b99cfd5708ba6a993cd81495961cb179b287c0
Python
11,588
289
""" Authors: Samir Akre, Archana Raja Purpose: The goal of this script is to aggregate QC metrics for the motrpac RRBS initial processing pipeline. Read the usage() function for details on usage. Output: writes csv file: '${SID}_qcmetrics.csv' where ${SID} is based on the sample ID sent as input wit...
1400222be2d0dbce8c63175479cd733a5a06dbe2730aa5b096dd045570c330eb
Python
11,590
320
import numpy as np import matplotlib.pylab as plt from matplotlib.patches import Rectangle import seaborn as sns from pandas import DataFrame import PIL from io import BytesIO from MuTILs_Panoptic.configs.panoptic_model_configs import ( RegionCellCombination as rcc, VisConfigs ) def get_visualization_ready_combi...
a39a70941a0adc12227ad58d3ee1b45e097bfc2f05027e1ab49f335ee6401cad
Python
11,590
289
# 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 ...
f2d7cd448ac9f207c36293f69691f72f15c86414fa1185f239db81926a3b2058
Python
11,590
315
import json from os.path import join import os from random import sample import torch import h5py from tqdm import tqdm import numpy as np def get_seq_mapping(): """convert mutation type to integer (index)""" #TODO add support for indel and make it more convenient to modify this function mut_mapping = {'C...
339a2a4a7b21014699e5d883a286612846e2a9ee9abdd0fa6353f205c8e4a85f
Python
11,596
282
import logging import os import socket import sys import numpy as np import pandas as pd from sklearn.metrics import explained_variance_score from sklearn.linear_model import Ridge from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_score, KFold from configs.configs import get_config_dict fr...
2f78c91918346e4ced5022759920fb3f2ca88092d322b8ff8593dd0cafb62fa0
Python
11,597
357
""" This script parses a number of files from Reactome to match pathways to their corresponding titles and genes """ import argparse from dataclasses import dataclass, field from typing import List, Dict, Tuple, Set import pandas as pd import numpy as np from utils import get_ensembl_mappings # Top level pathways f...
8f2472ffab4d5c28d535f86bb20864b35275614461497d92c0439e6bb4e53ca3
Python
11,597
271
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...
ff7207dc97ae256bc50ae39b56d84af2cfac8ffe9442b7da55efc4cdd835c314
Python
11,603
359
########################### # Latent ODEs for Irregularly-Sampled Time Series # Authors: Yulia Rubanova and Ricky Chen ########################### import os import matplotlib if os.path.exists("/Users/yulia"): matplotlib.use('TkAgg') else: matplotlib.use('Agg') import matplotlib.pyplot import matplotlib.pyplot as pl...
96d7320523baca53788af916a92a56fb16f510395b57f6ad772da02975b69611
Python
11,617
267
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...
dad09b33cceb3508449613dda67b1a1c0375690145d12fdbb510d0088c70e862
Python
11,617
367
"""Unit tests for agents.""" from typing import Any from langchain_core.agents import AgentAction, AgentStep from langchain_core.callbacks.manager import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.messages import AIMessage, HumanMessage from langchain_core.runnabl...
20923d6d226d88dfb525245e2794437f2806fa6dfde942c64ec539c69bef858b
Python
11,621
343
import re from collections.abc import Sequence from typing import ( TYPE_CHECKING, Any, Literal, TypedDict, TypeVar, ) if TYPE_CHECKING: from langchain_core.messages import BaseMessage from langchain_core.messages.content import ( ContentBlock, ) def _filter_invocation_params_for_tracing(...
de007675d6fb983e9c24bc61ab966798ef7fc3611bc3d7bf602e00399343bb0c
Python
11,626
343
######################################################################## # 1D diffusion in a finite tube with fully-reflective boundary. # Circular "point source" from one face. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetexact' in the context of the Bounded Diffus...
142453cd029d15fe91f5ea506afa67b7ea705f80e54018ee4d102440a401fb2c
Python
11,628
414
# -*- 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/cm^2 Vna = 115mV Vk = -12mV Vl = 10.6mV gna_bar = 120mS/cm^2 gk_bar...
72b9d75c97cdb4e59d6574d59baf9ed817fa6d2fb45a82bf13e1e555e985760e
Python
11,633
325
#!/usr/bin/env python """ NBtrain.py - Model generator for langid.py 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 or without modification, are permitted p...
9afe24ac4880a0a72da3f0eb940c36b2d275900aaa5c3073ab9fabff725c7b98
Python
11,634
288
import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import os, sys import pandas as pd import numpy as np import pickle from palettable.colorbrewer.sequential import Greens_9 from palettable.colorbrewer.qualitative import Paired_12 from matplotlib.patches import Patch from scipy.stats.stat...
932303008784b26218b2ad91fa6a6c4fcc7b142bec7a2d8b83b0dcd60da8e50b
Python
11,638
361
"""Base parser for language model outputs.""" from __future__ import annotations import builtins import contextlib from abc import ABC, abstractmethod from typing import ( TYPE_CHECKING, Any, Generic, TypeVar, cast, ) from typing_extensions import override from langchain_core._api import depreca...
d95443f21abc866f02014b55e2ce6739d8af8d4e94a875688cc9087e7d48eacd
Python
11,638
161
"""Results figures. Reads the 5-seed final files by default; pass --v0 for the preliminary files. fig04_inflation : MAPE by protocol x model (log y), mean +- 95% CI over seeds/folds fig05_p4_heatmap : P4 MAPE per held-out dataset x model fig07_coverage : PICP (target 0.9) and MPIW per conformal method, P3 v...
9034eba0b368c7d6bb2108a6615d47553536fd4e7cabc3cdc797fe7bc8c09073
Python
11,655
253
import numpy as np import argparse import os import imp import re from mimic3models.length_of_stay import utils from mimic3benchmark.readers import LengthOfStayReader from mimic3models.preprocessing import Discretizer, Normalizer from mimic3models import metrics from mimic3models import keras_utils from mimic3models ...
4ad5f94f9f1be79857f00433fd224c9793eca0d8c3593f80ce6c6cb1be407e41
Python
11,662
231
''' Test module for WE models. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 This program is free software: you can redistribute it and/or modify it under the terms of...
8df5f1c5e4b76001dbb8c8a300de85ada88d1bfc8681ebb56dc690e265c4c594
Python
11,667
353
""" Approach: "StyleMC: Multi-Channel Based Fast Text-Guided Image Generation and Manipulation" Reimplemented and modified by Axel Sauer for "StyleGAN-XL: Scaling StyleGAN to Large Diverse Datasets" """ import os import re import click import legacy from typing import List, Optional import PIL.Image import imageio from...
df8eb377fb71f6796b6ab39ce0667ba7f90eb9c2fb0be61485b43850d918f5b3
Python
11,675
327
"""Model retry middleware for agents.""" from __future__ import annotations import asyncio import time from typing import TYPE_CHECKING from langchain_core.messages import AIMessage from langgraph.errors import GraphBubbleUp from langchain.agents.middleware._retry import ( OnFailure, RetryOn, calculate_...
6ba85208d170078034fdf567cf4f7db265fdddf7b046d2bb39ac4b3f189a93df
Python
11,682
278
# the test scripts currently run over the molecule one by one # causing the evaluation needs a long time #!/usr/bin/env python3 import os import time import torch import hydra import pyscf import logging import numpy as np from tqdm import tqdm from models import QHNet from torch_scatter import scatter_sum from datase...
460e47dbe073db8c640fe1306323a2e130ae82f0bc823ee2439b4fcdf0a66530
Python
11,684
236
import sys sys.path.append('..') from src.utils import set_random_seed import argparse import torch from torch import nn from torch.utils.data import DataLoader import transformers from torch.nn import MSELoss, BCEWithLogitsLoss, SmoothL1Loss import numpy as np import random from src.data.featurizer import Vocab, N_AT...
e1a99b2d022cb14922ff1bbc0fdbfc0564f35c6bbeae05d1d17f688dd39667be
Python
11,689
255
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 pstRT_preprocess_func __all__ = ['pstRT_rlddm1'] class PstrtRlddm1(TaskModel): def __init__(self, **kwargs): ...
d459cb4e06557c19f2e89b84f3c4c04575b022c32491e9b003d82a2b957d3217
Python
11,696
341
import numpy as np import scipy as sp import scipy.stats import mdshare import pyemma from pyemma.util.contexts import settings import MDAnalysis as mda import matplotlib.pyplot as plt # --- METHODS FOR CLUSTERING --- def obtain_clusters(data, algorithm='kmeans', num_clusters=2, min_di...
7019a1675509e05a5f7f0933e85f5446e9b7191209f8a8272e907374b53976df
Python
11,699
353
#!/usr/bin/env python3 import os import sys from os.path import dirname import re import math import argparse import subprocess as sp from io import StringIO from snakemake import io from snakemake.io import Wildcards from snakemake.utils import SequenceFormatter from snakemake.utils import AlwaysQuotedFormatter from ...
6885eec50990ce1bad12062313d0025ec6699dfe496234d897e8dd7f55a15d98
Python
11,702
303
"""Derivations of standard content blocks from LangChain v0 multimodal content.""" from typing import Any, cast from langchain_core.messages import content as types def _convert_v0_multimodal_input_to_v1( content: list[types.ContentBlock], ) -> list[types.ContentBlock]: """Convert v0 multimodal blocks to v1...
fa8cdeb80d9f6e22c581a68d01828c36bb74c8b29498b7c72fe3ae8e0983383f
Python
11,703
264
# 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" #...
20a8016f9690cdd36a3fe8afde071314f43b9061947f41ecb2bbdba5d08cf2f8
Python
11,704
294
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """SDC workflows coordination.""" from nipype.pipeline import engine as pe from nipype.interfaces import utility as niu from nipype import logging from niworkflows.engine.workflows import LiterateWorkflow ...
231cef670f58a999d5c3424f69893c38d9ebb2b8071c27fd1a739e17fff90053
Python
11,704
291
import numpy as np import re from pandas import DataFrame, Series from mimic3benchmark.util import dataframe_from_csv ############################### # Non-time series preprocessing ############################### g_map = {'F': 1, 'M': 2, 'OTHER': 3, '': 0} def transform_gender(gender_series): global g_map ...
4aaed1f96a888f4b2678c1f21b72be474978cdbe74088e14d83466935d50d304
Python
11,707
294
""" Downloaded from: https://github.com/broadinstitute/gtex-pipeline/blob/master/gene_model/collapse_annotation.py (20.06.2020) Modifications: Maciej Bak """ # Author: Francois Aguet import numpy as np import pandas as pd from collections import defaultdict from bx.intervals.intersection import IntervalTree import arg...
089ba53ba051f9e8fe35eaabfe56647f0c14bed7d8da45eadacf9af08dee02cd
Python
11,710
268
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Description: : @Date : 2022/06/15 13:17:49 @Author : Zilan Yu @version : 1.0 ''' import os, sys os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf import keras_metrics as km import numpy as np import pandas as pd import keras from ke...
a7ecb306d4f080eeef15bda54ccf8f2c07de4e84499093d76585cd20f6dd689d
Python
11,713
307
"""Surface nested named agents as typed `run.subagents` handles. Detects subagents via the `lc_agent_name` transition that langgraph's base `_TasksLifecycleBase` now computes. `create_agent(name=...)` binds `lc_agent_name` into the run config; the base transformer records, per namespace, the `lc_agent_name` seen on ea...
e635567fa482c7a1fdc2f17387dc403dec040172557f0e84379288a71dc33e68
Python
11,714
290
import os import copy import argparse import pandas as pd import torch import torch.nn as nn import torch.utils.tensorboard from torch.utils.data import DataLoader, Dataset from Bio.PDB.PDBParser import PDBParser from Bio.PDB import Selection from Bio.PDB.MMCIFParser import MMCIFParser from Bio.PDB.Polypeptide import i...
1d138b58005b8645caf24879b4175f5ec540573818aba7bb3629cf2eacbef1aa
Python
11,715
281
from matplotlib.backends.backend_pdf import PdfPages import h5py import pandas as pd import matplotlib.pyplot as plt import matplotlib import numpy as np gg = PdfPages('./0_Traces.pdf') #PVALBA nwb_file = '../PvalbA/1_Supplemental/569998751_ephys.nwb' with h5py.File(nwb_file, "r") as f: #Read spike train f...
a299b42fd479116e33c5ca4357859ea933e36f3b14ce345999d179827c44a154
Python
11,715
327
""" ############################################################################## # # Generate table with motifs' scores for the final HTML report. # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREATED: 03-0...
ab699d645f5e14664cebf0800c7e4c9bd40f820be7caed5807f3c8797ebbcb26
Python
11,716
236
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 17 21:22:12 2022 @author: Shencong Ni """ ''' Calculate the phase locking value (PLV) between the MUA in area 1 and area 2. Run the onoff_detection.py first before running this script. ''' import matplotlib as mpl mpl.use('Agg') import scipy.stats...
eb810edb839c8f9a806abfef749129354bb6659f80724cd6b5d294d84484b4cf
Python
11,720
290
import sys import re import pandas as pd from mantis_ml.modules.pre_processing.data_compilation import (process_generic_features, process_features_filtered_by_disease, process_ckd_specific_features, process_cardiov_specific_features) from mantis_ml.config_class impo...
8cc2cf7313e64546224ed2a67745166a6e3d62599182370917df7fac0accdcb0
Python
11,726
290
import os os.nice(19) import numpy as numx import pydeep.rbm.model as MODEL import pydeep.rbm.trainer as TRAINER import pydeep.rbm.estimator as ESTIMATOR import pydeep.misc.visualization as VISUALIZATION import pydeep.misc.io as IO import pydeep.misc.numpyextension as npExt import mkl import scipy.io as sio mkl.set_nu...
bc3cd302b8cb37a00279d17c76d7525cf597e4f5fc16853cb077bb0df3e4b6b1
Python
11,727
338
from itertools import chain import numpy as np import openpyxl import pandas as pd import xlrd import tensorflow as tf from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import Lasso from sklearn.manifold import TSNE from sklearn.multiclass import OneVsRestClassifier all_healt...
74f4ddb94c466673c91267cb8a0ea6789044e674cd08de3669bb37502b200bea
Python
11,729
350
from abc import ABC, abstractmethod from functools import cache from typing import Optional, Union, List, Tuple import re import networkx as nx import pymaid from .utils import _eval_remote_instance from .client import CatmaidInstance from .core import CatmaidNeuron from .config import get_logger from .fetch.annotati...
4f34060266fc5b6f412633d1ed4607f28607b58596410db758dea806d99d226e
Python
11,732
296
import math from functools import partial import torch from torch import nn from e3nn.nn import BatchNorm, Gate, Dropout from e3nn.o3 import Irreps, Linear import numpy as np from nnunet.network_architecture.neural_network import SegmentationNetwork from .voxel_convolution import Convolution from .pooling import Dynami...
6078b0d0421aea5312f7cda0fe341e1b030c168b95f790f0a6188b45daf1d33e
Python
11,735
327
from collections.abc import Callable import numpy as np import pandas as pd from scipy.special import psi from scipy.stats import differential_entropy from skbase.base import BaseObject from skbase.lookup import all_objects from pgmpy.ci_tests import BaseCITest, get_ci_test def _spacing_entropy(values: np.typing.Ar...
cd3ce0d72d3467f904aa0fd177ec80f5720098f2ba75a8e18748db07c6ee9288
Python
11,735
275
import importlib import os import re from abc import ABC, abstractmethod from collections import Counter from typing import Dict, List, Optional, Union, Tuple import torch from tqdm import tqdm from transformers import PreTrainedTokenizer is_selfies_available: bool = False if importlib.util.find_spec("selfies"): ...
f8b0bbbcf2478f49877169fa778ac19af6bb9bce2d46500ddb410dce87ff409b
Python
11,737
296
# -*- coding: utf-8 -*- """ ################################################ MIT License Copyright (c) 2021 L. C. Lee 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, inc...
8b98119f3518d42140c4c22dff0fb0b65907fd9040ad525de7dd020606653e4b
Python
11,741
302
import pytest from openff.toolkit import Molecule from openff.toolkit._tests.utils import requires_openeye from openff.toolkit.utils.toolkits import OpenEyeToolkitWrapper, RDKitToolkitWrapper class TestTautomerEnumeration: tautomer_data = [ {"molecule": "Oc1c(cccc3)c3nc2ccncc12", "tautomers": 2}, ...
42e3fc1b44c18edeae6911f32a7957977ee5f4e04f56c6f89de649ec6fe4b2a2
Python
11,746
301
from tqdm import tqdm import random from rdkit import Chem, RDLogger from rdkit.Chem.rdMolTransforms import GetBondLength, GetAngleDeg, GetDihedralDeg from .mmd import compute_mmd # from mmd import compute_mmd import torch import time import numpy as np import os import pickle # Bond distance def get_bond_symbol(bond...
f2e97e6b1e9fbbc6ca927bbb46962b09902b23f205e449ac5e5cf1d0f561e816
Python
11,750
304
""" extract_traces.py: Extract fluorescent activity traces. Using keypoint coordinates in annotations.h5, both manual annotations and Zephir results, extracts fluorescent activity traces by analyzing pixel intensities. This uses build arguments and container attributes from checkpoint.pt. A modified version of the Zep...
f556398970248de8d4ccba9b89db0499c4bbac4ba372950a6b462800e12b5b1e
Python
11,751
272
import copy from torch.optim import SGD, Adam from model import * import numpy as np from config import Scenario import pickle as pkl import matplotlib.pyplot as plt from scipy.ndimage import gaussian_filter, gaussian_filter1d from scipy.interpolate import interp1d def make_data(cfg: Scenario): n_sa...
e153435965bc359804e771b10426d29a5a446be7b06a424d9319a574761b30d9
Python
11,755
259
# 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...
a66d408fdc44755abd5338c47ad096f7cab837211b4de94fb582eb9f99f98453
Python
11,757
343
import logging import glob import os import sys import gc import pandas as pd import anndata as ad import numpy as np from rich.progress import BarColumn, Progress logger = logging.getLogger(__name__) def create_fractions(no_celltypes): """ Create random fractions :param no_celltypes: number of fractio...
82a376f5fa5a5c5a6c692f0a1aa5477171a8395af485c78b4d3d8ab1057b4de3
Python
11,758
303
# -*- coding: utf-8 -*- # @title Generate parameters related to synapses # @file Synapses.py # @author Romain Beaubois # @date 05 Dec 2022 # @copyright # SPDX-FileCopyrightText: © 2022 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief Generate p...
260dd76211146423bbc15a68076925cdb841153ecb8ce78fd8f822f0259064bb
Python
11,764
298
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...
82d410e8d2767f734993143f0b35312911f9241bd03d52f68e32bc7da7bb7982
Python
11,767
310
# This program is used to calculate the green view index based on the collecte metadata. The # Object based images classification algorithm is used to classify the greenery from the GSV imgs # in this code, the meanshift algorithm implemented by pymeanshift was used to segment image # first, based on the segmented imag...
f4e4af36fe8a8c6e2588ffa760b329a7abeba614450c91a5e9fd8ab369eebbc0
Python
11,770
298
"""tests for results_bundle.py's filename shortening and the two delivery paths (zip bytes vs writing straight to a folder) sharing the same file set. """ import json from pathlib import Path import numpy as np import pytest import trimesh from api.results_bundle import ( build_analysis_bundle, build_meshes_...
ccd5792f67ac54b92e8ddaaa5b947f2fb6805d36ac3c164d6f2231eaf8d81762
Python
11,777
394
'''Code for collecting and preprocessing training data. NOTE as a consequence of how this project evolved, the preprocessing here is decoupled from the preprocessing in the prediction (see retchat.tasks.run_segmentation). In the long term, one might consider harmonizing them. ''' import os import re from glob import...
d2e4090e98e1731f53c0aa40ff6ed70d4f672630b3382101b4e66b83e0295166
Python
11,779
385
######################################################################## # Stochastic degradation-diffusion process. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetexact' in the context of the Degradation-Diffusion model # (see validation/kisilevich.py) ###########...
3eecfb536dda8f91b17711a134fe7506513eda566d873848991e681e796ef0e5
Python
11,781
294
import os os.nice(19) import numpy as numx import model as MODEL import pydeep.rbm.trainer as TRAINER import pydeep.rbm.estimator as ESTIMATOR import pydeep.misc.visualization as VISUALIZATION import pydeep.misc.io as IO import pydeep.misc.numpyextension as npExt import mkl import scipy.io as sio mkl.set_num_threads(4...
d7cdff992c329a36050e5f198d52d53208a07f7a94a0388a08536eb91d6a6efe
Python
11,783
318
"""Mass spectrometry file type input/output operations.""" import collections import csv import logging import operator import os import re from collections.abc import Iterator from pathlib import Path import natsort from .. import __version__ from ..config import Config from .psm import PepSpecMatch logger = loggi...
a3891e00d42748588081ef6107ea281d6bbd2704373dd3ab7fd4c3cd9a89c6f4
Python
11,785
388
from torch import nn from torch.nn.functional import cross_entropy import torch as tr from tqdm import tqdm import pandas as pd import math from sincfold.metrics import contact_f1 from sincfold.utils import mat2bp, postprocessing from sincfold._version import __version__ SINCFOLD_WEIGHTS = f'https://github.com/sinc-l...
28c6a42501b15f60732304995514c6c4771cc2af5d77857c9b9d0f8dad50ab18
Python
11,790
292
from pathlib import Path import pandas as pd import torch import numpy as np import pyBigWig import tabix import os from selene_sdk.targets import Target from tqdm import tqdm import random from src.dataloaders.utils.selene_utils import MemmapGenome from src.tasks.utils import index_mapping class GenomicSignalFeatur...
cb2b9222210b0ab9301e3dab8022785127aba923971a1be9e74ea55ecb780512
Python
11,794
233
import argparse from models import twostage_RCAN3D, twostage_Unet3D from tensorflow.keras import optimizers import glob import numpy as np from utils.utils import prctile_norm from utils.loss import read_mrc import tifffile as tiff import os import tensorflow as tf import math os.environ["TF_ENABLE_AUTO_MIXED_PRECISIO...
616711e565d42c6e394358791ac1db6ab6ff74543c1736ce3c8cac5f62bb5bc0
Python
11,796
385
######################################################################## # Stochastic degradation-diffusion process. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetexact' in the context of the Degradation-Diffusion model # (see validation/kisilevich.py) ###########...
ef6c39c22d05c2c58103f635df0c6381eb2b56e16afd5badc046a2ccac291c1e
Python
11,796
368
"""Chain for question-answering against a vector database.""" from __future__ import annotations import inspect from abc import abstractmethod from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, ...
8dedc6bacf5d4be1628b02b43fdeeda57dfbd250f133b7dddd1cd4ecbe0e8aea
Python
11,804
382
import inspect import warnings from typing import Any import pytest from pydantic import BaseModel from langchain_core._api.beta_decorator import beta, warn_beta @pytest.mark.parametrize( ("kwargs", "expected_message"), [ ( { "name": "OldClass", "obj_type"...
d93ccba93d6dd2e178172305d0307f651d1dd250a1de05060084a4849759b085
Python
11,817
185
import torch import torch.nn as nn import torch.nn.functional as F import torch.multiprocessing as mp import numpy as np from torch_scatter import scatter from tqdm import tqdm from .spherenet_light import SphereNetLightDecoder from .modules import build_mlp import sys sys.path.append("..") from utils import get_pbc_cu...
c9d699a8ee23af41efa0e93b62e9af7087d1d1240f90b8e13813ad204efaa935
Python
11,820
304
""" Perform a multiple linear regression of model variables (cpp, uncertainty) on subject's learning rate. """ import argparse import data_analysis_utils as dana import itertools import matplotlib.pyplot as plt import numpy as np import os.path as op import sklearn.linear_model import pandas as pd import plot_utils as...
591fddc3646822f8c045e71ff930c3f1f080cce63dc7121ae34dc9b6fad9b8b6
Python
11,831
266
# *========================================================================= # * # * Copyright Erasmus MC Rotterdam and contributors # * # * Licensed under the GNU GENERAL PUBLIC LICENSE Version 3; # * you may not use this file except in compliance with the License. # * # * Unless required by applicable law ...
f7bbf723d8f4130d142dbd9246cd2120312c9e014917cc0e4c353baefccd6466
Python
11,831
194
# 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...