sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9e2bf6a119f1b2814540c815226a39b2a49287f29545a55e05ec1b98be0c957e
Python
6,077
167
import copy from collections import deque import numpy as np from . import swa_utils class SWADBase: def update_and_evaluate(self, segment_swa, val_acc, val_loss, prt_fn): raise NotImplementedError() def get_final_model(self): raise NotImplementedError() class IIDMax(SWADBase): """SWAD ...
c61acd50b1a13d4e509df049f21ebbb8ce757b1cb05f7ffb7257f5bde4e9e5fd
Python
6,081
156
# -*- coding: utf-8 -*- """plot_pd_results.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/11ZJhsuYjfkJ3topN-bRfIwRXmHfc9wc9 """ import matplotlib.pyplot as plt import pandas as pd import numpy as np from sklearn.metrics import mean_squared_error...
11dcb3ee1b7b8d8654e693df623bd168cce4f91d905b99444f6946fb877235bf
Python
6,082
206
#!/usr/bin/env python3 import os import warnings import argparse from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd from src.drop_width.model import build_lstm_model from src.drop_width.preprocessing import DropDataProcessor from src.drop_width.side_to_width import width_e...
ae0fa6d326ddb86de4302359ee947a92add1b048427ef18f4cd0e5c14320aaa7
Python
6,083
218
# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # formats: py:percent,ipynb # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.15.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # -...
1dc08b72f33b43a3ac5c145f7313309944adec98f257125118addd0d13ff0483
Python
6,084
166
# Description: This script resembles ABCD_ROCAUC_Comparison_Fig1.py and compares classification performance of different harmonization # techniques. We here do no plot the ROC curves, but rather compare the AUC scores for within and across brand comparisons with boxplots. # This script results in Figure 2 (FA) in the...
759818b3912da36936f05cd3037c1249f4cfec5babdeee6f031d5cb7b5103ebb
Python
6,086
196
"""Test for Serializable base class.""" import pytest from langchain_core.load.dump import dumpd, dumps from langchain_core.load.load import load, loads from langchain_core.prompts.prompt import PromptTemplate from langchain_classic.chains.llm import LLMChain pytest.importorskip("langchain_openai", reason="langchain...
13f82f71b11b713b45a9b5af2a0144b8517af47b5f58f125db7a7fd1f3e19fb2
Python
6,087
143
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import numpy as np import pandas as pd import logging import argparse FORMAT = '%(levelname)s %(asctime)-15s %(name)-20s %(message)s' logging.basicConfig(level=logging.INFO, format=FORMAT) logger = logging.getLogger(__name__) def replace2na(ratio_d...
80cca1323181d17307603f0c3274e92d21f7fc86704a6a7e7bf4f4a25cc3e490
Python
6,087
180
######################################################################## # 2D diffusion on an infinite surface from point source. # AIMS: to verify STEPS spatial-stochastic solver 'Tetexact' supports # local initial conditions and calculates surface diffusion rates correctly. # STEPS equivalent model: Stochastic 2...
e24f877d41c706129ea58022d219f6cb5b5f8a6f54c13c83352d67f2dfd01bc5
Python
6,087
164
# 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...
304af82dce39f699cc715facc7ca2156d8e0f1775302c5d104e7ecfca8ab7a47
Python
6,089
130
import torch from CEL.networks.models.meta_model import ModelClass from torch.autograd import Function from itertools import chain from copy import deepcopy from tqdm import tqdm class InvariantFunc(torch.nn.Module, ModelClass): def __init__( self, y_channels: int, W_channels: i...
07a41eed4e7735bc66ee415ca8b27774d45a39c55958787c4fa2ae16f6b82395
Python
6,094
161
import pandas as pd import numpy as np from numba import jit import scipy.stats # @jit(nopython=False) def get_entropy(x): entropy_list=[] for i in sample: arr=np.array(x[i]) if len(set(arr))==1: entropy=0 else: entropy=scipy.stats.entropy(arr[arr>0]) ent...
aad6533e3ed6579f04b710a0cf116cda71c71953390a3024a116ed6bad1823bd
Python
6,094
178
"""Tests for tools defined in modules with postponed annotations.""" from __future__ import annotations from functools import update_wrapper from inspect import Parameter, Signature from typing import Annotated, Any from pydantic import BaseModel from langchain_core.tools import InjectedToolArg, StructuredTool from...
4edae7715e53647e9e45521ab783838dff2e592b793da32cdf2c14684ef2efb1
Python
6,096
225
import json import logging import os import shutil from pathlib import Path from typing import Tuple import hydra import numpy as np import pandas as pd from joblib import Parallel, delayed from omegaconf import DictConfig, OmegaConf from tqdm import tqdm from src import PROJECT_DIR from src.data.utils import CLASS_I...
24a24ad8b8402955512a7526900da8e386e0ec4c90690d52420194cfe3215d81
Python
6,097
196
import logging from typing import Dict, Optional, Tuple, Union import pytorch_lightning as pl import torch from torch import nn from torch.optim import Optimizer from torch.optim.lr_scheduler import LRScheduler from torch_geometric.nn import MessagePassing, radius_graph from torch_scatter import scatter, segment_coo ...
27f95d30c925846f187bf90b60ccc8f5d39f12570b1edde4bc73b354be3043a3
Python
6,101
180
import Bio.SeqIO as sio import tensorflow as tf import numpy as np from sklearn.preprocessing import LabelBinarizer from tensorflow.keras.utils import to_categorical import random import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import tqdm #strategy = tf.distribute.MirroredStrategy() #load model filterm = tf.keras....
51c60fbd1e66fdea9da664f14cb32e60b8b9c21058182e93569f8a5e4f09968c
Python
6,102
198
BaseDir = "R:/Temp/Threads2/Thread0" InnCurr = 150 import sys file_name = 'Cell' probeXs = [0] #um probeYs = [50] #um frequencies = [8] #Hz ampltudes = [0.0002, 0] #Hz DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz durations = [9900] #ms stopTime = [10000] #ms rangesL = [10000] #phase calculation crop limit low rang...
6f4eb646fc2fc2dc683290e50d4c129021f3c8a21e7144a7214c18954414bff3
Python
6,102
172
import argparse import numpy as np from oset.generic.lp_filter.lp_filter_zero_phase import lp_filter_zero_phase from oset.generic.tanh_saturation import tanh_saturation from scipy.signal import lfilter def peak_det_modified_pan_tompkins(data, fs, *args): """ peak_det_modified_pan_tompkins - R-peak detector b...
069c64ab24de05e96259201708a05d9458310fcfefdb7c70ad329bf7251d2ac6
Python
6,103
193
from functools import partial import numpy as np import cv2 import ast from copy import deepcopy from utils.geometry import euclidean_distance def _convert_from_string(data): for char in '[]': data = data.replace(char, '') rows = data.split(';') newdata = [] count = 0 for row in rows: ...
ae9a821a13e45382940f67849be85d7433f2c1a860ddfcd940fbcf6f3b853aab
Python
6,103
204
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import numpy as np import nibabel as nib import pylab as pl DESCRIPTION = """ Ultra lightweight 3D data viewer with - Orthoview - Slice Mosaic - Intensity Histogram """ def buildArgsParser(): p = argparse.ArgumentParser(description=DESCRIPTION) ...
fb8f0fd84e0af8464b5d1be77aa723c1806ff1f15faaabb37a718d4eb0dc14de
Python
6,103
198
BaseDir = "R:/Temp/Threads3/Thread0" InnCurr = 150 import sys file_name = 'Cell' probeXs = [0] #um probeYs = [50] #um frequencies = [30] #Hz ampltudes = [0.0002, 0] #Hz DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz durations = [9900] #ms stopTime = [10000] #ms rangesL = [10000] #phase calculation crop limit low ran...
33a3a16cc86798491c2c2dd1688382665b270b3c691c962488c1bf8ddbb2b1f4
Python
6,104
198
BaseDir = "R:/Temp/Threads1/Thread0" InnCurr = 150 import sys file_name = 'Cell' probeXs = [0] #um probeYs = [50] #um frequencies = [140] #Hz ampltudes = [0.0002, 0] #Hz DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz durations = [9900] #ms stopTime = [10000] #ms rangesL = [10000] #phase calculation crop limit low ra...
9a1d6c450afdef2cb62abb29802305ea3eaa24aaf409a62a9e41e2c72d096d32
Python
6,104
198
BaseDir = "R:/Temp/Threads4/Thread0" InnCurr = 150 import sys file_name = 'Cell' probeXs = [0] #um probeYs = [50] #um frequencies = [8] #Hz ampltudes = [0.0002, 0] #Hz DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz durations = [19900] #ms stopTime = [20000] #ms rangesL = [10000] #phase calculation crop limit low ran...
f572a22a6bdfa9a95bf9d1ca01f43a0484c32ec646cc80a843d48b660d30d7f3
Python
6,105
198
BaseDir = "R:/Temp/Threads5/Thread0" InnCurr = 150 import sys file_name = 'Cell' probeXs = [0] #um probeYs = [50] #um frequencies = [30] #Hz ampltudes = [0.0002, 0] #Hz DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz durations = [19900] #ms stopTime = [20000] #ms rangesL = [10000] #phase calculation crop limit low ra...
5c749404b8fa0835633e9f4d7b79c8ff5a1a0115e30d2c7bafa8687131850de5
Python
6,106
198
BaseDir = "R:/Temp/Threads6/Thread0" InnCurr = 150 import sys file_name = 'Cell' probeXs = [0] #um probeYs = [50] #um frequencies = [140] #Hz ampltudes = [0.0002, 0] #Hz DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz durations = [19900] #ms stopTime = [20000] #ms rangesL = [10000] #phase calculation crop limit low r...
f6fcefba195ef9ad5b2c6a6d60aa43e60e5b1aad3c374b6eb3931ea934cf139a
Python
6,109
142
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Phase-difference B0 estimation. .. _sdc_phasediff : Phase-difference B0 estimation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The field inhomogeneity inside the scanner (fieldmap) is proportional to the phase dri...
a0eac380e0e6e6684db5bd94e949602051f6f2573c061f7c6213172a1f341b79
Python
6,110
227
import torch import torch.nn as nn import torch.nn.functional as F from util import Conv2d class MultiResBlock(nn.Module): def __init__( self, in_channels, out_channels, res_channels, base_kernel_size, stride=1, res_scales=1, drop=0.25, dila...
05eb8f768744401757e5f9e610a7cec40198dd1c629d403807a4036d14d229de
Python
6,111
192
import argparse import math import numpy as np import torch import torch.nn as nn # code is adapted from https://github.com/yulunzhang/RCAN/tree/master class Upsampler(nn.Sequential): def __init__(self, conv, scale, n_feat, bn=False, act=False, bias=True): m = [] if (scale & (scale - 1)) == 0: ...
0aac731321675e1b28e35c4ef6305c96e7b95acc86314daaf45fc20a4381caed
Python
6,111
164
import os import numpy as np import logging import json import time import matplotlib.pyplot as plt base_setting = { 'train_size': 0.8, 'epochs': 100, 'input_size': 60, 'batch_size': 32, 'pre_len': 1, 'fileName': "", 'model_name': 'lstm', 'checkpoint_root_dir': './che...
bc925a1f0f042c98cf5d17697b1379cfec74245c12058fbaa8bfbf2f4481b905
Python
6,111
181
import copy import requests import urllib.parse import numpy import pycilium.cilia expected_annotations_lower_to_limit = { "base": 1, "tip": 1, "exit": 1, "d_cent": 1, "vesicles": None } def state_from_ngllink(link, request_params={}): if link is None: return None parsed_uri = u...
a95a2e5f69c1e6969479e68f3cf29b4e7c81be97ae03171eb833b2f7498e82e2
Python
6,112
119
"""Verify a locally compiled runtime without requiring a full FreeSurfer install.""" from __future__ import annotations import argparse import json import os from pathlib import Path, PurePosixPath import re import shutil import subprocess from postprocessing.core.config import COMMANDS, FS_REVISION, default_prefix, ...
68c8aba3b5d97aa36a9329cc4049910dd739980ea75fe861c8c7a13ac1b043b4
Python
6,113
154
# python program for diffusion simulations # import packages import time import random import numpy as np import pandas as pd import scipy # import user defined packages import read_input import write_output import write_log import preprocess import convert_image import predict_diffusion_barriers import KMC def mai...
7bee9ebbfed0c84862bfdcea7ae7d9207f13c93f89f2c50455db805ec3ec4b3e
Python
6,113
127
"""Native scalar export preserves values, image geometry and independent outputs.""" import json from pathlib import Path import tempfile import unittest import nibabel as nib import numpy as np import SimpleITK as sitk from preprocessing.export import SCALARS, export_native def make_native_cache(root, trace=True):...
b973cf55180b45eb15091c5ae9f599400774a106a3f33b08f6b370ea0567c333
Python
6,116
187
import os import pickle as pkl import numpy as np import pandas as pd from moabb.paradigms import MotorImagery from moabb.datasets import Cho2017, PhysionetMI, BNCI2014001 from braindecode.datasets import BaseConcatDataset, create_from_X_y # --------------------------------------------- # task 1: sleep stage # -------...
1e237e0f699ccc20761a021c5f5830b262291e5481503da22da56028d1ffc389
Python
6,118
175
import Bio.SeqIO as sio import tensorflow as tf import numpy as np from sklearn.preprocessing import LabelBinarizer from tensorflow.keras.utils import to_categorical import random import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import tqdm #load model filterm = tf.keras.models.load_model(os.path.join(os.path.dirnam...
4fcb78b9c35798d62994527ff71ba7540dfc92ed276ca48d5f86ec518ee2225b
Python
6,119
195
import glob from os.path import dirname, basename, isfile, join modules = glob.glob(join(dirname(__file__), "*.py")) __all__ = [basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')] from . import * # from .rd import ReactionDiffusion # from .wave import DampedWaveEquation # from .pendulum...
101171aef4cda232d75c8e75ee91018005d0ff6b991cec0c30655e1582bd29f1
Python
6,128
190
""" ############################################################################## # # Calculate motif's activity differences Zscores # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREATED: 20-01-2020 # LICE...
049b13ca2749db34d5c5879ab7ae7e3011ccddc5c1b4fd9e342e1616ccd085ff
Python
6,129
170
import pandas as pd from sklearn.metrics import confusion_matrix, accuracy_score, precision_score, recall_score, f1_score import numpy as np def getstat(confusion_matrix): # 计算真正例(True Positives) TP = confusion_matrix[1][1] # 计算真负例(True Negatives) TN = confusion_matrix[0][0] # 计算假正...
cd771d1cb366507d27d3a49889a4ab0ca266867dcf030a42f03adabc74c8a0c1
Python
6,131
125
"""Compare decoded postprocessing payloads, ignoring path/time text in headers.""" from __future__ import annotations import argparse from pathlib import Path import nibabel as nib import numpy as np from utils.files import atomic_json, sha256_file SURFACES = ('white', 'pial', 'orig', 'smoothwm', 'inflated', 'sphe...
57cc78f376a9a722b58f4d9651fd02959280cf123a7f645ccb54ec7d94f6d9ca
Python
6,133
201
#################################################################################### # # 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...
2e1555dc7cf5adb1402d3e98dbfdcc9722bdf43b7c22f892b288ba91569a174d
Python
6,134
201
#################################################################################### # # 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...
ed8f22d46b8004adf07692e8882365c2b765877f314126d82e95852c262119e2
Python
6,134
136
import glob import os import pandas as pd import seaborn as sns class nebula: from .MultipleVisualization import barplot from .MultipleVisualization import circos_plot from .MultipleVisualization import circular_term from .MultipleVisualization import diff_reg from .MultipleVisualization import d...
9026672d98ef269944875a5f475dca1ac63bdf91885e754a4ac7a4fe5cd1f2b2
Python
6,136
146
# 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...
28d213ee6d922d7dbfa2ef8d9b5e0f5236a3373e66c61a95af1b3b602609101a
Python
6,138
125
#################################################################################### # # 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...
a765c1ce502e8ef2e86e4b2f3bf5e58c26ea7b5930647a7287dc7c6b46053531
Python
6,138
178
"""An agent designed to hold a conversation in addition to using tools.""" from __future__ import annotations from collections.abc import Sequence from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks import BaseCallbackManager from langchain_core.language_models import Base...
e0fa096974e90818e32ca943ecd908f6b8a41fa3c85afefc91145d13ee3f9572
Python
6,139
181
# original implementation: https://github.com/odegeasslbc/FastGAN-pytorch/blob/main/models.py # # modified by Axel Sauer for "Projected GANs Converge Faster" # import torch.nn as nn from pg_modules.blocks import (InitLayer, UpBlockBig, UpBlockBigCond, UpBlockSmall, UpBlockSmallCond, SEBlock, conv2d) def normalize_sec...
2c720e423773c1b48b59f83a6e3c44f0797253f240b858488f3adc97170cab9c
Python
6,140
206
### Toy example to test Conv3dConnection (the dataset used is MNIST but with a dimension replicated ### for each image (each sample has size (28, 28, 28)) import argparse import os from time import time as t import torch from torchvision import transforms from tqdm import tqdm from bindsnet.datasets import MNIST fro...
a8f2750110d85b5752fb13de20c56d1b2c1a16cc7f37c4e74661294b91842a81
Python
6,141
143
import shutil import tempfile from pathlib import Path from MRdataset import import_dataset, save_mr_dataset, load_mr_dataset from MRdataset.config import MRDS_EXT from mrQA import check_compliance from mrQA.parallel_utils import _make_file_folders from mrQA.run_parallel import process_parallel, split_folders_list fro...
6049ba42e91a357ff3804a3ddf6a10e293d104f7854836c6bc5a4a104c3ff369
Python
6,143
181
######################################################################## # 2D diffusion on an infinite surface from point source. # AIMS: to verify STEPS spatial-stochastic solver 'Tetexact' supports # local initial conditions and calculates surface diffusion rates correctly. # STEPS equivalent model: Stochastic 2...
e67cd81fe3b86cd3d4cd908ee177b9a9924041b31216618b7617cfc40ab3c59c
Python
6,145
189
#################################################################################### # # 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...
bd36d22090cf928864061fb7fecd42dda35e5294e4a3c0ef49e45406132d5a94
Python
6,146
185
######################################################################## # 2D diffusion on an infinite surface from point source. # AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports # local initial conditions and calculates surface diffusion rates correctly. # STEPS equivalent model: Determinist...
3ad953022c8b072393da2f93b190c2605bdb42f83c88ce8b6cd02cccc595100e
Python
6,147
167
import logging import os import numpy as np import pandas as pd from helpers.data import normalize_array, assert_normalized def save_synthetic_dataset( config_dict: dict, covariance_structure: np.array, dataset_name: str, synthetic_data_dir: str, white_noise_snr=None, hcp_noise_snr=None ) -> None: ...
99065d91e2230c79fd2edda4ec37c43633af5f14bcec242f02154622230aa98d
Python
6,148
145
from typing import List, Union, Tuple from functools import reduce import numpy as np from rdkit import Chem import torch import torch.nn as nn from HMSA.args import TrainArgs from HMSA.features import BatchMolGraph, get_atom_fdim, get_bond_fdim from HMSA.nn_utils import index_select_ND, get_activation_function import ...
00163f8ff974eb798acb8dc555dc5ff01a43b4dcd57f26d4365cc3130bf54ed9
Python
6,150
70
from langchain_core.prompts.prompt import PromptTemplate EXAMPLES = [ """Question: What is the elevation range for the area that the eastern sector of the Colorado orogeny extends into? Thought: I need to search Colorado orogeny, find the area that the eastern sector of the Colorado orogeny extends into, then find...
1d7e7614ff6fa9a84233ffca44af7e1458c779bf1190db077c02a30b161f3192
Python
6,150
155
#!/usr/bin/env python # coding: utf-8 import numpy as np import matplotlib.pyplot as plt from skimage.io import* from scipy import ndimage as ndi import napari from skimage.morphology import* from skimage.segmentation import* from skimage.measure import* import seaborn as sns from sklearn.linear_model ...
1390d6e46ce31667cda0ebbc6aae3014935d52b3e91f7d84b7ee0b16791f44f4
Python
6,152
226
import numpy as np from tensorflow.keras import Model from tensorflow.keras.layers import Input, GlobalMaxPooling2D, \ GlobalMaxPooling3D, MaxPooling2D, \ MaxPooling3D from explainability.layers import MaxPoolingLRP def test_maxpool_2d_lrp(): ...
632844b3b55c045b0fd0e9b7275f8ef8d69fb28670ed218488f49db83d3e01de
Python
6,152
191
import torch from torch_geometric.loader import DataLoader from torch_ema import ExponentialMovingAverage import logging import numpy as np from prettytable import PrettyTable from config import build_arg_parser from dataset.Pyg3BPA import Pyg3BPA from dataset.Preprocess_3BPA import Preprocess3BPA from eval import ev...
adac2ad4eab242720f74a6800d5546092ed83f2d7e3e1a4a7c92691d621d3134
Python
6,155
141
# third party modules import numpy as np # pnabind modules from pnabind.utils import segmentsIntersectTriangles def getClassSegmentations(edges, labels, faces=None, area_faces=None, merge_nearby_clusters=False, vertices=None, merge_distance=10.0, ...
44b4de8b82d02f5934eeb78b7bb6f6b214f611a6f8edb262f78c3035e3cc8500
Python
6,157
131
import numpy as np from sklearn.linear_model import LogisticRegression, PoissonRegressor from sklearn.utils.class_weight import compute_sample_weight from sklearn.exceptions import ConvergenceWarning import warnings import csv def LoadLingFeatures(args,feature_name): #Load linguistic features with open(f'data/...
226b7aa55a93b7aeeab9e33ed19b70af9821b3e0fc1a93678e4ca70e69419b59
Python
6,158
209
from langchain_core.utils.html import ( PREFIXES_TO_IGNORE, SUFFIXES_TO_IGNORE, extract_sub_links, find_all_links, ) def test_find_all_links_none() -> None: html = "<span>Hello world</span>" actual = find_all_links(html) assert actual == [] def test_find_all_links_single() -> None: h...
e615111b2fa31ae29f7b1b2954a3b521460d2f148dc413684a1bcf0acb2d3d60
Python
6,158
141
from graph_tool.all import * import sys import numpy as np # file_location = "/mnt/e/LabMembers/yt/HB438/20220824_tubemap_newilastik/graph_annotated.gt" # out_mat_file = "testing.mat" file_location = sys.argv[1] out_mat_file = sys.argv[2] print(file_location) print(out_mat_file) grr = graph_tool.load_graph(file_lo...
1a94d2114fe27e640e1d25a09217366fb347d987d259ec50d219c63e4d790b1d
Python
6,159
149
import numpy as np import networkx as nx import torch as pt import pytorch_lightning as ptl import torch_geometric as ptg import torch import xgi from torch.nn import Sequential as Seq, Linear, ReLU from torch_geometric.nn import MessagePassing from pytorch_lightning import LightningModule from torch.optim.adam import ...
ed408e25ead212df4fab7c9a35ba09be360868bcda493a8b162581a6dafcd4c4
Python
6,160
119
""" Simulate the noisy delta rule model and perform the same analyses of the apparent learning rate as for subjects (analysis around change points, and modulation by the normative model's cpp and uncertainty). """ import data_analysis_utils as dana import itertools import learning_rate_around_cp_group import learning_...
fa86476f7a58fd7c9268d3f2b41d0c71939da1a0c88c326fb95e7ec579735377
Python
6,161
189
#################################################################################### # # 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...
a093bb15d6d7fea1029dd77505b5e30fb788301a50bdc94d6e06381edf3f5d0d
Python
6,163
185
######################################################################## # 2D diffusion on an infinite surface from point source. # AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports # local initial conditions and calculates surface diffusion rates correctly. # STEPS equivalent model: Determinist...
b37007e6cf8e8d86d2784be7e8b9f7955032596e435949143231aa356bf55981
Python
6,167
148
""" Functions for various imaging related processing tasks. """ import os from typing import Union import numpy as np from imagingplus.main.core import ImagingTrial from imagingplus.utils.utils import points_in_circle_np def normalize_dff(arr: np.ndarray, normalize_pct: int = 20, normalize_val=None): """ ...
0181fc5089f4701a5c882081801070691b027193a19649ef165590047dfa7fa7
Python
6,169
160
''' intervalannotation.py - Tasks associated with annotation of genomic intervals ===================================================================================== ''' import shutil import os import sqlite3 import cgatcore.iotools as iotools import cgat.IndexedGenome as IndexedGenome import cgat.Bed as Bed from cg...
7b6f4a93f17cc42f02ce7e49655a4e9ae4bd861cc5cd47c1ffbf276677c341c0
Python
6,171
161
import torch import numpy as np import torch.nn as nn from warnings import warn from copy import deepcopy from odl.tomo import fbp_op from dliplib.reconstructors.base import BaseLearnedReconstructor from dliplib.utils.models import get_unet_model class FBPUNetReconstructor(BaseLearnedReconstructor): HYPER_PARAM...
f093b1a24c67b55d4492306533bedf04ab31d88c53c3b2e0a7a5a5ff187c6735
Python
6,171
174
""" Analyze learning rates locked around change points at the subject level. """ import argparse import data_analysis_utils as dana import matplotlib.pyplot as plt import matplotlib.ticker import numpy as np import os.path as op import plot_utils as plut import scipy.stats FNAME_PREFIX = "learning-rate_around_cp" # ...
d46b404af2df4d6ad5e737c607d94b02dfcc76ea297180fecdf209148c644fdf
Python
6,175
158
import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.use('agg') import pandas as pd import os, sys from mantis_ml.config_class import Config from mantis_ml.modules.unsupervised_learn.dimens_reduction import DimensionalityReduction import warnings warnings.filterwarnings("ignore", category=De...
fdc2ed1354ca90ab403f8d193e25ee34e1b28d263374b2cc0aab53ed9ec0fe95
Python
6,177
170
import sys;sys.path.append('../src') import pylab from simulate_experiment import get_simulated_data import spiketools from GeneralHelper import ( find, nice_figure, ax_label1, simpleaxis, ax_label_title ) import scipy.stats as ss from reaction_times_functions import ( reaction_time_plot, get_reaction_...
421706f73e47bf5d2267cd2be7df22d6e8e4578ea2948790fc0edc742bcfd0cf
Python
6,180
148
from .combinators import * from .categories import Category class Grammar: def __init__(self, max_fwd_B = 2, max_bck_B = 1): self.max_fwd_B = max_fwd_B self.max_bck_B = max_bck_B self.unary_normal = [ TypeRaising( # for topicalization, not used by EasyCCG, but used by C&C an...
7e3e1d60cdb584964b8cc1c0a2585a23b3e6b5793af301cbc0828db33bf1d4a6
Python
6,180
180
""" Test util functions """ __author__ = 'John D. Chodera' import os from perses.utils.openeye import smiles_to_oemol from unittest import skipIf running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true' # functions testing perses.utils.data @skipIf(running_on_github_actions, "Skip: running on ...
fbf25cd1e93c5e149c4a527f2383db96133ddf9c3a3cfc9b90e2eac80e294d6b
Python
6,183
187
#!/usr/bin/env python3 import argparse import copy import os import re import subprocess import pathlib import pandas as pd import yaml import collections.abc def update_dict_recursively(d, u): for k, v in u.items(): if isinstance(v, collections.abc.Mapping): d[k] = update_dict_recursively(d....
9f68f5246aa35e8829b90fe111d974b4c65496e386833a4e40d367d74dcaac1c
Python
6,186
203
""" This is a modified version of ns_2d.py from https://github.com/zongyi-li/fourier_neural_operator """ import torch import math from random_fields import GaussianRF from timeit import default_timer import scipy.io import argparse import os from tqdm import tqdm #w0: initial vorticity #f: forcing term #visc: ...
bbe882900c3ecab97d1c2b6af7e72c4474d2a0374e02de5d2a773052edf79dcd
Python
6,186
176
import warnings import numpy as np import torch from torch import nn as nn from torch.nn import Parameter from torch.nn import functional as F from .base import Readout class Pyramid(nn.Module): _filter_dict = { "gauss5x5": np.float32( [ [0.003765, 0.015019, 0.023792, 0.01501...
988731bda4019f20861edfd82bb9bf2699973fd34de040ce1976621b488b8cc7
Python
6,188
202
import torch import torch.nn.init as init from torch import nn from torch.nn import Parameter from torch.nn import functional as F from torch.nn.init import xavier_normal # ---- general RNN core cell class RNNCore: """ RNN Core taken from: https://github.com/sinzlab/Sinz2018_NIPS/blob/master/nips2018/architec...
e17821f71d7a33164da543ca5cd4dccef0d8e83cf4365eb0efa0d9f6c110e843
Python
6,189
223
#!/usr/bin/env python3 """ Create CSV of node coordinates from Harvard-Oxford atlas regions in 1mm MNI152 (FSL) space AUTHOR ---- Mike Tyszka, Ph.D. LICENSE ---- MIT License Copyright (c) 2019 Mike Tyszka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated d...
8e01b1c0bd970471e0fd36aaca7e647360da705120804dd5a0f755101a2d7b35
Python
6,193
203
import logging import matplotlib.pyplot as plt import numpy as np import torch from torch import nn as nn from torch.nn import functional as F logger = logging.getLogger(__name__) def elu1(x, inplace=True, eps=0.0): return F.elu(x, inplace=inplace) + 1.0 + eps class Elu1(nn.Module): """ Elu activation...
20eab67726633d9de6d6795df1a73ca2e026fa508b67fb56fc1f8dfc56556f5f
Python
6,194
186
import os from net_utils import load_from_file import plotting import matplotlib.pyplot as plt #root = '/Users/danil/Desktop/Habanero/vary_Nh_noMultiRep/' #root = '/Users/danil/Library/Group Containers/G69SCX94XU.duck/Library/Application Support/duck/Volumes/habaxfer.rcs.columbia.edu – SFTP/vary_Nh_noMultiRep' ...
ef15689de5762b66045acd04a64a9b68ee8b4d9389d8fea22afda0ab9c905b9c
Python
6,195
200
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
dd898fd0ae656e54d09c0fbc7616ced12ce9de4c5f9aa4cbb29faf92af913bca
Python
6,200
251
import argparse import os from time import time as t import brian2genn import matplotlib.pyplot as plt import nengo import numpy as np import pandas as pd import torch from brian2 import * from experiments import ROOT_DIR from experiments.benchmark import plot_benchmark from nest import * from bindsnet.encoding impor...
2e020f92c7c51c766dfc1fea226120bbbe76298b2f7eb5e27c83ec01b76c4a7f
Python
6,202
187
""" Neural network implementations and utilities. """ import sys import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import r2_score from sklearn.metrics import mean_squared_error def train(network, train_data, val_data, n_epochs=1, batch_size=1024, o...
29574d5187a5ad75814cff5f1b1e110f8890816dfa4d0c53b482f835227db566
Python
6,204
162
import numpy as np import copy import glob import pickle gly_CB_mu = np.array([-0.5311191 , -0.75842446, 1.2198311 ]) #pickle.load(open("pkl/CB_mu.pkl", "rb")) def get_len(v): return np.sqrt(np.sum(v ** 2, -1)) def get_unit_normal(ab, bc): n = np.cross(ab, bc, -1) length = get_len(n) if len(n.sha...
9d7b358cdf6344706b8c324fd7e718038a0a72293929d39e1d02a3b3d2585b3d
Python
6,204
195
# If your training data has different scaling than your test data, pay attention to _parse_scales below. import os import re import glob from xml.etree import ElementTree import logging import numpy as np import czifile from skimage.external import tifffile #import javabridge #import bioformats #javabridge.start_vm(c...
75b3dabbed20bfdf4636270e262282bfb31afade53ca65ac6487a8805a01e382
Python
6,205
198
# 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...
9913d230bc4d3cf33f5ce47dcaa48c14c2e8b1d4ec6ecb261ef2fb3c241f5244
Python
6,206
160
from functools import partial from typing import Union from flax.struct import dataclass import jax import jax.numpy as jnp @dataclass class EnvParams: max_steps_in_episode: int = 256 radius: float = 4 # Radius of the cell (μm). n_receptors: int = 8 # Number of discrete receptors along surface. spe...
85a3f9930790efd1fb933a3918ee9c226995d8f8197cdc83fac311188530486c
Python
6,207
168
# -*- coding: utf-8 -*- """ Created on Sun Apr 28 16:22:04 2019 @author: nishe """ import numpy as np from connection import coordination #%% def fix_indegree(lattice_src, lattice_trg, degree_in_trg, tau_d, width, src_equal_trg = False, self_cnt = False): #%% N_src = len(lattice_src) N_trg = len...
b633568770afbb178f8defa0f1f8769811b50dc788c5ed25b76552a2be200c8b
Python
6,207
149
import numpy as np from matplotlib import pylab as plt import argparse import os, sys, glob import pandas as pd import seaborn as sns if not os.path.exists('results/final_results/'): os.makedirs('results/final_results/') dir_final_res = 'results/final_results/' def errors_ae_don(latent_dim, method, reps, ...
56826965530e8ff2a0bbdb9394b622a761e65d7d49df3c98cfca299e9636393f
Python
6,211
178
""" Test storage layer. """ __author__ = 'John D. Chodera' ################################################################################ # IMPORTS ################################################################################ import os import os.path import tempfile from functools import partial from perses.s...
fb833d3b7931b5ef7015a7fa6db49578966b9d193dbb2ac2963283aafdc7fd1d
Python
6,212
177
# 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...
4609cfe07e31cd4bdacb870e6550b88b292d0d34b2b561c1dc2ea719f5249214
Python
6,213
206
import logging import os import socket import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from configs.configs import get_config_dict from helpers.figures import set_size from helpers.rockland import get_edges_names def _plot_glm_beta_heatmap( config_dict: dict, betas_df: pd.DataFrame...
96e939f2cfcaebf4f9663795dad65dd0de45ae93323fdd7e9025b92f4d399a0c
Python
6,215
147
import sys import os import os.path import numpy as np import scipy.stats as stats import random genes={} e={} EXTEND=int(sys.argv[1])#######the distance flanking loop anchor to be consider kind=sys.argv[3]########Protein coding gene or all genes rootdir='.' rsemdir='/scratch/users/txie/RNA-seq/3rsem_out/'...
f4125a576430b8fcd690bb9735c3497433b3d5a0d374a37b7459c2a5d26a2db2
Python
6,218
217
''' Example for the preprocessing functions on a 2D example. :Version: 1.0 :Date: 06.06.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribu...
8b2d92e1183d34e12ce7e558498dfdebc203b2397335372e632c3a7f0eab00e6
Python
6,220
169
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from dataclasses import dataclass from typing import Optional, Tuple import torch @dataclass class PDEDataConfig: n_scalar_components: int n_vector_components: int trajlen: int n_spatial_dim: int def create_data2D( n_input...
fcdf1e273af6ab14940dff0bca7c6c31a49a50cf42ae69fea74327866a34c86b
Python
6,221
159
import pandas as pd import matplotlib.pyplot as plt import numpy as np from matplotlib.backends.backend_pdf import PdfPages #pvalb spikrate = pd.read_csv('../PvalbA_140Hz_AllHOF/Results/xxs.csv') current = pd.read_csv('../PvalbA_140Hz_AllHOF/Results/crnts.csv') veclengs = pd.read_csv('../PvalbA_140Hz_AllHOF/Re...
b21dee3908d90ff4f53b0b16a5663703c8cba871725cdcea3bd18b55ebe85c5f
Python
6,222
172
"""Compute conn (PID | II) + stats per condition in the time domain. This script can : - Compute connectivity metrics like conn_pid and conn_ii - Perform RFX-contacts on ii (two-tailed), redu | syn | redu - syn | syn - redu (one-tailed) - Computations are performed within conditions (i.e. rew | pun) - Significance t...
5f14c62b49a1d8023f8716e21cd7ffc3d7320bdf8db9ca5830c3ffa13fe7f506
Python
6,224
114
import pandas as pd import matplotlib.pyplot as plt import numpy as np import matplotlib.ticker as ticker from scipy import stats # define full list of constructs tested proteins =['GRA16-HA-MECP2', 'GRA16-HA-TFEB', 'GRA16-HA-SMN1', 'GRA16-HA-ASPA', 'GRA16-HA-ASPAopt', 'GRA16-HA-GALC', 'GRA16-HA-GALCopt','GRA16...
a5a19f05fe0e973a32f0cd2da18fd1066edf9d55905c2cbdbff157257c10e4a2
Python
6,225
159
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 from utils.utils import save_test_duration class Classifier_INCEPTION: def __init__(self, output_directory, input_shape, nb_classes, verbose=False, ...
4ee819d766f6e8ab893ae1bd03c3feba30ba5645281eea7024cdc52a0acfd7bb
Python
6,231
188
#################################################################################### # # 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...
ed13be34f614ec68a9bb42c987293e8714dfdefde4b3e53c3e20dca135efbd34
Python
6,234
178
""" ############################################################################## # # Filter out values in the exon inclusion table for the subsequent # MARA model. Also, change the exon coordinates system from GTF to BED. # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institu...