sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5001ff751210954d2e865f8bfece5c7fb70e39ee01533c36f25b03138b241997
Python
3,741
93
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 loc...
80b48733c296fb2f82c5f6c69fb347478efc6f8f61e10110ec6eeed83bc00cd9
Python
3,741
89
# 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...
374df2dc35a16b0be75d0b0b97e39f7549a6c10049b8ed09b88cbfb238b098aa
Python
3,742
103
from torch.utils.data import Dataset import numpy as np from torchvision import transforms import torch import json if torch.cuda.is_available() is True: try: import cupy as cu from cucim.skimage.morphology import dilation, disk cuda = True except ImportError: from skimage.morph...
8d2dba745523f907a6189d00185cf7fd17c7e7cbf788ee3e20ed1a3e6b6c4ccb
Python
3,742
124
BaseDir = "R:/Temp/Threads3/Thread0" MeanCurr = 0.150 StdCurr = 0.150 file_name = 'Cell' durations = [9900] #ms stopTime = [10000] #ms rangesL = [10000] #phase calculation crop limit low rangesH = [-10000] #phase calculation crop limit high resultsdir = BaseDir+'/Results/Results.txt' #Simulation Step = 0.1 #ms #Intr...
4aca4d2ed48155450b203c64fc072cd06a590c14297bab02c83e554876010eb4
Python
3,743
93
import numpy as np import gym from stable_baselines3 import PPO import torch from stable_baselines3 import A2C, PPO from stable_baselines3.common.torch_layers import BaseFeaturesExtractor from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union import pickle from stable_baselines3.common.utils...
4d396dd345829f1c873f9da4a6ee4f58eca092d4ae67c4fd681679dbb95d4c84
Python
3,743
105
import rdkit.Chem as Chem from .mol_graph import bond_fdim, bond_features import numpy as np BOND_TYPE = ["NOBOND", Chem.rdchem.BondType.SINGLE, Chem.rdchem.BondType.DOUBLE, Chem.rdchem.BondType.TRIPLE, Chem.rdchem.BondType.AROMATIC] N_BOND_CLASS = len(BOND_TYPE) binary_fdim = 4 + bond_fdim INVALID_BOND = -1 def get...
60241b399785fcc9aeeae868c8bcc3bfb4ee51bdb95d724c45b7612c47afd52e
Python
3,743
124
BaseDir = "R:/Temp/Threads10/Thread0" MeanCurr = 0.150 StdCurr = 0.150 file_name = 'Cell' durations = [9900] #ms stopTime = [10000] #ms rangesL = [10000] #phase calculation crop limit low rangesH = [-10000] #phase calculation crop limit high resultsdir = BaseDir+'/Results/Results.txt' #Simulation Step = 0.1 #ms #Int...
f4b5dd124f646e6b183daa6e734410eeb350583adb4d20e1896df89a9efe7693
Python
3,746
99
import re from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_classic.agents.agent import AgentOutputParser from langchain_classic.agents.mrkl.prompt import FORMAT_INSTRUCTIONS FINAL_ANSWER_ACTION = "Final Answer:" MISSING_ACTION_AFTER...
1d7a380c92d5e3fd479ba88e8a5f21a9d4419c52c6a43d365671a2f7631e049f
Python
3,747
121
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import functools from typing import Optional import h5py import torch # import torchdata.datapipes as dp import os from .common import build_datapipes class CFDDatasetOpener(torch.utils.data.Dataset): """DataPipe to load Navier-Stokes data...
f1df25108a3937fdef4acbcab9ee9b18dcdab94d36cd6f2db38822fdb15886c7
Python
3,747
82
import os import pickle import argparse from pathlib import Path import openmm from openmm import unit, app from perses.app.relative_point_mutation_setup import PointMutationExecutor from perses.utils.smallmolecules import render_protein_residue_atom_mapping # Read args parser = argparse.ArgumentParser(description='...
4c642ba487360da1f68e53ddc345b81a3e08d4fd1ea684b1c373b3958233d6a1
Python
3,748
107
import argparse from pathlib import Path import pandas as pd import torch from monai import transforms from monai.data import CacheDataset from torch.utils.data import DataLoader def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--run_dir", help="Directory name to generate output resu...
c80e77de744b929a0f629a4b28aaa6fe009559f8300cf0a6d2b290e9666f8b1d
Python
3,748
125
BaseDir = "R:/Temp/Threads16/Thread0" MeanCurr = 0.150 StdCurr = 0.150 file_name = 'Cell' durations = [9900] #ms stopTime = [10000] #ms rangesL = [10000] #phase calculation crop limit low rangesH = [-10000] #phase calculation crop limit high resultsdir = BaseDir+'/Results/Results.txt' #Simulation Step = 0.1 #ms #Int...
fe435b6650d1a8a2004e113248999267546b6a982d0ee58ffeab9db59ae3d5e9
Python
3,750
102
############################################################################## # # Merges sample-wise TIN scores reported by tin-score-calculation.py into # a single table. # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@g...
66d6c42f960ad8b92607066d1563defc590576504b446d29d4f88ede037448a9
Python
3,751
76
"""Regional surface statistics without requiring a tissue segmentation volume.""" from __future__ import annotations import argparse from pathlib import Path import nibabel as nib import numpy as np FIELDS = ('area', 'area.pial', 'thickness', 'curv', 'white.K') def read_measurements(subject_dir, hemi): subjec...
1997328b692637538b1e800f624ebb2e4aa236473309963dd958b3ff9cccb8cc
Python
3,752
127
from typing import Tuple, List from pathlib import Path import re import numpy as np import pandas as pd import scipy.stats as stats from scipy.fft import rfft, rfftfreq from statsmodels.stats.outliers_influence import variance_inflation_factor def naive_diff(x: np.ndarray, dt: float) -> np.ndarray: stencil = np...
e352d0f3737f0c12f07c43f7901142646ba50cbc1d43f9c7aff2f82cf324531c
Python
3,758
85
import gc import os import numpy as np import pandas as pd from keras import backend as K import keras import random import tensorflow as tf from keras.models import Sequential,load_model from keras.layers import Dense, Dropout, Activation, Conv1D, Input, Flatten from keras import regularizers from scipy.stats import ...
8c413c930a5e487d190631727653e7256c1db49ad2bdf8402644b248a73e6cb2
Python
3,760
133
import os import sys import logging import shutil import random import torch import numpy as np from datetime import datetime def save_checkpoint( epoch, model, optimizer, scheduler, lowest_loss, output_dir, device, ema, name="checkpoint.pt", ): if ema is not None: with...
ab2cea8fcf543365485605ad19bf0cc96cb78b8597ca4d8cb6fd11124b056587
Python
3,760
99
""" Plot histogram of raw learning rates for all trials in a group dataset. """ 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 import scipy.stats FIGSIZE = (plut.A4_PAPER_CONTENT_WIDTH * 1/2, plut.DEFAULT_HEIGHT) SM...
53a59d4318109eda8d137f6fe3f09eda25a36fb17d4acf7389d62b12c060dd28
Python
3,761
83
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # 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...
87c274b3f9ea1baca8f86e2adbff28ba9022f3ad789b0e5843b47bcf57c6bb8e
Python
3,761
96
from time import mktime, strptime path = 'E:/Old (12mo) Q175' #mouse = input("Enter the name of a mouse and press enter: ") b_first_event = True b_mouse_entered = False time_shift_events = [] early_exit_events = [] entrance_before_exit = [] entrance_count = 0 exit_count = 0 mice = ['12QA01','12QA02','12QA...
df50989ec45fc6087e59ea374e9ce1d7c8e1ffd1875fd25eabb966615f040af0
Python
3,761
92
from typing import Any, Mapping, Optional, Tuple import torch from torch.nn import functional as F from torch.nn import init from torch.nn.modules import ELU, BatchNorm2d, Conv2d, Module, Sequential from torch.nn.parameter import Parameter from .base import Readout, Reduction class AttentionReadout(Readout): de...
479275063ca63aa12d2848ef92bfa04707b5c5a6a8c1f70577ae511ee603cdbe
Python
3,763
107
from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import Any from typing import Dict from typing import Optional from typing import Sequence from typing import Tuple from pydantic import BaseModel from ..common.config import get_config_file from ..common.config im...
6b67c96d3e0e6f7eac6b9e118d099719d75d3b76030bc7d19de1a216e7519655
Python
3,763
107
import warnings from abc import ABC from typing import Any from langchain_core._api import deprecated from langchain_core.chat_history import ( BaseChatMessageHistory, InMemoryChatMessageHistory, ) from langchain_core.messages import AIMessage, HumanMessage from pydantic import Field from langchain_classic.ba...
a8a809b854970b27695cd3778d35d264037d2c5ec385cc8c966037b084500add
Python
3,765
50
from glob import glob # Define parameters ------------------------------- begin_time = 180 # [in sec] where to start analyzing time series end_time = 480 # [in sec] where to stop analyzing time series frequency = 1500 ...
e8292f036a886b2d95d09125a438627a6cfb9ebb796fa7494558e02a1bfcfd1f
Python
3,765
81
"""One explicit RAS <-> crop-voxel contract for inputs, labels and exports.""" from __future__ import annotations from pathlib import Path import nibabel as nib import numpy as np from nibabel.affines import apply_affine from utils.files import atomic_json, sha256_file from utils.surface_io import write_obj MODAL...
a98bc437149be8e2e397d6d086f0ace7b954a57e9936e92e49b1b85a3c1e4315
Python
3,766
76
# -*- 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, including ...
f1e615e8919a2a572b06f66358b46363db52601186bc1102cbfbf2c38ef8b27f
Python
3,766
111
import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl def discrete_cmap(N, vmin=0, vmax=1, base_cmap='seismic_r', over='w', under='w', bad='w', alpha=1.0, values=None): base = plt.cm.get_cmap(base_cmap) if values is None: color_list = np.array(base(np.linspace(vmin, vmax, N))) ...
eda267a2e5fecb5e97313b9689fe9f642806959c63a0cd38594a7a488e7334ba
Python
3,767
111
from typing import Any import torch from torch import nn from torchvision.models import vgg19 from ptrnets.utils.config import load_state_dict_from_model_name __all__ = ["vgg19_original", "vgg19_norm"] # Define vgg auxiliary class class VGGConv(nn.Module): def __init__(self) -> None: super().__init__()...
2fc62473776b9b00790112c209f798cbfa1fedb1ff919772dc976ab44dce5726
Python
3,768
83
import torch import torch.nn as nn #from equivariant_attention.modules import get_basis_and_r, GSE3Res, GNormBias #from equivariant_attention.modules import GConvSE3, GNormSE3 #from equivariant_attention.fibers import Fiber from rfdiffusion.util_module import init_lecun_normal_param from se3_transformer.model import ...
59b98a552d1e7e7d766d012b716bd02755fb7ef0d3e1c2a7f9f9bcf5ca3cf79e
Python
3,769
111
import sys from pathlib import Path import numpy as np from openff.toolkit.topology import Molecule from openmmforcefields.generators import SystemGenerator from pkg_resources import resource_filename from simtk import openmm, unit from simtk.openmm import app DATA_PATH = Path(resource_filename("openforcefields", ".....
689e113556829c2fc72e249f1ca36d8e65661e13fadf57da462c1c49e2cf8e32
Python
3,769
134
import cv2 import numpy as np import torchvision.datasets as datasets import torchvision.transforms as transforms import torchvision.transforms.functional as TF from random import random, choice from io import BytesIO from PIL import Image from PIL import ImageFile from scipy.ndimage.filters import gaussian_filter Im...
089f69a0a6f2345be31676f4bf82c36e195ee36faf8ebdd386cbdd474f937344
Python
3,770
100
#!/usr/bin/env python import concurrent.futures # import warnings import requests from pycilium.utils.import_tools.catmaid_utils import CatmaidApiTokenAuth from pycilium.utils.skeleton_utils import * # warnings.simplefilter('once') # # comment the line below out unless you need it. Seriously. # catmaid_request_kwar...
09ff3bb5bd79959e34e5da18522be295f0577851a586b3d465444cb1043af186
Python
3,770
120
# 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 ...
81c45827db8aab7f3c059ff1a2334628200135142945dd8709fd8d2ac1cb2775
Python
3,771
131
#!/usr/bin/env python3 """ Construct a probabilistic atlas from a set of N label images each containing M unique labels. The final atlas will be a 4D float image (nx x ny x nz x M) scaled from 0.0 to 1.0 Usage ---- probabilistic.py -o <Output filename> <List of N label image volumes> probabilistic.py -h Example ---- ...
cb1f50998e1a8406811ecb03a0e406aae383be86fdf3ce9010dfd24223e3804f
Python
3,772
124
""" ############################################################################## # # Convert clustered events into bed format. # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREATED: 26-03-2020 # LICENSE: ...
6225700c749319f55f8ac56c7b6fb452c257826936f20956d0ddf70f3102e245
Python
3,773
118
import errno import os import re import sys import zipfile from typing import Any from typing import Dict from typing import Optional import gdown import requests import torch from gdown.parse_url import parse_url def _get_name(id_: str) -> str: """ Gets the base url name from the gdrive using the file id. ...
a67532e63d5c03d631a3216690a7a2b1c55dc4a1c173c80a018a8f1cd7d16a30
Python
3,775
122
######################################################################## # Stochastic production and degradation well-mixed reactions. # AIMS: to verify STEPS well-mixed stochastic solver 'Wmdirect' # solves the master equation correctly when applied to a # zero-order production and first-order degradation process...
fb514911bf9fb9b2c9c9f5e813c28e5faa344fd3feedf14fb5c16b486774a8be
Python
3,780
113
""" Author: 2022 Anna M. Puszkarska SPDX-License-Identifier: Apache-2.0 """ import matplotlib.pyplot as plt import numpy as np import seaborn as sns from pathlib import Path from sklearn import metrics from typing import List, Optional def get_plot(y_test: List[np.ndarray], y_pred: np.ndarray, ...
dcd74ee8b539cb2dae3fefbf958864a6ff29a456834d196a4426a2dc71822da4
Python
3,781
94
""" Plot the ranges of cpp and uncertainty values encountered in the two learning tasks. """ 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 FNAME_PREFIX = "task_ranges" def run_with_args(): output_dir = dana.get_output_dir_for_...
e37308adf8b510fbed85c85278ccc7885ac47f6b610114f6229278f5e78c5543
Python
3,781
108
import os import pandas as pd import iFeatureOmegaCLI import torch import numpy as np from torch_geometric.data import Data import warnings warnings.filterwarnings("ignore") import pickle from tqdm import tqdm import multiprocessing import logging from torch_geometric.utils import add_self_loops import contextlib impor...
e8cc487ee94c85d3575c702cc7297ddcef08c82ccf02e66171afe3ff7c50161f
Python
3,783
96
# 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...
4d640d1161576e7f4df28d95af429d05e0d87d9359b5ca9e0b4a01340f04a767
Python
3,784
122
import math from unittest import TestCase import pytest import torch import torch.nn as nn from chroma.layers.basic import ( MaybeOnehotEmbedding, MeanEmbedding, NodeProduct, NoOp, OneHot, PeriodicPositionalEncoding, PositionalEncoding, PositionWiseFeedForward, Transpose, Trian...
58e31771d1291148a17dc13e49972454f8d834c75117f5c0e83086f2cea8215c
Python
3,784
103
from torch.utils.data import Dataset import numpy as np from torchvision import transforms import torch import json if torch.cuda.is_available() is True: try: import cupy as cu from cucim.skimage.morphology import dilation, disk cuda = True except ImportError: from skimage.morph...
74bae4cc7b49a2980f6ebecddc04a807b9c5b735fc5501c3adf51b11820de7ed
Python
3,785
98
"""Define the model utilitiy tests.""" import pytest import numpy as np import torch from vulcanai.models.utils import (round_list, get_one_hot, pad, set_tensor_device, master_...
871132fddc4d3678e1839214d7643f1403b2ee1011f75defd6c70a87bba8247d
Python
3,785
129
# 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...
696d8ecd5bee5d18b1cb8a9a2913544e84276dc015d10cab05335e2155aa9182
Python
3,786
101
import numpy as numx import pydeep.misc.visualization as VIS import pydeep.base.numpyextension as npExt import pydeep.misc.io as IO import pydeep.base.activationfunction as AFCT class One_shot_learner(object): def __init__(self, input_dim, hidden_dim, output_dim,...
f938e2da3696a3e629eab8f4fa56b7fb91a36f9fde647a28cf195dd0ea90bcb8
Python
3,787
135
import argparse import torch from bindsnet.encoding import bernoulli from bindsnet.environment import GymEnvironment from bindsnet.learning import Hebbian from bindsnet.network import Network from bindsnet.network.monitors import Monitor from bindsnet.network.nodes import Input, LIFNodes from bindsnet.network.topolog...
267de13009dff1c6d034e1cfbf83c723dacfb930fb6d6d6baaa2582a5c891943
Python
3,789
125
# make sure to activate your virtual environment e.g., $ conda activate dedalus import numpy as np import dedalus.public as d3 import logging import h5py, os logger = logging.getLogger(__name__) import matplotlib import subprocess, glob # Initialize lists init_perturbs, outputs = [], [] n_samples = 150 # Simulation ...
45e24e904ae7973a349fe98c3555c799662e78a09a9dee137d9318e283443c23
Python
3,791
75
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
b7d96422df481b0836d88ac4ca8e71fd420479f5882c3f43231669ff38eafe21
Python
3,791
99
# FCN model # when tuning start with learning rate->mini_batch_size -> # momentum-> #hidden_units -> # learning_rate_decay -> #layers import tensorflow.keras as keras import tensorflow as tf import numpy as np import time from utils.utils import save_logs from utils.utils import calculate_metrics class Classifier_CNN...
2f98088736c7b358f32897cf0895f517465aaba434285526c4ac3ec492778520
Python
3,792
122
######################################################################## # Stochastic production and degradation well-mixed reactions. # AIMS: to verify STEPS well-mixed stochastic solver 'Wmdirect' # solves the master equation correctly when applied to a # zero-order production and first-order degradation process...
9e42667c94df6b7f4ca72fe04b72d5173c2da2f0312f7cab3d49ae0ea169df87
Python
3,792
123
######################################################################## # Stochastic production and degradation well-mixed reactions. # AIMS: to verify STEPS well-mixed stochastic solver 'Wmrssa' # solves the master equation correctly when applied to a # zero-order production and first-order degradation process. ...
afd7c418987ca8113a880021c4d1825629f6926a7344664d3b5adeade40a4524
Python
3,792
118
""" running the ntf over a range of frequencies.""" from ..forward import network_transfer as nt import time as time import numpy as np def run_forward(brain, params, freqs): """run_forward. Function for running the forward model over the passed in range of frequencies, for the handed set of parameters (which...
eb3ec4f36bb5f18b95749dce4d4fd4a11098315272893dc34c8a9d19be1ccdc4
Python
3,792
135
from pathlib import Path import os import shutil import contextlib import joblib from tqdm import tqdm import numpy as np from joblib import delayed, Parallel, parallel_backend import multiprocessing import torch from scipy import special import matplotlib.pyplot as plt def create_folder(path,clear=False): if...
2d94ee97bf78aac7ac199e39fbc35141f446f96b0b09f7f955fff39f3235003c
Python
3,793
113
import os # from deepinterpolation.generic import JsonSaver, ClassLoader class Deepinterpolation: """module for deepinterpolation denoising on an imaging series""" def __init__(self): self.generator_param = None self.inference_param = None self.model_path = None self.input_pa...
ed8d2115e79bbeabe068221b0636e10ddae964489d917116ae6bd1d8b827c135
Python
3,793
89
""" Plot the distribution of intervals (in terms of number of outcomes, or trials) between two estimate updates that the subjects performed. Note: The interval between two updates corresponds to what is called "step width" in Gallistel et al. (2014). """ import argparse import data_analysis_utils as dana import matpl...
0370feb604e30366a6cd5fd8ca7bdde3ccec87bed004c276e8902d0d72146fcd
Python
3,796
107
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import MEnet def command_tile(args): from .tile import tile print(args) tile(args) def command_train(args): from .train import train train(args) def command_predict(args): from .predict import predict predict(args) #...
7287ac4947dd1a94a6a79329b46d94262a0769ba37c71e2e47a672f3c650fc0a
Python
3,796
139
# 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...
d9888e39a98c4d727f14ee3c7421e1ba393cd308697b88218b01608988a0c73d
Python
3,797
128
# This script is part of pymaid (http://www.github.com/navis-org/pymaid). # 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 ...
a90219761e5824829e9d1fd1aa6e203f4e8aeb37166761d34d9eab467323c0b1
Python
3,802
132
# -*- coding: utf-8 -*- """ Created on Wed Jan 27 09:28:41 2021 @author: pku """ import matplotlib.pyplot as plt #%% import numpy as np import tensorflow as tf from tensorflow.keras import applications, regularizers, optimizers from tensorflow.keras.models import Model, Sequential from tensorflow.keras.app...
56bf8fd3e24fc8a740ea0a673b36276f65d14ec393394a32ae5151a96e1ad30f
Python
3,803
91
"""Purpose of this script: try sorting those single sessions separately that failed when batch run together with other sessions""" import os import sys from time import time import multiprocessing from queue import Empty as qEmptyException import traceback import json import numpy as np sys.path.insert(0, "../") fr...
94e6346a4648fa323e1a997b28d77d2fcb70a8a934e8daf59d77f3c3ac095e1c
Python
3,805
125
import os from multiprocessing import Pool from skimage.transform import resize from ..utils.io import * def dist_corrcoef(image_1, image_2): """Return a distance between two images corresponding to 1 minus the correlation coefficient between them. This can go from 0 to 2.""" dist = 0 for x1, x2 in ...
62952666a0bd6a18aa7f6010bcd1c4ffa21b6f726d99eb4530ddb95a8802b02e
Python
3,806
121
import pickle as pkl import itertools import numpy as np from matplotlib import pyplot as plt import seaborn as sns from pathlib import Path import sim_utils as util basic_colors = plt.rcParams['axes.prop_cycle'].by_key()['color'] SAVEFIGSS = True # Global variable to enable/disable saving figures # SAVEFIGSS = False...
420394634679cfc95040bdfe56569f98c0fa1ddbdcd616944866b171839cb35a
Python
3,807
122
"""Test the comparison chains.""" import re import pytest from langchain_classic.evaluation.comparison.eval_chain import ( LabeledPairwiseStringEvalChain, PairwiseStringEvalChain, PairwiseStringResultOutputParser, resolve_pairwise_criteria, ) from langchain_classic.evaluation.criteria.eval_chain impo...
9bf7fef38b1a6220ffaa030a2b98e832d0c2e5df9e9045db1ec5dd8283283ddd
Python
3,808
94
import os import numpy as np import scanpy as sc import scvelo as scv import cellrank as cr from scipy.io import mmwrite os.chdir('/home/jfleck/projects/cutntag/') adata_d158_A395 = sc.read('data/drugs/drugs_d15_d18_A395_v2velo_v1.2lines.h5ad') sc.pp.neighbors(adata_d158_A395, use_rep='X_harmony', n_neighbors=20) s...
14acfa3fd91675f7a8f0d55b31470baa8d804f119f1539bbca26ba3ee865fa4b
Python
3,809
102
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for d...
2b238094f91bdc13a2f0d1f363f8f51341e0f2177f9fbec5bd1f46b02bdaae69
Python
3,809
123
######################################################################## # Stochastic production and degradation well-mixed reactions. # AIMS: to verify STEPS well-mixed stochastic solver 'Wmrssa' # solves the master equation correctly when applied to a # zero-order production and first-order degradation process. ...
a03b9b7b06c310e8c957b8e08ec489aa4570eb8090e94fe626ac1a86437ed4b2
Python
3,810
102
#################################################################################### # # 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...
d707328075aaa63034b38e46a230abd3b2e72e73908183ca858192a3763ac207
Python
3,810
84
import matplotlib import matplotlib.pyplot as plt import os from Articles.Sequential_Learning_Striatum.Code.FigureSequential import * font = {'size' : 16} matplotlib.rc('font', **font) name_STDP = ['Symmetric LTD','Anti-Hebbian','Hebbian', 'Symmetric LTP'] name='Bernstein' P_list=[10,20] stim_by_pattern_list=[3,4...
119115eab931c1fd67766e5d0c343f038af7d4d8b3075bc5cd919c8849a1fe8b
Python
3,811
107
import argparse import numpy as np from oset.ecg.peak_detection.peak_det_simple import peak_det_simple def peak_det_local_search(x, ff, *args): """ peak_det_local_search - R-peak detector based on local max/min search peaks, peak_indexes = PeakDetection(x,f,flag, num_rounds), inputs: x: vector o...
3ce7823e800bc4c74b0575b7001e7605072768c89b7d3094ee170f2920b40a1e
Python
3,811
145
import numpy as np PRECISION= 17 np.set_printoptions(precision= PRECISION, suppress= True, floatmode= 'maxprec') def read_bvecs(bvec_file, assume_normed= True): with open(bvec_file, 'r') as f: bvecs = [[float(num) for num in line.split()] for line in f.read().split('\n') if line] # bvec_file can be 3...
58025342fed6967cbccf181b2afca850e06129c105d51513a87d58ba80bfa4ba
Python
3,811
86
import matplotlib import matplotlib.pyplot as plt import os from Articles.Sequential_Learning_Striatum.Code.FigureSequential import * font = {'size' : 16} matplotlib.rc('font', **font) name_STDP = ['Symmetric LTD','Anti-Hebbian','Hebbian', 'Symmetric LTP'] name_J = ['No Inhibition','1<->2','1->2', 'Random'] name=...
9d1400355e3dd519512e3595e8bd2897ad510b2dc1e44e996f33ef59e905190d
Python
3,811
145
#!/usr/bin/env python3 """ Convert single Nifti-1 3D or 4D volume to set of PNG stacks. Usage ---- nifti2png.py -i <Nifti filename> -o <PNG image stub> nifti2png.py -h Example ---- >>> nifti2png.py -i mynifti.nii.gz -o mypngs Authors ---- Mike Tyszka, Caltech Brain Imaging Center Dates ---- 2016-06-28 JMT Adapt fro...
d16e9751a2eab41791335fbb4d945eefd0fec23e9a9aa44d4aa9a3d96bec72b6
Python
3,811
125
# 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...
16488683c62f4285dc598bc293268755840401ffa5a99e2e3178779b822b75c8
Python
3,812
95
import torch from torch import nn class Encoder(nn.Module): """ Base class for all encoders """ def regularizer(self, data_key=None, reduction="sum", average=None, detach_core=False): reg = self.core.regularizer().detach() if detach_core else self.core.regularizer() reg = reg + self.r...
6c655e7e4af2840046d7daf48d27fa142025a667125f8f7ff082cf2a3f711af6
Python
3,813
112
import unittest from nilearn import connectome import numpy as np from helpers.array_operations import _check_symmetric from helpers.array_operations import map_array, reorder_symmetric_matrix from helpers.array_operations import reconstruct_symmetric_matrix_from_tril from helpers.array_operations import slice_covari...
96dff57fd125ead710373af3f68b4f6263050696d6ec0b4f3ab7cea3c978fad0
Python
3,813
135
######################################################################## # Stochastic first-order reversible reaction. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the First-Order Reversible # Reaction model (see validation/first_order_re...
bf709ef959453ad689ed63a0c118d1a7915f3c0ae4733febd2e045b8f3cee9a1
Python
3,815
142
"""Test concurrency behavior of batch and async batch operations.""" import asyncio import time from threading import Lock from typing import Any import pytest from langchain_core.runnables import RunnableConfig, RunnableLambda @pytest.mark.asyncio async def test_abatch_concurrency() -> None: """Test that abat...
d8593b10b2173f9509ca3c8f929c3ed4d2c90ddff13f531ff2b524fcf94b4914
Python
3,818
126
import os import h5py import numpy as np import scipy as sp import anndata as ad import pandas as pd import scanpy as sc import scvelo as scv import loompy as lp import cellrank as cr os.chdir('/home/jfleck/projects/cutntag/') #### Join all kallisto results #### # all_samples = os.listdir('data/individual_samples/')...
79fcbb5c54491450bbd715ae73fb6baffe30ebce9380fb564c622d5b3064aa0a
Python
3,820
123
import os import pickle from warnings import warn import torch import MuTILs_Panoptic.utils.torchvision_transforms as tvdt ISCUDA = torch.cuda.is_available() def tensor_isin(arr1, arr2): r""" Compares a tensor element-wise with a list of possible values. See :func:`torch.isin` Source: https://github.c...
d93ca83077ce8a15eae4891b6f574d6fd91cf6d2782f308695ebc055d66f7604
Python
3,823
103
import sys gene={} ###This file is to classify EE/EP/PP/NN neoloops########### cutoff=sys.argv[1]#############cutoff of peaks############ for i in open('/scratch/users/txie/RNA-seq/0ref/v29_all.gff'): t=i.strip().split() if not t[2] in gene.keys(): gene[t[2]]=[] if t[-1]=='+': loc=t...
5b92129e2a59a38698e92559cad1dfeb9aea96b46a86a854ad9efc690afaacb6
Python
3,825
119
"""**Memory** maintains Chain state, incorporating context from past runs. This module contains memory abstractions from LangChain v0.0.x. These abstractions are now deprecated and will be removed in LangChain v1.0.0. """ from __future__ import annotations from abc import ABC, abstractmethod from typing import Any ...
0298d8b484a7fdec6adebae554dcc9753a7d2b160cccec0867834ce31125c05e
Python
3,827
132
# %% imports import argparse import importlib import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.sparse.construct import rand import seaborn as sns import mne from sklearn.linear_model import RidgeCV from sklearn.model_selection import cross_val_score from sklearn.preprocessing import Fu...
80be3017fe89c84c246af1e6d32f7ab5713aef26d0315873643af2f7464d05eb
Python
3,828
154
import numpy as np from encoder_utils import FeatureTargetLoader, Preparer, Encoder def run_subcortical( subject: str, directory: str, alphas: list, tmin: float = -10e-3, tmax: float = 30e-3, sfreq: int = 4096, invert: bool = False ) -> tuple[np.array, float, np.array, dict, float]: ""...
35f0853535ca768d46be9dd54f651967ef16447424bfcbb83a541cf222976b4f
Python
3,829
88
import logging import os import socket import sys from fcest.helpers.data import to_3d_format from nilearn import connectome import numpy as np import pandas as pd from configs.configs import get_config_dict from helpers.brain_states import compute_basis_state from helpers.hcp import get_human_connectome_project_subj...
097941b551348ae3b7348d62a36abe4a20005f1506afa97cc91bdeef728d61ed
Python
3,830
100
import glob import shutil import tempfile from pathlib import Path import hypothesis.strategies as st import pytest from hypothesis import given, settings, HealthCheck from MRdataset import import_dataset from MRdataset.tests.simulate import make_compliant_bids_dataset THIS_DIR = Path(__file__).parent.resolve() @s...
90447c826095a7787c52c23004a6dbaa07634c2f26e37d008daad34de8cda9f7
Python
3,830
55
#TO BE UPDATED import numpy as np import math from WeightModel.WeightClass import weightClass from InitFunctions import gaussian class graupner(weightClass) : parameters = {'save' : False, 'step' : None, 'Cpre': 1., 'Cpost' : 2., 'tCa' : 20., 'delay_C' : 0., 'gammap' : 321.808,...
fec99eb10e4d59f4144c30dc02d494ceb1d59eeb977485311c30b13c2aab7740
Python
3,830
135
######################################################################## # Stochastic first-order reversible reaction. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the First-Order Reversible # Reaction model (see validation/first_order_re...
b94156834c7a71f0c8b9ca8eec3616cd7a9d4d3c273c47548e782d6335c69e0e
Python
3,831
99
# Copyright (c) <2021> <University of Paderborn> # Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/ # https://github.com/SSTGroup/independent_vector_analysis # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated d...
f805bbfd2af67b1ed9b661d10c6c4b17a7b280341f56b09d72596e48e8f4eb72
Python
3,833
137
"""Print information about the system and langchain packages for debugging purposes.""" import pkgutil import platform import re import sys from collections.abc import Sequence from importlib import metadata, util def _get_sub_deps(packages: Sequence[str]) -> list[str]: """Get any specified sub-dependencies.""" ...
40ca2445b5a0681fbcf5bf777dbcd73d24b4da941f02278943be7924cf10c34b
Python
3,836
117
'''utility functions to write and read tfrecord datasets. ''' import os from glob import glob from tqdm import tqdm import tensorflow as tf def tfrecord_from_sampler(output_path, sampler, serialize_fn): '''prepare tfrecords from a sampler. Parameters ---------- output_path : string path to s...
1c0aabfc92a56125f5e5be69fb55f8a83b1f5faf0a733e1c16b87d2116585601
Python
3,838
56
"""Figure 1: study framework. Three data sources feed one pipeline: anchoring, protocol, estimator, calibration, audited outputs. No equation or algorithm numbers are hard-coded (they change when the manuscript is edited); the caption carries references.""" from __future__ import annotations import os, sys import matpl...
f6ad6092c19457a67d34c58e5f3a94f9d85fed9e86d6ff85988fb400e9741e82
Python
3,838
106
""" Visualise a sample of instances (images and annotations) stored in a TFRecord dataset """ import tensorflow as tf import matplotlib.pyplot as plt import matplotlib.patches as patches import numpy as np # Parse TFRecords def parse_image(example_proto): # Create a dictionary describing the features. image_f...
112a44dfa9450f1197242604d530db82008b5d63a272f79640a14ac36939a568
Python
3,839
100
from collections import defaultdict from pathlib import Path def get_fasta_dict(fasta_file): seq_dict = defaultdict(str) with open(fasta_file) as f_fasta: lines = f_fasta.readlines() for line in lines: if line.startswith(">"): chain = line[1:].strip() el...
2d8de6f13435ce49513b62442d7da26b638fcd1963dd24b35c4831f0090e2dac
Python
3,839
143
######################################################################## # Stochastic second-order irreversible reaction: [A]0 != [B]0 # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the Second-Order Irreversible # Reaction model (see valida...
5310934c4b90771f85bf65b5bc352a93e55d76f0e72345413c08ef621bdb0a7c
Python
3,839
90
"""Held-out evaluation with arrangement-ensembling, for confusion matrices & metrics. The iterate-N runner (`runner.run`) accumulates *attribution*; this module accumulates *predictions*. It fixes ONE stratified train/test split, trains the backbone under N arrangements, and ensembles the softmax over arrangements int...
688f1139e733509bb80f29a2f9961c1ea6a8f818ee9d0b2fdefe6ff841ceea8b
Python
3,840
127
# 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...
fd1cc1cd7449c6eec7e3a853e4584a9c9320c39105741fd399fb67cdaf0cad31
Python
3,840
81
from torch.utils.data import DataLoader from qm9.data.args import init_argparse from qm9.data.collate import PreprocessQM9 from qm9.data.utils import initialize_datasets import os def retrieve_dataloaders(cfg): if 'qm9' in cfg.dataset: batch_size = cfg.batch_size num_workers = cfg.num_workers ...
8c11010b763d74046887e4b7e849ef2f76129a8d0d96fed4a362f0a0bbac94a3
Python
3,841
114
"""Test embeddings base module.""" import pytest from langchain_classic.embeddings.base import ( _SUPPORTED_PROVIDERS, _infer_model_and_provider, _parse_model_string, ) @pytest.mark.parametrize( ("model_string", "expected_provider", "expected_model"), [ ("openai:text-embedding-3-small", ...
71081a3edaf943424ef30b0f9bde132a44a7dc76d99853daa3fd4723c224d733
Python
3,842
102
import hydra from hydra.core.config_store import ConfigStore from config import Scenario from model import Net import os from utils import * from matplotlib.ticker import FormatStrFormatter from tqdm import tqdm import matplotlib as mpl from matplotlib import font_manager from scipy.stats import pearsonr import yaml fr...