sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1837fbea52e522fa12ce403924d074cabfdacaeaea4ca05f062a403080a83459
Python
3,623
107
targetMean = 140 targetStd = 5 initStep = 0 import pandas as pd resultsMean = [] resultsStd = [] for i in range(40): base_name = 'R:/Temp/Threads3/Thread'+str(i)+'/Simulation/output/Data.csv' df = pd.read_csv(base_name) if df.iloc[0,0]>1000: resultsMean.append(0) else: resultsMean.appe...
ef64b47e3851e622f1f219051719faa5519196a0b4c1ec03b74fe5ec14c1e713
Python
3,624
104
import pandas as pd import numpy as np # read all xlsx files in the folder list_intensities = [] for batch in ["Batch1_0108 DATA.xlsx", "Batch2_0110 DATA.xlsx", "Batch3_0124 DATA.xlsx", "Batch4_0219 DATA.xlsx", "Batch5_0221 DATA.xlsx", "Batch6_0304 DATA.xlsx", "Batch7_0306 DATA.xlsx"]: intensities = pd.read_excel(...
c42dcbb213212149940d8330ab4af6a796355ca1e6cde00180fac2153378c0e1
Python
3,626
100
"""Callback Handler streams to stdout on new llm token.""" import sys from typing import Any from langchain_core.callbacks import StreamingStdOutCallbackHandler from typing_extensions import override DEFAULT_ANSWER_PREFIX_TOKENS = ["Final", "Answer", ":"] class FinalStreamingStdOutCallbackHandler(StreamingStdOutCa...
785d504ee79880866844490e4afcc765ce1cb75b8f15599ecfa92ba76c37c800
Python
3,627
105
"""Test the criteria eval chain.""" import pytest from langchain_classic.evaluation.criteria.eval_chain import ( _SUPPORTED_CRITERIA, Criteria, CriteriaEvalChain, CriteriaResultOutputParser, LabeledCriteriaEvalChain, ) from langchain_classic.evaluation.schema import StringEvaluator from tests.unit...
d1e29b6655722fbf5587f7dc3e23680832dc74c010f6e5cdd8e4cd06a010e0f6
Python
3,628
119
import asyncio from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever class MergerRetriever(BaseRetriever): """Retriever that merges the results of mult...
301e234858510fef9ac033072ae0f1a37aa499830d3615afc89ddbc5cdada57d
Python
3,631
106
import numpy as np from pnabind.utils import oneHotEncode from .get_atom_kdtree import getAtomKDTree def mapPointFeaturesToStructure(points, atom_list, features, feature_names, kdtree=None, reduce_method='sum', impute=False, impute_value=0.0): if features.ndim == 1: features = features.reshape(-1, 1) ...
595fccf66aff31bcfeae6734f535a9bb804d01c3ec5439f463d7d1b491613858
Python
3,631
121
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: animalai/communicator_objects/vector_proto.proto import sys _b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from g...
3e99931ed8fef4fab0934a258d3d647de1dc52d761e01516f578e7af2fddc592
Python
3,636
97
import pandas as pd import numpy as np import scanpy as sc import time dt_dir = "" import cell2location import matplotlib.pyplot as plt sc.set_figure_params(dpi_save = 600,figsize=(15,15),fontsize=45) import datatable as dt #%% import ref sc data sc_data_ref = pd.read_csv(dt_dir+"sc_ref_hippo.csv",index_col=0) sc_data...
49b57123cf0e2b2ef3eb57afae8739483d437f6ad0b9a8ae89d6094fa36a7875
Python
3,636
63
# 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...
4ec0076dc9df886ffb2846c7b17582084a395f9ec69d77b58abe31195ac12890
Python
3,636
103
from multiprocessing import Pool import numpy as np import pandas as pd from sklearn.linear_model import LassoLars from sklearn.preprocessing import StandardScaler from sklearn.base import clone from sklearn.model_selection import ParameterSampler from sklearn.metrics import roc_curve, auc, accuracy_score, f1_score ...
a81ab5f9072b9766e69f86d40c5337bdb8cebc439b6c53b7a76eac3024f93ed5
Python
3,637
116
# -*- coding: utf-8 -*- from __future__ import print_function, division import torch import torch.nn as nn class SEBlock(nn.Module): def __init__(self, in_channels, r): super(SEBlock, self).__init__() redu_chns = int(in_channels / r) self.se_layers = nn.Sequential( nn.Adapti...
efebed1fd446c6f71b82dcb44eed064c8ea59ba6b4c33178f569d369608cd272
Python
3,637
114
"""Test conversation chain and memory.""" from langchain_core.documents import Document from langchain_core.language_models import FakeListLLM from langchain_classic.chains.conversational_retrieval.base import ( ConversationalRetrievalChain, ) from langchain_classic.memory.buffer import ConversationBufferMemory f...
14440ccf38960cf7079e82b12b46d0041815fd288cb2057b0f670dc0959d8a3a
Python
3,638
107
import tensorflow as tf from keras import backend as K from dipgnn.utils.register import registers from dipgnn.trainers.base_trainer import BaseTrainer def R_squared(y, y_pred): residual = tf.reduce_sum(tf.square(tf.subtract(y,y_pred))) total = tf.reduce_sum(tf.square(tf.subtract(y, tf.reduce_mean(y))...
dfe8f9973972f8ad916f310dd0ec9b62d89c0cff8571961492d70cb8b854f478
Python
3,638
105
#!/usr/bin/env python3 import argparse import numpy as np import nibabel as nib from time import time from dipy.data import get_sphere from dipy.reconst.csdeconv import odf_sh_to_sharp from dipy.reconst.shm import calculate_max_order from shconv import convert_sh_basis from _sharpen_parallel import odf_sh_to_sharp_p...
4465d324fe5c0f2b44d4835b06ee78ac18752688f6f4650a71b951ea8b235538
Python
3,640
80
import os import random import torch import shutil """ This code generates a sub dataset containing around a given number of labels (e.g. 100) and only two labels randomly (e.g. 0 and 2). This dataset aims to evaluate Svetlana's ability to predict accurately being trained on a tiny dataset. """ # Votre dictionnaire...
860e64e0836902caa74cdd6ca25610d7286a43ae6b1ac4c90848e3da406aaa60
Python
3,640
100
import torch from torch import nn def single_modified_forward(self, x_input: torch.Tensor) -> torch.Tensor: """ Modify forward pass of the model """ x_input = self.features(x_input) return x_input def single_dense_modify(model): """ Add linear and dropout layers to final classifier laye...
b8984d196f756e103f86bb0812b0e4bc164ae4764e5a0cc719c2ec954ba07ce0
Python
3,641
85
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function import os import numpy as np import joblib from .data import DataHub from .models import NNModel ...
431c2b87bbd7c533e25d1fd9a263d299dbbdf2691f8d632eaa10730a262da61d
Python
3,644
98
import json from json import JSONDecodeError from langchain_core.agents import AgentAction, AgentActionMessageLog, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.messages import ( AIMessage, BaseMessage, ) from langchain_core.outputs import ChatGeneration, Generatio...
ff4872a17c801f7b2fc5585aca25de6759b4ccb9ed50d2231b7d8ef43d7987fd
Python
3,646
116
"""Core language model abstractions. LangChain has two main classes to work with language models: chat models and "old-fashioned" LLMs (string-in, string-out). **Chat models** Language models that use a sequence of messages as inputs and return chat messages as outputs (as opposed to using plain text). Chat models ...
393240eb3ebf60ec7dfceecff5dae381f4a2438d91a1d82d0a8f7b179b05e41c
Python
3,647
131
from EPI_MRI.Regularizers import * from optimization.EPIOptimize import * class Preconditioner(ABC): """ Defines structure of a preconditioner object. All Preconditioner objects have method to build and evaluate using preconditioner. """ def __init__(self): pass @abstractmethod de...
ff00bbd91a59ecd17bcf200e30a3551b204725772902a2ccd02f97899def768f
Python
3,647
101
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is 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...
07885157501dffbdb36056ad389b115e9b0bd1395ab75167d1219e1a2a2236af
Python
3,649
128
import pickle import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import figure_config # noqa: E402 mpl.rcParams.update(figure_config.mpl_style) def adjust_rate_scale(r): return 2.5 * r if __name__ == "__main__": with open(f"../data/fig8/res.pkl", "rb") as f: res = pickl...
09b120604e05f2b17c4fcfcc7cd7eb7cf97091d8e8752e491bb36c024dc5bd6f
Python
3,649
96
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 6 22:24:58 2021 @author: athanasiadis """ import numpy as np def computer(att_res,global_clusters_indices,subs_ids,meaned_clusters_indices): """ computer ______________________ This is a function that computes the gravity c...
1b7fe7c19a57fa53bef7b7efca665b1f4628d0af55962b7cdd7938c62e2e3665
Python
3,650
60
import pandas as pd import numpy as np import re import argparse def get_data(reference_path,rawdata_path,save_path,cancer): data_ID=pd.read_csv(rawdata_path+'/'+cancer+'.DNAmethy.csv',sep=',',usecols=[0]) data_ID.columns=['ID'] CPG_id=pd.read_csv(reference_path+'/HM450.hg38.manifest.gencode.v36.tsv',sep=...
29ae2528534cdd010c57a77dbc0cf8cd11c2bce43c5f753f77d723f27b902b81
Python
3,650
129
import numpy as np import os os.path.dirname(os.path.abspath(__file__)) current_path = os.path.dirname(os.path.abspath(__file__)) from NeuronModel import integrate_and_fire, izhikevich, integrate_and_fire_MSN import InitFunctions params_MSN_Yim = { 'init': InitFunctions.dirac(-80.), 'tau': 200. / 12.5, '...
3673ddcf14d9e290ff595bf2fcaebb14e47487472885736fe0a5c79e7a716feb
Python
3,650
99
"""Memory used to save agent output AND intermediate steps.""" from typing import Any from langchain_core.language_models import BaseLanguageModel from langchain_core.messages import BaseMessage, get_buffer_string from typing_extensions import override from langchain_classic.agents.format_scratchpad import ( for...
b659e808f481cce691c0ccea5690981bfa4c4ded081b3326a484b099b0ba1102
Python
3,650
83
import numpy as np def voxelize(x, x_data, n=20, c=13, dist=10, plot=False, bb_only=0): """Function to voxelize atom coordinate data ahead of training. Could be sped up on GPU Args: x_coords (np.array): num_res x num_return x 1 x 3 -- canonicalized coordinates about each residue with center resid...
c9958e2968416f7fcbea0504eb2265eab76ccae580af4ab3b9a75bc4d19b803d
Python
3,650
89
""" Automatically discard noise clusters conservatively (by amplitude, spatial spread, ISI violation ratio) and viz""" #%% import json import os from time import time from copy import deepcopy import gc from collections import OrderedDict import multiprocessing import shutil # rmtree import numpy as np # from scipy.io...
6e04736635fce1cc77b7f3de862263b50c69b466e75b3436e0c659a33185e688
Python
3,651
101
import torch from tqdm import tqdm import numpy as np import random from models import * from utils import * from diffusion import NoiseScheduleVP from sampling import get_sampling_fn from datasets import utils as du from torch_geometric.data import Batch import logging import pickle import functools import tree import...
764b0a1ff4fa29f62baf22f74fa67c0e7b2b60fb23d41b094905a231214afa19
Python
3,654
108
"""Tag and filter middleware-internal model calls. Tag internal calls with `internal_call_metadata()` and declare `transformers = (InternalCallTransformer,)` on the middleware class to keep them out of `run.messages`. Both APIs are public for third-party middleware. """ from __future__ import annotations import secr...
865ad96af84d31cc60a0787fb125e4eee23480446bd67876d99bd7f5edf0058e
Python
3,654
129
#!/usr/bin/env python # coding: utf-8 # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function from glob import glob from os.path import join as pjoin import sys sys.path.insert(0, '.') from setupbase import ( create_cmdclass, ins...
d14409a693dcee5f9da504a40a25b1462ec26010776cd9e3a7521d56580599d5
Python
3,654
114
#!/usr/bin/env python3 """ Download the entire Allen Reference Human Brain Atlas (34 years, cortex-gyral) as a JPG stack - use the brain-map.org API Usage ---- allen_download.py Authors ---- Mike Tyszka, Caltech, Division of Humaninities and Social Sciences Dates ---- 2017-05-24 JMT From scratch License ---- This f...
a524c43d76e66bcd9f6cb7a0905792cfe0105c1c83494b118cb4c055372024f9
Python
3,655
134
#!/usr/bin/env python3 """ Map the Allen developmental human brain ontology (16) to CIT simple label numbering. Output master conversion table as a CSV file. Usage ---- allen2cit.py -o <conversion table CSV file> allen2cit.py -h Example ---- >>> allen2cit.py -o Allen2CIT.csv Authors ---- Mike Tyszka, Caltech, Divisi...
4dc5d39a160d0363a524a70a326276b68e4242f9bfd5b1373e4ce254f68a70f5
Python
3,658
145
"""A simple progress bar for the console.""" import threading from collections.abc import Sequence from typing import Any from uuid import UUID from langchain_core.callbacks import base as base_callbacks from langchain_core.documents import Document from langchain_core.outputs import LLMResult from typing_extensions ...
a7dc88500534243fac16094039394376f097b4b27af1220a1c2c7ec30d90362f
Python
3,659
80
import os import pandas as pd import pickle as pkl from types import SimpleNamespace import yaml from yaml.loader import SafeLoader import numpy as np from scipy.ndimage import gaussian_filter from utils import * from tqdm import tqdm np.seterr(all='raise') def plot_shaded(ax, t, y, color, label): N...
168f00ee1d9ed3a177aa5fb6bd44e7e39d668233635c85e2b28e7f36660d1ba6
Python
3,661
120
########################################### # IMPORTS ########################################### import numpy as np import os from nose.tools import nottest from unittest import skipIf ### from perses.dispersed import parallel ### running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true' def te...
984157f86db90897e4b4a8a44ea8079faf7e4a09d8308025f0b0a1cb5e28b13b
Python
3,661
94
from keras.models import Model from keras.layers import Input, Dense, LSTM, Masking, Dropout from keras.layers.wrappers import TimeDistributed from mimic3models.keras_utils import ExtendMask, GetTimestep, LastTimestep from keras.layers.merge import Multiply class Network(Model): def __init__(self, dim, batch_norm...
ca979975273343f988f809612b9619196190cef63ac2a91118b4cdb25315e9a3
Python
3,661
121
#------------------------------------------------------- # MobileNet in PyTorch. # See the paper "MobileNets: Efficient Convolutional Neural # Networks for Mobile Vision Applications" for more details. #----------------------------------------------------------- import torch import torch.nn as nn import torch.nn.func...
3de0b7ca4ee02b3cf657bfa17f826f4b59e689c98b6cff6b05a463360a8fd6ff
Python
3,662
117
# builtin modules import os import subprocess # pnabind modules from pnabind.utils import moveFile from .mesh import Mesh def runNanoShaper(atoms, file_prefix, basedir, clean=True, quiet=True, hydrogens=True, pockets_only=False, mesh_kwargs={}, **kwargs ): # generate coordinate file if(not isinst...
7f7f8c6f31b5a336587a34987997f19ccca1e6b3d86f264b8075bb3b77bc10ed
Python
3,662
102
from __future__ import annotations from typing import Any from langchain_core.outputs import LLMResult from typing_extensions import override from langchain_classic.callbacks.streaming_aiter import AsyncIteratorCallbackHandler DEFAULT_ANSWER_PREFIX_TOKENS = ["Final", "Answer", ":"] class AsyncFinalIteratorCallbac...
8aa181161472f26a666ca96915c52e626cefc04be3d120d1071959776f6bc4c5
Python
3,663
102
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler class DropDataProcessor: def __init__(self, df): self.df = df # These will be populated after extract_data_label() is called self.train_key = None self.test_key = None self.train_key_set =...
b5ffeb452b02d4c9bf63e50b2741bbdfd4e731e4330f02c51cb18d9b48c19ba7
Python
3,664
93
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import math import warnings from typing import List from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler class LinearWarmupCosineAnnealingLR(_LRScheduler): """Sets the learning rate of each parameter group to ...
18e94181d8d2864782247c2d756e0aa9fa54adad36ac4f7466a8fabe9081e0ed
Python
3,665
83
# Needed for some densenets (however not used atm) # Code from https://github.com/titu1994/DenseNet from __future__ import absolute_import from keras import backend as K_BACKEND from keras.engine import Layer from keras.utils.generic_utils import get_custom_objects from keras.utils.conv_utils import normalize_data_fo...
c1311800f91efef70c1a4468c8763ab0636016682853016448ce890dff32ea4b
Python
3,666
96
#################################################################################### # # 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...
9c6d7e0ecdc71654927454c8f2bfb229bc51ffa289c7d0cf495ba44bda183a5f
Python
3,668
96
''' Created on Oct 12, 2011 @author: Ying Jin ''' WIN_SIZE = 1000 GAP = 1000 PRJ_NAME = 'TEpeaks_out' STEP = 100 # default step/bin size. FRAG_SIZE = 200 # default fragment size. #$range = 100; CUTOFF = 1 epsilon = 0.00000001 NN = 0.99 SHIFTSIZE = 100 MAX_PAIRNUM = 1000 HS_CHROM = 'data/hg19_chromsize' RN_C...
f451bb5bfe54066acdd0099de82c048cb1f93b29691fe68d9484ddcbbb2cf30e
Python
3,668
111
# This extension template provides instructions to add new Conditional Independence (CI) tests to pgmpy. # Please follow the following steps: # 1. Copy this file to `pgmpy/ci_tests` and rename it as `your_ci_test.py`. # 2. Go through this file and address all the TODOs. # 3. Add an import in `pgmpy/ci_tests/__init__.p...
dac63554a3306360e4f06df3597b953323d64e4e9271b1b963585c33434c6b69
Python
3,669
58
"""Export the split definitions used in the paper to splits/ (no model is fitted; the generators are the ones the experiments call). splits/corpus_a_p3_folds.csv cell_id, dataset, seed, fold (P3 cell-disjoint folds, src/protocols.py, seeds 0 to 4) splits/corpus_b_p3_folds.csv same for corpus B (twe...
0ca7d159884314464132a21487e664c137156b66f7c31415b3216e6b59c8cf4d
Python
3,670
92
""" Analyze subject's performance over the course of the task sessions at the group level. """ import argparse import data_analysis_utils as dana import matplotlib.pyplot as plt import numpy as np import os.path as op import pandas as pd import performance_over_sessions_subject import plot_utils as plut import scipy.s...
c36569c4c7f2b64c867da9a7913b4a03d309cb02e27e626e251e0a671b9d5bcc
Python
3,671
121
import csv import json from pathlib import Path import numpy as np import pytest from PIL import Image from neurovisfit.common.config import TomlConfig from neurovisfit.data.cache import ImageCache @pytest.fixture def mock_image_cache(tmpdir) -> ImageCache: # Create a temporary directory for testing temp_di...
c0bef184f6fdaaaec0ce4ded40782d2b985d9d184f946519b3645ca28cc43bba
Python
3,672
143
""" 2023.08.30 author: femke.hurtak@epfl.ch Helping script to load the data and interact with it """ import pickle import os import pandas as pd import numpy as np import params def load_graph_and_matrices(subset="dn"): """ Load the graph from the data directory. """ accepted_subsets = ["dn", "dn_gn...
7dc505011e7a8bb79536f8addca645235f0af18311eca75384bac423ab044b7a
Python
3,676
139
######################################################################## # Stochastic production and degradation well-mixed reactions. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the Production-Degradation model # (see validation/masteq....
f76673f0862acad3376961fdc4b4d1506b803a9ef260d0305dc19f618acaf011
Python
3,683
111
def cycle(iterable): # see https://github.com/pytorch/pytorch/issues/23900 iterator = iter(iterable) while True: try: yield next(iterator) except StopIteration: iterator = iter(iterable) def alternate(*args): """ Given multiple iterators, returns a generator...
049e07d2ce27a6f77e175c7f9af650910322c1c395cab12a692e3cdd910370f6
Python
3,685
113
import logging import os import socket import sys import matplotlib.pyplot as plt import pandas as pd import ptitprince as pt import seaborn as sns from configs.configs import get_config_dict from helpers.figures import get_palette def plot_brain_state_switch_count( config_dict: dict, num_basis_states: int,...
c1eddebaa0575516a68db345f8e16d2b6d64b87b909e69c36b13a7c416f11e40
Python
3,685
76
import argparse import os import sys from tqdm import tqdm from mimic3benchmark.subject import read_stays, read_diagnoses, read_events, get_events_for_stay,\ add_hours_elpased_to_events from mimic3benchmark.subject import convert_events_to_timeseries, get_first_valid_from_timeseries from mimic3benchmark.preprocess...
fb808f319cda2f264cb84aa9df00be9670cf1faf59b8e8590133f511d395f15a
Python
3,685
101
""" Creates the ARF/MOSF, COPD/CHF/Cirrhosis, Cancer, and Coma subsets of the SUPPORT dataset using the 14 features used in the DeepSurv paper; in our paper we refer to these 4 subsets as SUPPORT1, SUPPORT2, SUPPORT3, and SUPPORT4 respectively The original SUPPORT dataset can be obtained from https://hbiostat.org/data...
becb7468385a900ef39ce31bfa9c0f93f2c0cf928c876d5702204d6e53fe7b3e
Python
3,689
129
######################################################################## # Stochastic first-order irreversible reaction. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the First-Order Irreversible # Reaction model (see validation/first_orde...
37af88ab08c98d1b92d36de7d2a12301a56797c647e2cf98a5f050b3ce007c68
Python
3,692
87
# 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...
7bcdf973fe5347d9b89b831cb9c77b89846bfd54d3ae71fcd62705b8b1ff9f7a
Python
3,692
95
# 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...
599c7d35da377f6b32ce91d99e3b9c5e7833504339f6182778281510731ad4ae
Python
3,693
95
"""Purpose of this script: try sorting those single sessions separately that failed when batch run together with other sessions !!! NOTE !!! untested """ 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....
faaf666800c811e629d3453849cb97ba1b03e49c5c233a9e4f8cf5f5afb6e934
Python
3,693
139
######################################################################## # Stochastic production and degradation well-mixed reactions. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the Production-Degradation model # (see validation/masteq....
09d78350d03b152e8fdf8dfaa894c3e302a831d18eede509ecd06e28037585bc
Python
3,694
78
import argparse from src.configs import NG_curriculums def str2bool(v): if isinstance(v, bool): return v if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.ArgumentTypeError('Boo...
7ddafa97f73297a0e5168a2db6e01871d08783649a0f343701cd57c75124d578
Python
3,695
123
"""Callback handler that prints to std out.""" from __future__ import annotations from typing import TYPE_CHECKING, Any from typing_extensions import override from langchain_core.callbacks.base import BaseCallbackHandler from langchain_core.utils import print_text if TYPE_CHECKING: from langchain_core.agents i...
a07a47e980153c9856693560f8d8e92cb1bccf5d3a65bdfc05ac12c7e97f7be5
Python
3,695
121
import hydra import torch import torch.nn as nn import torch.optim as optim import wandb from torch_geometric.datasets import QM9 from torch_geometric.loader import DataLoader from omegaconf import DictConfig import os from pathlib import Path from typing import List from pytorch_lightning import ( Callback, ...
79ad05c2142f446f9074ac6194c974a7c51e993046b052e110fcdb844a885c3e
Python
3,698
116
import os import pandas as pd import torch import numpy as np from torch_geometric.data import Data import warnings warnings.filterwarnings("ignore") import pickle from tqdm import tqdm from torch_geometric.data import DataLoader import random import torch.nn as nn import torch.optim as optim from torch_geometric.nn im...
fa989d701e5e70ce553434eb044b44c6629f7f44c651e578ea8cc4e89ea09039
Python
3,698
109
""" The Sinc Keras model presented in the paper. To get the model call 'net' function. """ import numpy as np import tensorflow as tf from tensorflow.keras import initializers from tensorflow.keras.models import Model from tensorflow.keras.layers import * from tensorflow.keras.regularizers import * from brainagemodel...
179f57d0c7e992da1ac294cff813d43d7e838ff1808da766d9146ad64853c050
Python
3,700
113
# Training procedure for CIFAR-100 using DenseNet 40 with growth rate 12. from __future__ import print_function import os.path import densenet import numpy as np import sklearn.metrics as metrics from keras.datasets import cifar100 from keras.utils import np_utils from keras.preprocessing.image import ImageDataGen...
1cf7d7d0b2da26af5736d03ef2439a10b4f127bdc8d12cd8ba199b03d227d138
Python
3,700
77
import os import pathlib import numpy as np import pandas as pd from brainrender import Scene, Animation, settings from brainrender.actors import Points from brainrender._colors import get_random_colors from vedo import embedWindow, Plotter, show from brainrender.video import VideoMaker from scipy.spatial.distance impo...
e050942d2a5fc979dfc6fcd5ea8dfe9b778c940b448096b150154eee44fa0b00
Python
3,700
91
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from timm.models.layers...
65b8983e4ea906f140550d58fa5d60c904ccec98727058a109c27d5845f8bd04
Python
3,704
109
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...
6616e40380d7be07932f68667646f2c36455a7f040179a37ba78ee6bb2465106
Python
3,704
118
''' Example using a big BB-RBMs on the MNIST handwritten digit database. :Version: 1.1.0 :Date: 24.04.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior This file is part of the Python library PyDee...
d8d8c6508098eff7141d255d0a9fe60714d5ef3f1ffb7e43814623a5ca9c4b97
Python
3,704
123
import sys sys.path.append('../classes') import class_model import class_stimuli import numpy as np import pickle import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt ### MAIN SCRIPT stimulus_tasks = ['varyposition', 'varysize', 'varyrotation'] stimulus_folder = '../stimuli/simple_seqs/' save...
ba8fde1711ebefdb5d8d9f1e6133f8d6923e34ae6a0f21d753a66a6fcede545c
Python
3,705
119
''' Author: Alexandra Fischbach Github repo: https://github.com/AlexFischbach/local_csf_pipeline/tree/main Date: 04-18-2025 Contact: fischbach.a@northeastern.edu ''' import os # ---------------------------------------------------------------- # USER-DEFINED PATHS AND PARAMETERS # ------------------------------------...
ff027cd0ac7571d473e2aaa1db8fa3ad1ecc2745b2c644f7fd12ea4fe3e5d4a0
Python
3,705
94
import os import torch import json import numpy as np from skimage.io import imread, imsave from skimage.measure import regionprops from torch.utils.data import DataLoader from PredictionDataset import PredictionDataset from joblib import Parallel, delayed def draw_predicted_contour(compteur, prop, imagette_contour...
1d7708d2d81ac7527f305972710a8a61668eb2ed20c1c2c1c3ea7b4b10f33b6c
Python
3,706
139
""" :AUTHORS: Martin M. Müller, Olivier J. N. Bertrand :ORGANIZATION: Department of Neurobiology, Bielefeld University :CONTACT: martin.mueller@uni-bielefeld.de :SINCE: Wed Nov 24 16:13:28 2021 """ import numpy as np from scipy.optimize import minimize_scalar from scipy.special import i0 from scipy.special import i1 fr...
3d988006d3c9c642d4184e4d0dcda26fc2c9b1e7458b99cc8e4ca3d8f19bb763
Python
3,706
129
######################################################################## # Stochastic first-order irreversible reaction. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the First-Order Irreversible # Reaction model (see validation/first_orde...
c63594b7fa6655d3082d4e706741c5d96ddd6934aaa7e408c6054739bff0ab52
Python
3,706
117
######################################################################## # 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...
0a960f864f6989b4a679b12c2d205654b132412dfffdff8781b687f39ad6d324
Python
3,707
77
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.optimizers import SGD from keras import regu...
49f0a0f1f7cb99604c5ba857f349941c8f7315d6785c80d832d8b7863a71f101
Python
3,709
103
# Copyright (c) 2021, NVIDIA CORPORATION. # # 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...
302e654934335afbc643f6c3f9a153f6e13893afec564fd0f6611443a510d9ac
Python
3,711
129
import threading # threading.Eventの複数ch対応 class MultiEvent(): def __init__(self, chNum = 1): self._cond = threading.Condition(threading.Lock()) self._chNum = chNum self._flag = [False for _ in range(chNum)] def _at_fork_reinit(self): self._cond._atfork_reinit() ...
67232a519becc571a00909fb8992b8ea9c0224b5a0d3a699cf8e6858a8351fd5
Python
3,711
132
""" :AUTHORS: Martin M. Müller :ORGANIZATION: Department of Neurobiology, Bielefeld University :CONTACT: martin.mueller@uni-bielefeld.de :SINCE: Thu Jan 6 11:04:49 2022 """ import re import pandas as pd import os import numpy as np from IPython import get_ipython from utilities import mle_utils as mlutil from utiliti...
7192515c7f788b9166bc81b0d09252a8658c173aa24bfd79fb2f45deb4a70877
Python
3,713
117
######################################################################## # 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. ...
73fb77729f20eb1089246b93e4506ba9c0f7f6d2ac65e686ab38dee11d4d5781
Python
3,714
93
import os import argparse import numpy as np import pandas as pd import random random.seed(49297) from tqdm import tqdm def process_partition(args, partition, sample_rate=1.0, shortest_length=4.0, eps=1e-6): output_dir = os.path.join(args.output_path, partition) if not os.path.exists(output_dir): os.m...
6f977e60bf5dfc425a6e1a7d458c61c7d34d71b27379c8ec57ec5f1286855555
Python
3,717
109
"""Functions for rearranging matrices/data files""" from ..utils import path as pth import csv import numpy as np def order_dict(data, orderfile): """order_dict. Reorders a dictionary according to the order of keys passed in the list in orderfile. Returns a reordered dictionary. Args: data (type)...
18ce5abeac5947db5272007b05d4de9defef1e615d8ee0b3cfb47a9e717b61cf
Python
3,720
138
import os import setuptools import sys def read(fname): with open(os.path.join(os.path.dirname(__file__), fname), 'rt') as f: return f.read() def requirements(): with open(os.path.join(os.path.dirname(__file__), 'requirements.txt'), 'rt') as f: return f.readlines() EM_CODECS = [ "imagecodecs", "simpl...
5b225424db35969c7933a00428ad24ef5e559bfffa5f9ae97220158fb57b6cf2
Python
3,722
103
from pathlib import Path from typing import Any from typing import Dict from typing import Optional from typing import Tuple import numpy as np import torch from PIL import Image from tqdm import tqdm from .params import ImageTransform class ImageCache: """A class to cache images from a directory""" def __...
c1788973742de80e30fe4904871716b926a5a17cf89cd359fbcdc88a4268c634
Python
3,723
117
######################################################################## # 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...
05a398ed909324efd6ad31b1714c53b4298e2a525d27581cbfb0dfcaa80215b9
Python
3,724
124
import pandas as pd from jinja2 import Environment, FileSystemLoader import os import sys import numpy as np def read_csv(file): data = pd.read_csv( file, header=0, names=["test_name", "operation", "mean", "std_dev"] ) hardware_info = data.loc[ data["std_dev"].isna() & ~data["test_name"].i...
461833c64fb82823860cb38db0a9a4dfae3d8186fde48d1e6129d4def44e8b39
Python
3,725
109
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import numpy.ma import Stats import Histogram from cgatReport.Tracker import * from cpgReport import * from cgatReport.odict import OrderedDict as odict ###########################################################...
55a5107a13008a6cb8423833e61202e335032dc82538cecf16d2616494a92360
Python
3,726
90
import argparse 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...
69053c9499fe6fdaac4f292bef64d392d15432a46fe838f2ac071f143d9b8774
Python
3,728
119
from torch.utils.data import DataLoader import torch import numpy as np from torch import nn,optim from bestmodel import MyModule from Dataset import MyDataset import sklearn.metrics as m from numba import njit import pandas as pd import os import warnings warnings.filterwarnings('ignore') def RMSE(y_true...
35032721a49feee6ccc0a1212c07bdb5736ef349b5272f29e693f4422526d667
Python
3,730
84
# 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...
520b4200e6bc47ea1361353d542351f85067acd273b8806560d726e8d30fe998
Python
3,730
117
######################################################################## # 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. ...
6cbc171840a0ceabef3943a8acacfd9643157f6c42866b41ddae8f77519e640a
Python
3,731
112
import logging import numpy as np import pandas as pd from helpers.array_operations import map_array, reorder_symmetric_matrix, reorder_lower_triangular_matrix def load_data(data_file: str, verbose: bool = True) -> (np.array, np.array): """ :param data_file: :param verbose: :return: """ df =...
85bdb2537b2760f4ee799889fb4288d0c287601366eb3754c3bc5ef16aa0b846
Python
3,732
137
"""Fake LLMs for testing purposes.""" import asyncio import time from collections.abc import AsyncIterator, Iterator, Mapping from typing import Any from typing_extensions import override from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.lan...
0683b6ec4fceda4f536f311764e7acad55b0e8213a2d3b630f2309886240e32d
Python
3,735
115
""" ===================== Mappability pipeline ===================== Pipeline to count mappable bases in a given genome """ import sys import os from ruffus import * import cgatcore.experiment as E from cgatcore import pipeline as P ################################################### # Pipeline configuration #####...
ccefd9e5a7bc97c11ec1b5c14f67f1e2e098520259ba33c0c4874c38de378d68
Python
3,735
108
"""Derivations of standard content blocks from Bedrock content.""" from langchain_core.messages import AIMessage, AIMessageChunk from langchain_core.messages import content as types from langchain_core.messages.block_translators.anthropic import ( _convert_to_v1_from_anthropic, ) def _convert_to_v1_from_bedrock(...
e48511e30db99a9a8b8d90a43aff36c439fb4641ed0778be56de1b79981b5387
Python
3,735
110
from ccg.derivation import Node, DerivationLoader from ccg.categories import Category from ccg import combinators as comb from ccg.penn_treebank_tokenizer import penn_tokenize from os import path import os import jieba import logging logging.getLogger("jieba").setLevel(logging.CRITICAL) _original_open = open open = ...
ea9c6e0fbc52db0f819205a29d15742856a25401b75a4393ba744cc1fc400322
Python
3,738
64
# 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...
103d0a3df048bb37473b2fac2b574380fb3e8e05c0a4e60d6e836fa3bbaf74d6
Python
3,740
113
import cv2 import argparse import numpy as np import pandas as pd from tqdm import tqdm from typing import Tuple def obtain_bb(threshed_image : np.ndarray) -> Tuple[int, int, int, int]: """ Obtains the bounding box of the lesion Inputs: ---------------- Outputs: ---------------- x : int :...
957136bdcabbd4f5c3ee854d0ba19c159f926a90b579d4248ed4b43baa47fe0f
Python
3,740
123
from omegaconf import OmegaConf from pathlib import Path import torch import torch.optim as optim from monai.config import print_config from monai.utils import set_determinism from tensorboardX import SummaryWriter from models.vqvae import VQVAE from training_functions import train_vqvae from util import get_training...