sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
562d2f1ab28a5bf53b7e69118554ae5f93e84a0fca24f9c56c8f8e928f91ed09
Python
2,632
75
import unittest from synister.synister_db import SynisterDb from synister.split import find_optimal_split import os class DbSetupTestCase(unittest.TestCase): def setUp(self): self.db_credentials = os.path.join(os.path.abspath(os.path.dirname(__file__)) + "/../../db_credentials.ini") self.db = Synis...
1aecb407b24325e4d8249cf8d05b3c2074ce10a158caf1397d4487de1ceaffc7
Python
2,633
88
from collections import namedtuple from typing import Dict from typing import Tuple import pytest import torch from torch.utils.data import DataLoader from torch.utils.data import Dataset from neurovisfit.common.dimensions import get_dims_for_loader_dict from neurovisfit.common.dimensions import get_io_dims @pytest...
4c4c91205f23bb0fd4efbddbda4385ea69a0cf9ca92a81fc6156e6a6cc905c8c
Python
2,634
70
import argparse import nibabel as nib import numpy as np import scipy.stats as stats import os def main(): # ----------------- # Parse arguments # ----------------- parser = argparse.ArgumentParser( description="", epilog="") parser.add_argument("-v", "--version", ...
c50a4eb991378a5e93eb81c8c5ca26d74bb631b5836d69bb9e70c69c92340648
Python
2,635
87
# Adapted from OpenFold # 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/l...
4a74b3e4a503a73d5b7ee0fc4b162b5e926ee9481ef4979197f96eb816a3e2f2
Python
2,638
92
#!/usr/bin/env python3 """ Create report of average intra and inter-observer atlas label statistics Usage ---- avg_inter_observer.py Authors ---- Wolfgang M. Pauli, Caltech Brain Imaging Center Dates ---- 2017-10-27 WMP Split from atlas.py License ---- This file is part of atlaskit. atlaskit is free software...
93eb5a1400be14d9fbb427891e2463e6f472119fa766215165573e6b51d89765
Python
2,638
68
import unittest import zipfile from pathlib import Path import pytest from MRdataset import import_dataset THIS_DIR = Path(__file__).parent.resolve() class TestMergeDatasets(unittest.TestCase): @classmethod def setUpClass(cls): zip_path = THIS_DIR / 'resources/test_merge_data.zip' if not Path...
926c607abfd9768b05a47424ca473558d3ea7cc1ba5694b45551093a530f7ff8
Python
2,639
61
import torch import numpy as np from typing import List from torch import Tensor def build_edge_idx(num_nodes): # Initialize edge index matrix E = torch.zeros((2, num_nodes * (num_nodes - 1)), dtype=torch.long) # Populate 1st row for node in range(num_nodes): for neighbor in range(num_nodes - ...
f5fe8295a92ac0dfef01f48280859a2ff938bc698f4ef038ca8c045516ca5c18
Python
2,639
81
import numpy as np from matplotlib import pyplot as plt from sklearn.preprocessing import MinMaxScaler from Clust3D.training import train_Clust3D from Clust3D.neuron_init import neurons_initialization def masked_norm(a, b, ord=2): mask = ~np.isnan(a) & ~np.isnan(b) if not np.any(mask): retur...
a850483ccbda64896848903e0e14bbad1336ef578d5b594ac21fd9147640beba
Python
2,640
51
# 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...
1d2c6c2a06752787e2abd6be99b3030921f82af4f940479654c73ed693b0bd9a
Python
2,642
76
import numpy as np import dit def create_distribution(source, target): # creates distribution for discrete measures samples = [] num_sources = len(source[0]) for i in range(len(source)): # for each sample source_str = source[i][0] len_sources = [len(source_str)] for j in range(1...
102adfb5b9924bf18b18c41a7312e5c2af1f0032c2711c6dc2525520f5b2826a
Python
2,646
70
import types, os import torch from torch.utils.data import TensorDataset from net_utils import load_from_file from plotting import get_all_pkl, plot_recog_generalization, plot_recog_positive_rates from data import generate_recog_data #%% #folder = '/Users/danil/My/School/Columbia/Research/ongoing_plasticity/re...
ad174df1e0a42bb20ea37b6ba7fef55ee094e4419bd14e01c7eb6d74ada4f3bc
Python
2,647
70
from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.utils import Params from dliplib.utils.data.datasets import CachedDataset from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset from dliplib.utils.reports import save_results_table from dliplib.utils.weights im...
3bcae058ccc129205d8feaadf70cebde40a01581dd028ec87fdea25d97d7857e
Python
2,649
62
#! /bin/env python # # Michael Gibson 27 April 2015 # Modified Adrian Foy Sep 2018 def data_to_result(header, data, data_present): """Moves the header and data (if present) into a common object.""" result = {} if header['num_amplifier_channels'] > 0 and data_present: result['t_amplifier'] = da...
b760351f59b617d3fdb330c051ff44550a0a420badc0665ff99fa33448b62023
Python
2,649
105
'''Collection of per-caller summary statistics. The data are specific for each caller. ''' import os from cgatReport.Tracker import * from PeakcallingReport import * class FilteringSummary(DefaultTracker, SingleTableTrackerRows): table = 'exported_intervals' fields = ('track', 'method') class MacsSummary(...
4553bcf61574c49ee7f59e46b51cc79916aa838578cbef4e48c803db3813d540
Python
2,650
77
from .BoundingBox import * from .utils import * class BoundingBoxes: def __init__(self): self._boundingBoxes = [] def addBoundingBox(self, bb): self._boundingBoxes.append(bb) def removeBoundingBox(self, _boundingBox): for d in self._boundingBoxes: if BoundingBox.compa...
aea94e1f2fffff6c9cf72f8f76ca6978ebcc7585d31df526b2dadc8e826c527f
Python
2,650
43
from setuptools import setup, find_namespace_packages setup(name='nnsegnext', packages=find_namespace_packages(include=["nnsegnext", "nnsegnext.*"]), install_requires=[ "torch>=1.6.0a", "tqdm", "dicom2nifti", "scikit-image>=0.14", "medpy", ...
787655fdaa1cf079d70f75bd0e9a20be4828ebe309b99d6011191c01fe73228c
Python
2,652
97
"""Message prompt templates.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any from langchain_core.load import Serializable from langchain_core.utils.interactive_env import is_interactive_env if TYPE_CHECKING: from langchain_core.messages import Base...
e249ba389b04dd87b16a93f055db618459add27ff6100391d5f2aec4e87b63ef
Python
2,653
65
import hydra from hydra.core.config_store import ConfigStore from config import Scenario, _DATATYPE, _ALGOTYPE from typing import get_args import numpy as np from utils import varname, update_cfg from omegaconf import OmegaConf,open_dict import random cs = ConfigStore.instance() cs.store(name="scenario_con...
fd18f0ba721335775efe3ebd4522d2f4d8e00a74adc7a9091ef93529e3544491
Python
2,655
76
""" Statistic Module comprises all statistical tests performed by OmicScope for differential expression analysis. Returns: DataFrame: DataFrame with recommended statistical analysis performed """ def perform_static_stat(self): """log2 transformation for expression """ from copy impor...
d7588de5c902b6dd30fd6272be7f371092a5bf022b8817b121ad3115abcab0dd
Python
2,657
79
import torch import torch.nn as nn import torch.nn.functional as F class DihedralFeatures(nn.Module): def __init__(self, node_embed_dim): """ Embed dihedral angle features. """ super(DihedralFeatures, self).__init__() # 3 dihedral angles; sin and cos of each angle node_in = 6 ...
0a63cd3efea06a080afbb5273c335d68dcb4524e8bb7563be93966965cf7871b
Python
2,658
43
''' This datageneratormust be defined before testing the network. Custom Keras datagenerators are elaborately described and illustrated here, https://towardsdatascience.com/implementing-custom-data-generators-in-keras-de56f013581c The generators must return (EEG, PMA) or (EEG, PMA, sample_weights) where: - EEG is ...
05cb061673efbeba6609e4ccf5187219017db55bef1819e7a689f911f62fbf89
Python
2,661
81
# 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...
1963d029162d9f8754517de6cb77525550921676e9e250f9b60d389a8147668c
Python
2,661
62
SYMBOLS = {',', '?', '!', ':', '\'', '"', '(', ')', ';', '@', '^', '^', '&', '&', '$', '$', '£', '[', ']', '{', '}', '<', '>', '+', '-', "*", "#", "%", "=", "~", '/', "_", "|"} BREAK_SYMBOLS = { ',', '?', '!', ':', ')', ';', ']', '}', '>', '[', '{', '(', '<', } PREP = {'about', 'above', 'across', 'afte...
e2fffc83bd9c8484c5a7463efb60376cf39e174cf6417852f1ae7823610c9735
Python
2,662
75
""" Unit tests for NCMC integrator. """ __author__ = 'John D. Chodera' ################################################################################ # IMPORTS ################################################################################ import numpy as np import os running_on_github_actions = os.environ.get(...
263c1fdced7a99c629fc624264dc2ca8da5e913401749678805d619b41186a85
Python
2,663
88
from langchain_core.documents import Document from langchain_core.language_models import FakeListChatModel from langchain_classic.retrievers.document_compressors import LLMChainExtractor def test_llm_chain_extractor() -> None: documents = [ Document( page_content=( "The sky is...
8c148c8940ffa4a966e5cd47d30e19121ded54e0c44e4d8326c7c7c3e549dd7d
Python
2,663
68
from __future__ import annotations from langchain_core.language_models import LanguageModelLike from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import BasePromptTemplate from langchain_core.retrievers import RetrieverLike, RetrieverOutputLike from langchain_core.runnables import R...
2855a842593599c76c41905f8845d438e5007f5f71c66d65e28f1bca859ac647
Python
2,664
70
import torch from torch import nn from torch.optim import Adam class InnerProductSimilarity(nn.Module): def __init__(self, temp): super(InnerProductSimilarity, self).__init__() self.temp = temp def forward(self, a, b): d = a.shape[1] a = a.unsqueeze(1) # N x 1 x dim i...
5467515817a504c32cf94caec4f27267e30bf0d7b1136ab6b0cf234402c2d9b2
Python
2,666
101
#!/usr/bin/env python3 """ Write separate volume for each label found in the input image Usage ---- separate_labels.py <input label image> separate_labels.py -h Example ---- >>> separate_labels.py atlas.nii.gz Authors ---- Wolfgang M. Pauli, Caltech, Division of Humaninities and Social Sciences Dates ---- 2015-05-...
50a5073de41a22ef248294d7e8132c8e5678e749e571281ce91c22ad41cf8387
Python
2,667
48
from perses.analysis.visualization import Visualization from pkg_resources import resource_filename import os from unittest import skipIf import pytest running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true' #@skipIf(running_on_github_actions, "Skip helper function on GH Actions") @pytest.mark.sk...
2b5b11d15c76bead2103728b3224416c205de6b3dd88ca0124df06580b2453be
Python
2,668
85
import numpy as np import struct def readmda(fname): f = open(fname, "rb") try: code=struct.unpack('i', f.read(4))[0] except: raise IOError("Problem reading file: %s" % (fname)) if code > 0: num_dims = code code = -1 else: f.read(4) num_dims = struct....
c804e8accdb8e33d9e731412cbce72efc0eb897a29f55c7ecb919d4bca7ad5a0
Python
2,669
91
# 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 logging import numpy as np import torch.utils.data logger = logging.getLogger(__name__) class EpochLi...
448e83caada66b0bc517ef1799cade78562b72e259fdbaa8e9b5a0930e771d1d
Python
2,671
68
import joblib import matplotlib.pyplot as plt from plastic import PlasticNet from neural_net_utils import plot_train_perf, plot_W, plot_B from data_utils import generate_recognition_data, recog_chance from torch.nn import functional as F #%% d = 25 #length of input vector P = 0.5 #probab...
5bb9934728c17e763e3e3c54c7f765aac3bfd0d7e351d4b59f7289c5a52f1ce7
Python
2,673
71
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Description: : @Date : 2022/06/16 12:09:02 @Author : Zilan Yu @version : 1.0 ''' import torch import torch.nn.functional as F import torchmetrics import pandas as pd import sys, os from scipy.stats import spearmanr from HeteroModel import * from d...
30281520c731b41729f72f2d1d285d8f5fe035f7341b597ed6e5cbfe0ede76d1
Python
2,674
68
from __future__ import annotations from typing import Any from langchain_core.retrievers import ( BaseRetriever, RetrieverOutput, ) from langchain_core.runnables import Runnable, RunnablePassthrough def create_retrieval_chain( retriever: BaseRetriever | Runnable[dict, RetrieverOutput], combine_docs_...
34dee58ef99871eb1bf0d45ee191bbdf65b080dd8c2d298ac4e084327c2e6121
Python
2,674
83
import numpy as np import pandas as pd from scipy import stats from ._base import _CITestResult from .pearsonr import Pearsonr class FisherZ(Pearsonr): r""" Fisher's Z test for conditional independence on continuous data. This test first computes the Pearson or partial correlation coefficient :math:`\rh...
9e681d514e06b883cd066f5170fb2f3c352a71a8231e4b1e491f970042fe33b4
Python
2,675
74
import numpy as np import pytest import torch import torchmetrics from scvi import REGISTRY_KEYS from scvi.data import synthetic_iid from scvi.distributions._utils import _mps_supports from scvi.external import SCBASSET _DNA_CODE_KEY = "code" def _get_adata(sparse_format: str | None = None): dataset1 = syntheti...
011c925f38b5acd95b8c44d541c36b36368e5849a459f9e9e0179343e0db1e93
Python
2,677
86
import json import re from re import Pattern from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from typing_extensions import override from langchain_classic.agents.agent import AgentOutputParser from langchain_classic.agents.chat.prompt import FORMA...
2542b5b83ec7482b3d4a4abda14c58c87a924cb6e68bf9027a9a2a62e18eef70
Python
2,677
72
#!/usr/bin/env python import time # Import OpenMM tools from simtk import openmm, unit from simtk.openmm.app import * # Use MDTraj to write simulation trajectories from mdtraj.reporters import NetCDFReporter # Import the SMIRNOFF force field engine and some useful tools from openff.toolkit.typing.engines.smirnoff i...
a3a635ae9e8ead6df5dcbe6b6c101a13cf7f718a95bafde3f959fa7555890674
Python
2,678
74
import xml.etree.ElementTree as ET from semantic_version import Version from pathlib import Path import requests def read_versions(root): versions = {} versions['PycroManagerJava'] = Version(root.find("version").text) # iterate through the dependencies and get NDStorage, NDViewer, and AcqEngJ dependenc...
c72999380a63e02df515f935ef808a299dc364d1d41db3ab833c9a65030f2bd8
Python
2,678
79
import numpy as np from scipy.stats import pearsonr from sklearn.model_selection import KFold from sklearn.linear_model import LinearRegression, Ridge import sys from sklearn.decomposition import PCA d='/jukebox/griffiths/bert-brains/' dataset=sys.argv[1] sub=sys.argv[2] if dataset=='slumlordreach': su...
ac718acc2bfd0e78bcfafb75e06706a99fdedb0f02ed0ffea8f18a7215aecd36
Python
2,679
83
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or module...
b2c787f60bfcfbb0a332be4fe28e6d54da172805e0318f511820cecde3aa6d04
Python
2,679
92
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import numpy as np import nibabel as nib import pylab as plt DESCRIPTION = """ Plot the timeseries of a 4D Nifti file """ def buildArgsParser(): p = argparse.ArgumentParser(description=DESCRIPTION) p.add_argument('--in', dest='input', action='st...
ccbd50ba99473d480ce530ef5940e18e6dcf7c0f683ba38ed4378589340b265d
Python
2,680
112
# 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 ...
2a780857756b615c0f9ce566887c22b4271aa48c9d5aaac65610c51fc45864fc
Python
2,681
80
from langchain_core.agents import AgentAction from langchain_classic.agents.format_scratchpad.xml import format_xml def test_single_agent_action_observation() -> None: # Arrange agent_action = AgentAction(tool="Tool1", tool_input="Input1", log="Log1") observation = "Observation1" intermediate_steps =...
c1c10f17e8fc71b9e0c324f8bca60b2a87b955eedc25351af53608445913083a
Python
2,681
88
import numpy as np import logging _logger = logging.getLogger("analysis/utils") def open_netcdf(filename): from netCDF4 import Dataset import os # checking that the file exists exists = os.path.isfile(filename) if exists: ncfile = Dataset(filename, 'r') return ncfile def get_offlin...
b5ed2e827425ce57cac320ab82e6dcf9cad7b1b3a6f74113db432faa027b1949
Python
2,682
83
# Copyright 2018 DeepMind Technologies Limited. All Rights Reserved. # # 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...
c8efa8ea91928e3e2903e861ec42029a676c7d8f54fd2aa451675e47b2e6b3a9
Python
2,685
64
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
2310d6a4c04e8cef67b7d529dc1ab88dcc8e94865ee49fbb8d6b29b7492614fe
Python
2,687
76
import logging import os import socket import sys from configs.configs import get_config_dict from helpers.data import load_data from helpers.evaluation import leave_every_other_out_split from helpers.plotters import plot_node_timeseries if __name__ == "__main__": data_split = 'all' data_set_name = sys.arg...
7b133349d6a2488c76834702cfc8ac48f5c8e585d05447ac065e30ee5f49b0af
Python
2,687
63
# 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 writi...
1a52dfe08af56194b321d49ddaa2383a086243053330d5dabf9e7f0c69512a4b
Python
2,689
107
import random import math import numpy as np from scipy.interpolate import CubicSpline def jittering(x, sigma=0.1): return x + np.random.normal(0, sigma, size=x.shape) def scaling(x, sigma=0.1): return x * np.random.normal(1, sigma, size=(x.shape[0], 1)) def rotation(x): ch, _ = x.shape ch_inds = ...
22bfbf16fd33e72927914a66cb5e94b33397f4ac13612640ab6f45de721c289f
Python
2,692
77
import numpy import meshparty import meshparty.mesh_filters import trimesh from pycilium.utils.skeleton_utils import * def filter_mesh_cdskel_line_distance(mesh, cdskel, radius=600, endcap_buffer=300): segs = skelcd_to_linesegments(cdskel) orig_mesh = meshparty.trimesh_io.Mesh( mesh.vertices, mesh....
6b55f7921fc451d4abe52be0d4479451dddb11472866cb757cd2c0f267ebf89c
Python
2,692
69
from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.utils import Params from dliplib.utils.data.datasets import CachedDataset from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset from dliplib.utils.weights import save_weights, get_weights_path from dliplib.util...
d05aaed415eb9b5d47114734a988b25cc220f80064cef5bba3fa7195a4218b77
Python
2,692
75
import matplotlib.pyplot as plt import numpy as np import seaborn as sns from scipy.stats import f, norm, ttest_ind def ftest(s1, s2): """ f-test for two distribtuions """ print("Null Hypothesis:var(s1)=var(s2),α=0.05") F = np.var(s1) / np.var(s2) v1 = len(s1) - 1 v2 = len(s2) - 1 p_va...
4dc926943f8c12a4ce8d7b8b0f0878862a2710c5c7ac42bcdf8ba2c732f03dab
Python
2,693
62
from NeuronModel.NeuronClass import neuronClass import numpy as np class izhikevich(neuronClass): parameters = {'save': True, 'spike': True, 'C': 50., 'k_input': 1., 'v_rest': -80., 'v_t': -20., 'c': -55., 'v_peak': 40., 'a': 0.01, 'b': -20., 'd': 150., 'noise': None, 'scale_I': None, 'tau': None...
d1c548185521692ca14be062e34d5bea617f8d3c89a22eaef4ddb13a52907c99
Python
2,693
70
from itertools import accumulate import numpy as np import torch from torch.utils.data import Dataset class ProcessedLigandPocketDataset(Dataset): def __init__(self, npz_path, center=True, transform=None): self.transform = transform with np.load(npz_path, allow_pickle=True) as f: dat...
389d200a1263fbc36bfff88678263eb80a9c711baa8b5dc15ffba1c39db64071
Python
2,695
81
# 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...
ae98ed33b2a09dce998bb4a9c683727b254302f59c60d8e81871ef2308c56c9e
Python
2,696
74
import pandas as pd import numpy as np import re import scipy.stats import argparse def get_data(rawdata_path,save_path,cancer): data=pd.read_csv(rawdata_path+'/'+cancer+'.DNAmethy.csv',sep=',') sample=data.columns[1:] data.columns=['ID']+list(sample) ID_gene=pd.read_csv(save_path+'/DNA_methylation_ge...
5979efe5e825d4ec4bb4629ff096caa412578b7f5fde9666945cec74eff66c7c
Python
2,699
73
import argparse import sys from pathlib import Path from MRdataset import load_mr_dataset from MRdataset.config import MRDS_EXT from mrQA import check_compliance from mrQA.run_merge import check_and_merge from mrQA.run_parallel import create_script, submit_job def main(): """ Console script only for ABCD HP...
b4eda251cdbc6c660000c0a51475b8728137f1082458edcbd8e254a5a0fcc2db
Python
2,699
65
import numpy as np import pandas as pd import torch from collections import namedtuple from src.neurogym import NG_utils from src import utils def test_config(env, model, args, indicator): # tests a single configuration and extracts activations transition = namedtuple('transition', ('observation', 'activatio...
ebd55d36b3791daeda779e4ee0a002caf5ea2a0fd89066fe211caa068f7db400
Python
2,701
89
# Copyright (c) 2021, David Williams, Reza Sameni # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import numpy as np import scipy.io as spio def KFNotch(x,f0,fs,Q = [],R = [],gamma = 1): # input arguments ...
60a7252b2076e4460c20cabc39bb0641c3b432d68e6a9947d1e48ee15b5ea5d7
Python
2,703
84
"""Public APIs accept callables annotated with names imported under `TYPE_CHECKING`.""" import inspect import sys from typing import TYPE_CHECKING import pytest from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_core.runnables import RunnableGenerator, RunnableLambda from langcha...
3d13d94e6a9787724b3bdc382326278387383b068ad7e4528482008ba0dd4ee3
Python
2,704
80
"""Functions for constructing partial cover input set by year. """ from collections import defaultdict import logging import re logger = logging.getLogger(__name__) def read_years(fn): """Read years for a list of sequences. Args: fn: path to file with two columns; col 1 gives name of a sequence ...
faecd06659954771f5d7a60d8a6383db807a36d7c0e65e683a87a2a4e499bc9a
Python
2,705
68
import argparse arg_parser = argparse.ArgumentParser() arg_parser.add_argument("uniprot_tsv", help="tab-separate value table of uniprot accessions") arg_parser.add_argument("output_file", help="CSV file to write to") arg_parser.add_argument("-a", "--alphafold_accessions", default=None, help="list of available alphafold...
a2c1ef7c65f18e545ba03a407b6516f7f24a3d773f17d33b5dd80c71b41ea7fb
Python
2,706
90
# Copyright (c) 2021, David Williams, Reza Sameni # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import numpy as np import scipy.io as spio def KFNotch2(x,f0,fs,Qbar = [],Wlen = []): # input arguments ...
0492e2e73af8119aa0015551e7d73a21ed00a09d492347edeee86e6eadd6282c
Python
2,707
93
""" Extract transcription start sites from an Ensembl GTF. Used to create the TSS reference file used in ~/ATAC_PIPELINE/atac-seq-pipeline/scripts/build_genome_data.sh Usage: python tss_from_gtf.py <gtf_file> <tss_outfile> Supports both compressed (.gz) and uncompressed GTF files. Output will be gzipped if the ou...
4a789cba5c3179ac40456143fc834b0d5363a5e08754c99f28391fbe7cf23fba
Python
2,707
84
import argparse import pandas as pd import rdkit import scipy from rdkit import Chem from sklearn.metrics import mean_absolute_error, mean_squared_error def add_args(parser): parser.add_argument( "--prediction", type=str, required=True, help="The path to prediction result to be ev...
be5bc339381f19330e6a124521ac7f220b40ea9673020009be377c4b50518744
Python
2,707
87
import os import sys; sys.path.insert(0, '../') import argparse import pandas as pd import numpy as np import matplotlib.pyplot as plt import trajectory_reconstruction_tradeoff as T import random random.seed(20) # trajectory params dirname = '../' datadir = os.path.join(dirname, 'datasets') outdir = os.path.join(dir...
aad551bd6aaa0f85f26ff0d80a2cde2416f0afd1e2902cdc560c15a9cfeab60e
Python
2,708
93
# coding: utf-8 """ MIT License """ ''' Project: Parenchymal Attention Network Authors: Axel Masquelin Description: Utility functions to plot metrics ''' # Libraries # ---------------------------------------------------------------------------- # from sklearn.metrics import roc_curve, auc, confusion_matrix ...
b04742aab68a9cd6aec64f9be3c987c7b03704d99627c86ea16989205671c7df
Python
2,711
88
import os import sys import img3 import argparse import matplotlib.pyplot as plt import numpy as np import skimage.io from numpy.ma import masked_array from matplotlib import cm # group details group1 = [4834, 4836, 4844, 4849, 4851, 4858, 4864, 4868] group2 = [4837, 4840, 4847, 4848, 4850, 4871, 4873] group3 = [4838...
db9944f564a962f16b78c62e014231f1bc39d4e83dbbd2446f40972616a874eb
Python
2,712
80
import tensorflow as tf from tensorflow.keras.layers import Dense, LayerNormalization, BatchNormalization from typing import Union from .layer import StandardLRPLayer class DenseLRP(StandardLRPLayer): @staticmethod def forward(a: tf.Tensor, w: tf.Tensor) -> tf.Tensor: x = tf.tensordot(a, w, axes=1) ...
50780d444f660724f4253cfb7516073607d2b5aef1c761936a583cb1dc82756d
Python
2,714
80
""" Helper class for stacked auto encoder networks. :Version: 1.1.0 :Date: 21.01.2018 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2018 Jan Melchior This file is part of the Python library PyDeep. PyDeep is...
590fe2c35a109b26520beb6e374cec28fd955616b55857d9fba0c48113c1329c
Python
2,714
81
""" This script uses the recount metadata and a sparsity threshold to remove sc-RNAseq data from the recount compendium """ import argparse import pandas as pd import tqdm if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('count_file', help='The file containing the count matri...
6dd56b0cb25492e16e8f5bd51b07b52c5295b0e6a14a6e50916350f0b6ad9a40
Python
2,714
73
import numpy as np from scipy.ndimage import map_coordinates from scipy.ndimage import label def compute_profiles_fluo(fl, ma, m, visualize=False): fl_straight = np.reshape(map_coordinates(fl,np.reshape(m,(m.shape[0]*m.shape[1],2)).T,order=0,mode='constant',cval=0).T,(m.shape[0],m.shape[1])) ma_straight = np....
b293696bbfc238bc7e4fd6be70c8b2d2d0a46b508dad6eb526dfcf650488eb34
Python
2,718
103
import torch def batch_stack(props): """ Stack a list of torch.tensors so they are padded to the size of the largest tensor along each axis. Parameters ---------- props : list of Pytorch Tensors Pytorch tensors to stack Returns ------- props : Pytorch tensor Stack...
db8111f84a9616364791b81588f93e496a01fa2cd37a748f49e513a05b31c8f9
Python
2,718
89
import math import torch from torch.utils.data._utils.collate import default_collate DEFAULT_PAD_VALUES = { 'aa': 21, 'aa_masked': 21, 'aa_true': 21, 'chain_nb': -1, 'pos14': 0.0, 'chain_id': ' ', 'icode': ' ', } class PaddingCollate(object): def __init__(self, patch_size, length_r...
291d96f7de14019adca5d424a8cccd1acf81a74f702425014bac58721b2807a4
Python
2,719
71
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 15 13:23:17 2021 @author: shni2598 """ from brian2.only import * import connection as cn #%% class one_area: def __init__(self): self.neuron_model_e = cn.model_neu_syn_AD.neuron_e_AD_t self.neuron_model_i = cn.mo...
87936e20b649daee9a6eb88b784ace70c45b74fb884c09de4e4f500fdd88ea0d
Python
2,720
74
# builtin modules import os import logging # third party modules import numpy as np # pnabind modules import pnabind from .run_nanoshaper import runNanoShaper from .run_msms import runMSMS from pnabind.structure.structure import StructureData def generateMesh(structure, prefix=None, basedir=None, clean=Tru...
137352b9380511fb9c0f331abb36fdb5620e45a44e34226a4c6a36b342fea8da
Python
2,721
88
class Any2Int: def __init__(self, min_count: int, include_UNK: bool, include_PAD: bool): self.min_count = min_count self.include_UNK = include_UNK self.include_PAD = include_PAD self.frozen = False self.UNK_i = -1 self.UNK_s = "<UNK>" self.PAD_i = -2 ...
339df678eacec93029168ac959d61d3b67228c7e84b1ea6f6f72fbf5bbc0c876
Python
2,722
51
# Simple script to make sure basic usage # such as training, testing, saving and loading # runs without errors. import os def run(command): print(command) exit_status = os.system(command) if exit_status > 0: exit(1) if __name__ == '__main__': # download mini datasets if not os.path.exist...
57394cb1fe5333856a6ce09ad7098f72480151eaa05b96ece56425c3ba71b1c9
Python
2,722
90
import json import logging from collections.abc import Sequence from typing import Any from langchain_core.agents import AgentAction, AgentActionMessageLog from langchain_core.messages import AIMessage, BaseMessage, FunctionMessage _logger = logging.getLogger(__name__) def _convert_agent_action_to_messages( age...
3c000abd4a2db9436b898873bdd97c1bd40c79e22e34f6ed45d87efbe660f183
Python
2,723
95
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 12 14:51:42 2020 @author: shni2598 """ import numpy as np #from brian2.only import * import matplotlib.pyplot as plt from connection import coordination #%% def input_spkrate(maxrate = [800,800], sig=[6,6], position=[[-32, -32],[0, 0]], n_side=64,...
653bffda79521e6c910f3b9e0263a0e450a93485d6650494736a70a8620bb8e5
Python
2,730
82
from dataclasses import asdict from logging import Logger from pathlib import Path from typing import List from tqdm import tqdm from ..data import AnnotationTable, WorldlineTable, Annotation from ...methods.track_frame import track_frame from ._utilities import default_args @default_args("_now, True, False, False"...
6bb032d690451216bff0efa4cc6588a305c094fa686ef1f6f8ee9aec335b7848
Python
2,731
78
import numpy as np from skimage.io import imread import os from natsort import natsorted from skimage.measure import regionprops import torch """ Generate the Svetlana-compliant labels file from the Panuke dataset labels """ images_folder = "/home/cazorla/Images/Panuke/Part 1/training_frugal/Images" masks_folder = "/...
1913deaec0bf1807f5139659f15932b71a194bedd2a356555eea0d64c254fdea
Python
2,735
74
import pandas as pd import numpy as np import re import scipy.stats import argparse def get_data(rawdata_path,save_path,cancer): data=pd.read_csv(rawdata_path+'/'+cancer+'.DNAmethy.csv',sep=',') sample=data.columns[1:] data.columns=['ID']+list(sample) ID_gene=pd.read_csv(save_path+'/DNA_methylation_pr...
ccb2c6e8474c13a24266200fd3e09b2132a500ffe8e8cab411ee75066a51b290
Python
2,735
72
import pandas as pd from collections import namedtuple from stable_baselines3 import PPO from animalai.envs.arena_config import ArenaConfig from src import utils from src.animalai import AAI_utils def test_config(env, model, args): # Tests a single configuration and extracts activations transition = namedtupl...
648a96b33d6bcd8cdc07281aaa56d33e76eeb061ccf5e1091f297c6361d33148
Python
2,737
82
# Copyright 2019 DeepMind Technologies Limited. All Rights Reserved. # # 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...
a7d3a0974d85592df2d925160236ca761323ae4ec8eea4a3e5013e8c21769ad7
Python
2,743
95
import argparse import pathlib from typing import Optional import numpy as np import pandas as pd import decoupler as dc import yaml import json import gzip def parse_arguments( key: Optional[str] = None, stage: Optional[str] = None, method: Optional[str] = None ): """ Parses command line arguments "...
595062a288c279bd204269b2d2a668e11f16fce714e8884c787a5fb0ebb7c41c
Python
2,747
77
import glob import numpy as np from scipy.stats import iqr import matplotlib.pyplot as plt from paths import TEST_DATA_PATH test_data_path = TEST_DATA_PATH + "/baseline/" ground_truth = np.squeeze(np.load(test_data_path + "baseline.npz")["oxygenations"]) wls = [] results = [] results_corr = [] est_oxy = [] est_oxy_c...
f1f704e4a1006246615cf6aa61a9d41156ab9705d298f6c538779e18d873224f
Python
2,748
96
# Loading Data - SVHN - followed paper (https://arxiv.org/pdf/1603.09382.pdf) # Imports import numpy as np import scipy.io from sklearn.model_selection import train_test_split # Split train data into train and validation gettting certain number of labels from each class def train_val_split_count(x_train, y_train, si...
937963926af2649d55527f42deb42ab7ba345c96d6173f8bca2610c84f71ba24
Python
2,750
60
# 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...
e7f19eb02731658f9ab934e005dd2c4087d44268a77dcb6a83447184cd36d404
Python
2,753
72
"""Property tests for pydeepmapper.accumulate. Stdlib + pytest + hypothesis only.""" from __future__ import annotations import os import sys from hypothesis import given from hypothesis import strategies as st sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from pydeepmapper import a...
2f8dca4940f0c161e026c43c6ba253379f5941167836e65f2569cb7630f27b5c
Python
2,754
85
# Copyright 2020 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...
4f0b968536ffb3731a8dd4bc0b3c71b705e9abdba4a6512083bb53bf37c70d4e
Python
2,754
104
import numpy as np import steps.interface from steps.saving import * from steps.sim import * from steps.geom import * from steps.model import * from steps.rng import * from . import DiffPoint ######################################################################## # 1D diffusion in a finite tube with a constant and ...
24712ac53231591402345f8b4907ea24cb255ce460f1445c595035b598c7603a
Python
2,755
89
""" GPyTorch Regression Example Demonstrates how to implement full-batch L-BFGS with weak Wolfe line search without Powell damping to train an RBF kernel Gaussian process on a simple function y = sin(2*pi*x) + eps eps ~ N(0, 0.2). Based on GPyTorch example; see GPyTorch documentation for more information. Many thank...
cb5ab622360408c36357b4fe3f7b5d90743d080e4c86e1b07668d77d520aa1c4
Python
2,755
71
from .twod.datapipes.cfd import( onestep_test_datapipe_cfd, onestep_valid_datapipe_cfd, train_datapipe_cfd, trajectory_test_datapipe_cfd, trajectory_valid_datapipe_cfd ) from .twod.datapipes.navierstokes2d import ( onestep_test_datapipe_ns, onestep_test_datapipe_ns_cond, onestep_valid_d...
37cdd993cf3628ce85f49c71ccb95bfb51abb70ec70ace8d4f5a9e4be6f81ff6
Python
2,757
107
import copy import torch class Compose: def __init__(self, transforms): self.transforms = transforms def __call__(self, data, idx_mask=None): for t in self.transforms: data, idx_mask = t(data, idx_mask) return data, idx_mask _TRANSFORM_DICT = {} def register_transform...
c6a8ec74e0b7bf386c942b4741437e85243b87d73622e8d970cca2e9c49d9391
Python
2,757
115
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import sys def main(datalist, bvecfname, bvalfname): global_formater = '%.5f' print('\nUsing this output format: {}'.format(global_formater)) ## BVECS (PVM_DWGradVec + normalization) print('\nextracting bvecs from normalizing $PVM_DwGradVec') ...
e46971f0a45b88aa87e3434e37e96756e4bf0327e16b1a5712ff8eda239e3def
Python
2,757
98
''' PipelineKegg.py - Tasks related to KEGG analysis ================================================ Reference --------- ''' import cgatcore.experiment as E from rpy2.robjects import r as R import cgatcore.iotools as iotools import cgat.Biomart as Biomart import re def importKEGGAssignments(outfile, mart, host, bi...
ed7d7d706e1ca61724a2b176992122e87de8394ea9e5b595ce0e84b14bfc5221
Python
2,758
108
from setuptools import setup, find_packages import io setup( name='mantis-ml', version='1.6.3', author='Dimitrios Vitsios', author_email='dvitsios@gmail.com', description='Disease-agnostic gene prioritisation from high-throughput genomic screens by stochastic semi-supervised learning', url="https://github.com/as...
d6a71165b28d287f9fd98840ccb21fa5e4b854ff2f4c729fe7e63e5ad872537b
Python
2,760
84
import numpy as np import os import re from data import protein from data import residue_constants from scipy.spatial.transform import Rotation from openfold.utils import rigid_utils CA_IDX = residue_constants.atom_order['CA'] Rigid = rigid_utils.Rigid def create_full_prot( atom37: np.ndarray, atom3...