sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ab117214ffa8d10a71d5d39c088bb610279b146dbf5a89bd1997d6479d66cd59
Python
26,920
537
""" Reading and writing nnU-Net checkpoints. nnU-Net writes its checkpoints as safetensors files (`checkpoint_final.safetensors`, `checkpoint_best.safetensors`, `checkpoint_latest.safetensors`). Checkpoints written by older versions are `torch.save` pickles (`.pth`), and these are still read, exactly as before. Why n...
821afd16d5a6c0bf202b4eaf1c00b6a5b78f0d8dd0b38dadc6fcea5feffd948a
Python
26,942
721
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.utils.data import Dataset, DataLoader from copy import deepcopy import numpy as np import matplotlib.pyplot as plt import argparse import pdb import os import sys import...
1d9e74fbd2ccfd16eeb469b4cb987ec49c5da751db8be64be92767b1c3c9c326
Python
26,952
748
""" A set of functions and scripts to demonstrate camera calibration and registration. Notes: * Parts of this module uses opencv calibration described here: https://docs.opencv.org/4.0.0/d9/d0c/group__calib3d.html * and the Chruco board described here: https://docs.opencv.org/4.0.0/d0/d3c/classcv_1_1aruco_1...
413e593d4ab87d4e6d33333a401328a9330bfc75204b45ffe3e0827dacc3bbf9
Python
26,953
610
# --- START OF FILE app.py --- import streamlit as st import ast import os import subprocess import time import requests import getpass import psutil from datetime import datetime, timezone from pathlib import Path from collections import OrderedDict # Use our centralized logger setup from logger_setup import logger ...
8058859f84e5160330325c022d113c67387750ba52efc2ebd272f423acccff72
Python
26,955
787
""" Copyright (c) Meta Platforms, Inc. and affiliates. 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 annotations import copy import math from typing import TYPE_CHECKING import torch import torch.nn as nn from torch...
0e988bc0ec382adfec51e2bbf552f5dfcf46bc84560a3b81d8437796fd9a0503
Python
27,016
735
import gym import json import os import gym_sted import pfrl import torch import sys import random import pickle import logging import functools import numpy import h5py from tqdm.auto import trange, tqdm from matplotlib import pyplot from collections import defaultdict from skimage import io while "../.." in sys.pa...
d2fdb98bd9de645701121582e615c183dbc3afb55ea004e9a2ada6012422b226
Python
27,037
595
import numpy as np import os import tifffile as tiff import random import math import torch from torch.utils.data import Dataset from skimage import io def random_transform(input, target): """ The function for data augmentation. Randomly select one method among five transformation methods (including rota...
158f68a5eab8b30b927a0353dc8439b20190539de7df9abc4441d98975de7798
Python
27,039
643
import exputils as eu import ipywidgets import pandas as pd import qgrid import os from exputils.gui.jupyter.base_widget import BaseWidget import IPython import warnings # TODO: Feature - allow to filter datasources that should be loaded # TODO: Feature - progress bar during data loading # TODO: Bugfix - If the order ...
226172343fcfdfd93ecd85625a934df919a9731ff60553b28b9cc6f374c49519
Python
27,039
649
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
61bb21fa47031ec97fc88804b422e6aed16ee581a8af46738d1d29bf2e431efb
Python
27,042
659
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
253880cb5633cb34c736b1e8f78ffe9c770b13f8d1e68ba9814443c0443bd90d
Python
27,048
713
import os import numpy as np from nibabel import load as load_nii import nibabel as nib from operator import itemgetter from build_model import define_training_layers, fit_model from operator import add def train_cascaded_model(model, train_x_data, train_y_data, options): """ Train the model using a cascade o...
ca5afd14fb564a92de2cada9296d4f804f4ccd9fc4c648b0465889ae11dc5061
Python
27,061
835
# Copyright 2023 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
e9a7f01d3dccc3b0812f05e5b8aef5b421041daeddfe2d876d62b90bc741cdcd
Python
27,067
599
# Ultralytics YOLO 🚀, GPL-3.0 license """ Train a model on a dataset Usage: $ yolo mode=train model=yolov8n.pt data=coco128.yaml imgsz=640 epochs=100 batch=16 """ import os import subprocess import time from collections import defaultdict from copy import deepcopy from datetime import datetime from pathlib import...
57d2754c095e6e183e2486fb87f9b7225bf2aef5284991796442a1827475d2e7
Python
27,082
856
"""Abstractions around GCP resources and nodes. The logic has been abstracted away here to allow for different GCP resources (API endpoints), which can differ widely, making it impossible to use the same logic for everything. Classes inheriting from ``GCPResource`` represent different GCP resources - API endpoints th...
a453ff7bee16a2d13f6cb795357faec4b49e7ca86a10d410fb0ac8ecdf65900e
Python
27,131
629
import torch import torch.nn as nn from torch.optim import Optimizer, AdamW from torch.optim.lr_scheduler import LambdaLR import numpy as np from tqdm import tqdm import os import platform from sklearn.model_selection import KFold from splam_utils import * from splam_dataset_Chromsome import * from SPLAM import * ###...
541d62dfafffb502a10be3d51dd6f24def750b8b447b10e883b888e45e5d428c
Python
27,159
592
# Copyright 2023 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
d3340ebf12488bdafd543d3c7b14ed103d213bc48abaf78eeec53b3fc65c1908
Python
27,161
849
""" Segment song motifs by finding maxima in spectrogram cross correlations. """ __date__ = "April 2019 - November 2020" from affinewarp import ShiftWarping import h5py from itertools import repeat from joblib import Parallel, delayed import matplotlib.pyplot as plt plt.switch_backend('agg') try: # Numba >= 0.52 fr...
5d58c0ca9991436d1ebf7ae18afafe3b464290be824b7510bc779b9cc76f1aa4
Python
27,164
624
r"""Image segmentation backends for ``ov.space.seg.segment``. A backend is built once per call, sees a downsampled copy of the whole image in :meth:`Backend.prepare` (so intensity scaling is global, not per tile), and is then called on each window by the tiling engine. Heavy libraries are imported in ``_build`` only, ...
16ca9ab4f4d7845a188b5df208f3d51961754ea353ba1a605bcce118dad45291
Python
27,165
702
# built-in dependencies import base64 from importlib.metadata import version as package_version import os import shutil import unittest from pathlib import Path from tempfile import TemporaryDirectory from unittest.mock import MagicMock, patch # 3rd party dependencies import gdown import numpy as np from flask import ...
4f59e7e041798b554bb027420eb6edb286d8ebb833c577edd826cc3879f9b7bf
Python
27,167
761
"""Execution tool handlers: execute_code, run_snippet, bash, agent, inspect, search, finish. Extracted from ``tool_runtime.py`` during Phase 3 decomposition (pass 2). These handler functions receive explicit dependencies (ctx, executor, subagent_controller) as parameters rather than accessing ``self`` on ``ToolRuntime...
9e8c69833542c207709f126326203d1a06f1b09c4d59282b45c31d93249bbf75
Python
27,182
547
# Copyright 2023 The HuggingFace Team. 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
d18ef8a66262dac2407152b3574294fdac1cf47fe60d4ca0c614daf0bb7340b5
Python
27,206
551
import numpy as np import networkx as nx import os.path import matplotlib.pyplot as plt import time import math import gc gc.collect() import warnings warnings.filterwarnings("ignore") import os os.system('cls' if os.name == 'nt' else 'clear') plt.rc('font',size=15) UseDoubleWell=1 RCType=0# Different R...
e8d21e40bde63c7b29c8db4fef3ec7c8583cc3631526bae661fa84d0dc3541f8
Python
27,220
558
import numpy as np import networkx as nx import os.path import matplotlib.pyplot as plt import time import math import gc gc.collect() import warnings warnings.filterwarnings("ignore") import os os.system('cls' if os.name == 'nt' else 'clear') plt.rc('font',size=15) UseDoubleWell=1 RCType=0# Different R...
f58c9b50e74c2d153a1685a57ba640a71c27bb5d37c3419bd439786b4bab3de0
Python
27,227
697
import asyncio import logging from concurrent.futures import ThreadPoolExecutor from itertools import islice from typing import List, Optional import ray.dashboard.memory_utils as memory_utils from ray import NodeID from ray._common.utils import get_or_create_event_loop from ray._private.profiling import chrome_tracin...
6154db67fc324a56445e0773bc4e186dd0f6530a7586f1b4bfc30ec59234ed62
Python
27,235
678
from sklearn.neighbors import NearestNeighbors from scipy.sparse import diags from scipy.sparse import csr_matrix from scipy.spatial.distance import cdist from .init_pca import init_pca from .pca import pca from .mds import mds import scipy.sparse.linalg as sp_linalg import numpy as np import math from tqdm i...
09fb6518b507aaa84792f7fa80c93ca7b04cda24f9710f6e6c6ed91ade6ddb5f
Python
27,236
817
import json import logging import os import shutil import subprocess import sys import tempfile import time from pathlib import Path from typing import Optional from unittest.mock import patch import pytest import yaml import ray from ray._common.test_utils import wait_for_condition from ray._private.runtime_env.pack...
87921995821a820da97b32467733e7d030927b71cb03a7d572b120699f481cd0
Python
27,238
694
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
deb6564228658682e8314b428029cbb05bb49bc3b73649444320a3f6294276a8
Python
27,253
622
# Copyright 2023 TSAIL Team and The HuggingFace Team. 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
2cbf7af26e9128268d344c2bb039f04df78269460b2c6c35f95947cd2bfe8bb4
Python
27,259
638
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
f325d370d64ec8eda463d4193b93b49a2b781dfbbf574bd66cbe229ef4c9e7ec
Python
27,259
726
import sys, os import math import time import numpy as np from pathlib import Path ROOT_DIR = Path(__file__).parent import tensorflow as tf from apnet.keras_pair_model import KerasPairModel from apnet import constants class PairDataLoader: """ todo """ def __init__(self, dimers, energies, r_cut, r_cut_im):...
1f7f3e01cbf1575a48e5d1de67fa1259168b1e860e8e3c6e818123e93370064d
Python
27,260
682
import glob import torch.utils.data as data from PIL import Image import torch import sys import os import numpy as np from tifffile import imread sys.path.append('..') from csbdeep.utils import normalize, axes_dict, axes_check_and_normalize, backend_channels_last, move_channel_for_backend from csbdeep.io import load_t...
157fa570bd9e61dca9af21df245a65337de06fcdea61f4e45b492159611e46ae
Python
27,267
703
import os, time, glob, shutil import multiprocessing as mp import matplotlib # NOTE: we intentionally do NOT force a non-interactive backend at import time. Doing so # (matplotlib.use('Agg')) used to silently break inline plotting in notebooks that imported # motionmapperpy. The few functions here that *save* figures ...
aff04a7191f27ac6ef58698effe8c6bd742cae30338f4e3ed5d592dbf3893d1c
Python
27,298
472
import abc import datetime import queue import os import statistics import tarfile import time import projectmetis.python.utils.proto_messages_factory as proto_messages_factory from fabric import Connection from google.protobuf.json_format import MessageToDict from pebble import ThreadPool from projectmetis.python.ut...
699dfc8dd7e97463f85a4fd2bdc4081e41473b250252b226de26760e12410444
Python
27,303
834
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import TextBox,Button from matplotlib.animation import FuncAnimation from tqdm import tqdm from scipy import optimize import os import json SpineWidth = 1000 class SpatialModel(): def __init__(self,CParams,P0Params,gamma,zetaS,FParams,C0Pa...
c4b9d5352c9dda567513dfe26d8da8fd192af3f740fb949d478ac2356af86cc0
Python
27,312
773
import math from functools import partial from typing import Optional, Tuple, Union, Sequence import numpy as np import torch import torch.nn.functional as F from einops import rearrange, repeat from torch import nn from x_transformers.x_transformers import ( TokenEmbedding, AbsolutePositionalEmbedding, de...
c9cb9b19782ecda7ab0bbdd138e36ec9f2e3153e4d0619b559ae46deb5ea3b82
Python
27,323
719
"""I/O for single-cell immune-repertoire (AIRR-seq) data. This module reads TCR / BCR sequencing output into an :class:`anndata.AnnData` object using a clean, documented per-cell receptor data model — an omicverse-style reimplementation of the relevant parts of scirpy's reader. Data model ---------- After reading, th...
e4c1fc371b1cd8c53b067c50c35dd794d3f8f257860e9a949708bee781797037
Python
27,354
926
import numpy as np import matplotlib.pyplot as plt import os import pickle import settings import matplotlib.collections as mcoll from numba import njit, jit from scipy.ndimage import gaussian_filter from sklearn.linear_model import LinearRegression from math import remainder @njit(parallel=True, fastmath=True, nogil...
b841d8d14b305aad95170ae3ca59d12a93ef6807b4e2d6cc6ad900efe5cf86fb
Python
27,392
756
# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
ea5c6b38014670e4bf38792255b8d392725ce816db46f61fc799686a0e752c3d
Python
27,398
712
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
91de04af473ef437fa9dfd10b4821c67f2448d6d73488bf0bbba57ff50549a6a
Python
27,402
467
import numpy as np import sys class BeliefHistoryTabularRL(): # state is a concatenated string of previous history observations # separator is used to separate observations separator = '*' def __init__(self, env, policy=1, alpha=0.1, epsilon=0.1, seed=None, exploration_decay=False, exp...
fd17b83c10cf216fe405104271c9becabb083f72e64bedf549b660f1bc87fa81
Python
27,402
651
#################################################################################################### # Copyright (c) 2020, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is free softw...
04eb6dcf5038b07ebc2a1a422d64ecb8e2d3ed6c1117a04e86be7ccaa9e80a35
Python
27,448
778
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
48e592eb2d9a0bf57ceef22f17be5466188743e857c245acb8644c24f0656986
Python
27,471
685
import base64 import ipaddress import logging import os import random import string from enum import Enum from threading import RLock from typing import Any, Dict, Optional, Tuple from kubernetes import client, config from ray.autoscaler.tags import ( NODE_KIND_HEAD, NODE_KIND_WORKER, STATUS_SETTING_UP, ...
77680620948815a65cf62b6932cc8738ef3c0db3eff50849732322c589b4cb75
Python
27,484
652
#################################################################################################### # Copyright (c) 2020, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is free softw...
e35d00976566dbad5ff684b122c051b4be43839a2f6c122bd315e87e46258bf0
Python
27,487
685
from __future__ import annotations import logging import math import numbers from collections.abc import Callable, Iterable from dataclasses import dataclass from typing import TYPE_CHECKING, Any, List, Optional import numpy as np from ray.data._internal.delegating_block_builder import DelegatingBlockBuilder from ra...
13920964546a022b9ea4128c26ef48cea3c23beaf3724600dbaa66c9560771a0
Python
27,494
744
# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
ebb00297368d2b1e7a52b6a8857c9c6b8f1fad1f5a0bff8da97da9976f482cc3
Python
27,534
642
import json import time from pathlib import Path from typing import Dict, Iterable, List, Literal, Optional, Union import inspect import numpy as np import pandas as pd from scipy import sparse from omicverse.external.scTenifold.core._networks import * from omicverse.external.scTenifold.core._networks import anndata_...
cff20de0f80bc4fd7d186c8d359c226f7700a24a5c897a0fb78da09c03d15505
Python
27,538
672
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Weight Programming Optimization implementation which is similar to the framework reported in the following paper: C. Mackin, et al., "Optimised weight pr...
eeebaaeb804a5bac7fe38f97387b9c8117039127bb6b0f8f3f083b92b6d67073
Python
27,589
624
#!/usr/bin/env python # ================================ # @auther: Rongbin Zheng # @email: Rongbin.Zheng@childrens.harvard.edu # @date: May 2022 # ================================ import os,sys import time import pickle as pk from datetime import datetime import numpy as np import pandas as pd import traceback from ...
b6120b0540a87fba9ce74863335effe2856c32f3f42f35d3a28f6fb0d70d4597
Python
27,600
736
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
d0d8ef969e629155d06ba059a40d3d409872a3b5c014d6d499cc4fc3ca3990a5
Python
27,642
660
r"""Terminator strength, and compiling a truth table into DNA. Two holes at the circuit layer. ``promoter_strength`` and ``rbs_strength`` existed; the third part of every transcription unit did not. :func:`terminator_strength` scores intrinsic (Rho-independent) terminators from their structure — hairpin stem stabilit...
41a680ed30ba40fa6abcb138931bc4440956a5c5d80c89e40797050008a907bd
Python
27,690
706
#!/usr/bin/env python # -*- coding: utf-8 -*- """ functions that creates image from a video file Primarily intended for plotting, returns correlation images ( local or max ) See Also: ------------ @author andrea giovannucci """ from builtins import range import cv2 import logging import numpy as np from scipy.ndim...
d46d2a0b50d866a5b7acd55c34a42b4787564244ca921960fd06fce26ffc8bb2
Python
27,696
673
import threading from collections import OrderedDict from random import Random from typing import Dict, Iterator, List, Optional, Union import numpy as np from torch.utils.data import DataLoader, Dataset, Sampler from rdkit import Chem from .scaler import StandardScaler from GR_pKa.features import get_features_genera...
432b389f20800da1a98479a285a093578d4573dfdaf3aa6e270553f6a757145f
Python
27,699
811
import os import logging import random from math import sqrt import networkx as nx import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from rdkit.Chem import AllChem from scipy import stats from sklearn.metrics import roc_auc_score from datasets import ( graph_data_obj_to_nx_simpl...
e3b640a397837cbb6c549d1e8db70f664dfc1b0036782a8da6d1f32499e592db
Python
27,699
618
#!/usr/bin/env python3.7 """Defines Query class. The copyrights of this software are owned by Duke University. Please refer to the LICENSE and README.md files for licensing instructions. The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent """ import os import pickle...
b2e2f71192f0a0554b27b0de5b1af1c2ff268ce9637d75b5cacfd065cf980f96
Python
27,700
587
import matplotlib import matplotlib.pyplot as plt import networkx as nx import seaborn as sns import scanpy as sc import numpy as np import pandas as pd from typing import Union, Sequence, List, Tuple, Optional, Iterable from matplotlib.axes import Axes palette_network = list(sns.color_palette("tab20") \ ...
dd64ba4b1ba1f40bb2e959506f9d978e82793053a8de2e99c53a82f4901179cc
Python
27,711
890
import numpy as np import pyro import torch import scipy.stats as sts import sklearn.preprocessing as skp import sklearn.metrics.pairwise as skmp import pyro.contrib.gp as gp import general.pyro_utility as gpu import general.neural_analysis as na import general.utility as u import pyro.distributions as distribs import...
b585897fd86e5762b7e057ec45811da1b1daddb0943f5af1814535c184210c14
Python
27,712
470
# Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # and Applied Computer Vision Lab, Helmholtz Imaging Platform # # 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 L...
5c383b55ffd31153c8095689c72ac57fbe9a1bfd6368533c569bf8a79bb69cd8
Python
27,716
744
# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
a84cf64465889a1f1d7d7cbd900ec1d16f9b806b38af61f04a95be426bbec55a
Python
27,716
726
"""GPU providers for monitoring GPU usage in Ray dashboard. This module provides an object-oriented interface for different GPU providers (NVIDIA, AMD) to collect GPU utilization information. """ import abc import enum import logging import os import re import subprocess import time from typing import Dict, List, Opt...
9c03048219de0466cbc5fb04bf7514983d7353262c6d95352832cb690b92286c
Python
27,722
697
""" Copyright (c) Meta Platforms, Inc. and affiliates. 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 annotations import functools import logging import types import warnings from typing import TYPE_CHECKING import n...
81220b5eca8644299ac87588e18e87a63b8b39acaf7b0c9af84549a1541dc117
Python
27,739
509
import torch import torch.nn as nn import numpy as np from tqdm import trange class gru_prepare(nn.Module): def __init__(self, input_size, hidden_size, output_size, num_layers=1): super(gru_prepare, self).__init__() self.input_size = input_size self.output_size = output_size ...
9195e2c9048c196e9f7f13a0f424f1f89e5d58b522fe99dc796a80e81e65f7c9
Python
27,756
594
import math import numpy as np #from vedo import * import random import sys import argparse import copy from pyknotid.spacecurves import Knot from pyknotid.spacecurves import Link import top_funcs import networkx as nx visitedList = [] ring_links = [] def compute_linking_number(K,L): K = np.asarray(K) L = np...
18c3635a25a65aca11301baa5faa5b02027d26f2db93a11509f91e0403958906
Python
27,764
1,053
import numpy as np import matplotlib import matplotlib.pyplot as plt import settings import os import pickle from utils.grid_funcs import ( traj, traj_pwl, gridpop_clustering, gen_offsets ) from utils.utils import ( grid_meanfr, get_hexsym, get_pathsym, convert_to_rhombus, ax_pos ) f...
49f0ec648bf4efc0691ad012484be221413924f46da5531a4db656f241a9fec9
Python
27,768
675
import gym import numpy import random import pysted.base from gym import error, spaces, utils from gym.utils import seeding from matplotlib import pyplot from collections import OrderedDict import gym_sted from gym_sted import rewards, defaults from gym_sted.utils import SynapseGenerator, MicroscopeGenerator, get_for...
70d62fb71af634335bdcc26869ff4f42019e58e4d5153a1d022b8430709d1f93
Python
27,769
862
#!/usr/bin/env python import fmm3dpy as fmm import numpy as np import numpy.linalg as la def main(): test_lfmm() def test_lfmm(): ntests = 54 testres = np.zeros(ntests) # # This is a testing code for making sure all the # fmm routines are accessible through fmm3d.py # n = 2000 ...
884b794d0c39d67c1858b636dcb61504c81b8df83ba70fc5c5ffeb008bba4827
Python
27,805
606
import torch from torch import Tensor import torchvision import torch.nn as nn #from .utils import load_state_dict_from_url from typing import Type, Any, Callable, Union, List, Optional __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',...
ffa1f72c9a0d66c6218cdf30705cb079ab719b5c9fc87f1417a7c954912de8c1
Python
27,814
710
import pandas as pd import numpy as np import plotly import os import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx from sklearn.neighbors import NearestNeighbors from sklearn.preprocessing import normalize from scipy.stats import norm def get_cmap_qualitative(cmap_name, n_colors=None): "...
f11a345f8ff886e83a57ff20ad2bd2eb27183834731e5941f2a37ddee40d6f37
Python
27,848
896
"""Additional classes and functions needed for slab handling.""" import pathlib from typing import Callable, NamedTuple, Tuple import ase.atoms import numpy as np import numpy.typing as npt from ase.build import sort from ase.calculators.calculator import Calculator from ase.constraints import FixAtoms from ase.geome...
f83006d35ef56888fba4382ecf83d8592100e1f3721f9925d4b47caf9ab63286
Python
27,862
600
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # =========================================...
2dbd24451d5dd1430b95ce772f901c3b609c8eda0795e1a7da8d8f931b57a9f1
Python
27,876
762
import logging import random from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Mapping, Optional, Tuple, TypeVar, Union, ) import numpy as np import pandas as pd import pyarrow from packaging.version import parse as parse_version from ray._common.util...
5a93c3f58f7a7fc3890ea30d320fc01526ef62bc179649df279d98300759aa16
Python
27,923
648
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
76dbaa04bc7d8b943c5e6c46f4dd1291fc89f4c0fa36f86f6be7602ce48141ce
Python
27,924
751
# Modified from https://github.com/dbolya/tide # This work is licensed under MIT license. import math import os from collections import OrderedDict, defaultdict import numpy as np from pycocotools import mask as mask_utils from .ap import ClassedAPDataObject from .data import Data from .errors import (BackgroundError...
0f90c3889ebe0bc5e8a2ba42fd3468a4607741b011f5ae7f8b0907cb47523aa6
Python
27,930
709
import argparse import hashlib import logging import math import os from pathlib import Path from typing import Optional import jax import jax.numpy as jnp import numpy as np import optax import torch import torch.utils.checkpoint import transformers from flax import jax_utils from flax.training import train_state fro...
1682e41fd890febd7e5197842fdd07cb0ba12b425fc42e08e8d1e62df0e3a587
Python
27,960
739
"""Autoscaler monitoring loop daemon.""" import argparse import json import logging import os import signal import sys import time import traceback from collections import Counter from dataclasses import asdict from typing import Any, Callable, Dict, Iterable, List, Optional, Union import ray import ray._private.ray_...
85bfd5218a6378475af6bdcbfe7962f55c2462a33c4479c7ca4fc5a1ea7a0545
Python
27,982
882
import logging import pickle from dataclasses import dataclass from functools import wraps from typing import ( TYPE_CHECKING, Dict, Generator, Iterable, List, Optional, Tuple, TypeVar, Union, ) import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt from matpl...
95d4e88aeec47190c3084f3c7e2532b0643635989e233929412d8be7f572767d
Python
28,001
654
# -*- coding: utf-8 -*- """General utility functions and dynamic simulation tools used in neural space-time model paper.""" from typing import Tuple, Union, List from os import path import yaml import numpy as np from PIL import Image from flax.struct import dataclass from skimage import data, transform import skimage...
e251c157714610bee81881ef37d61c35f25f40d8f41363dfb3e255f517f5595d
Python
28,008
711
# -------------------------------------------- # Class for computing modules on adata object: # Updated: 06/13/21 # OUTDATED, use SCMODULE package instead # -------------------------------------------- import glob import h5py import re import gzip import numpy as np import pandas as pd import time import gc import os i...
f2564f1280dcb7bfd03df0084e09148ce748babb411d8a400458f6a4bba1ad75
Python
28,010
726
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024, 2025 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # pylint: disable=too-many-locals, too-many-arguments, possibly-used-before-assignment """Low level implementation of torch-based ...
9ec8b6faf50155f6c16911453efdd393842f8ad8001f54f6fea0c92aef6bcb59
Python
28,032
682
import math import numpy as np import torch from ..utils import common_functions as c_f # input must be 2D def logsumexp(x, keep_mask=None, add_one=True, dim=1): if keep_mask is not None: x = x.masked_fill(~keep_mask, c_f.neg_inf(x.dtype)) if add_one: zeros = torch.zeros(x.size(dim - 1), dty...
884534005036f901f3f977babf0be469c6de559715e0389c6eebd2ec4fc8e119
Python
28,045
784
"""Phase diagram analysis """ import multiprocessing as mp from itertools import repeat import numpy as np import matplotlib.pyplot as plt def fit_pmem(data, iter_max : int = 5000000, error_max=1e-8, eta=.05, method='donders', init_zero=False, verbose=False): """Fit binary multichannel data to the ...
2ed519e9dd2584310e5736edb6d8a21f623179203776e93f407fe656a33844a4
Python
28,054
838
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
2a1679826b22ab4fb0cd706cd9779a358292027cdf0998c55d7d9908bb101622
Python
28,083
747
""" Data reading functions for OmicVerse. This module provides functions for reading spatial transcriptomics data, particularly from SpaceRanger output (both bin-level and cell segmentation data). """ import pandas as pd import numpy as np import json import os import sys from pathlib import Path from typing import L...
f2fd475addc4a587e3ed4c046e081b2c62fb67b3f0e94092cf53f2c1da13c39d
Python
28,103
591
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
2821babc9dea88910dfd71ad05e37a043dfa87c6e540bb7f117311d6cd99261d
Python
28,111
670
#!/usr/bin/env python #### OBSOLETE #### OBSOLETE #### OBSOLETE #### OBSOLETE #### OBSOLETE import argparse import os import sys import json import itertools import dxpy import dxencode as dxencode #from dxencode import dxencode as dxencode import json # NOTES: This command-line utility will run the long RNA-seq pipe...
8b5316b9d210f9ab0ce3b56b5ba55c54a9411aee059ad7af689b0778577e1c88
Python
28,141
508
# -*- coding: utf-8 -*- import math import copy import os import torch import random import anndata #import cmcrameri import numpy as np import scanpy as sc import networkx as nx import torch.nn as nn import matplotlib.pyplot as plt from scipy.spatial import distance_matrix from torch_geometric.nn import GCNConv, Deep...
7d0b5a87bd3bb95ca595bac3f98d0638245fd82573f1a4c354cc4c5530e1e183
Python
28,145
546
# -*- coding: utf-8 -*- """ # # SCRIPT: TRAINING THE DECODING MODEL USING FMRI DATA # # PROJECT: FMRIREPLAY # # WRITTEN BY QI HUANG 2022 # # REFERENCED TO LENNART WITTKUHN, SCHUCK NICOLAS, 2021 # # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY """ # In[1]: import releva...
73b1f918d8ca77f7aa15382f6be1d807b49560bd326e37700c4bab6abff249d0
Python
28,159
879
####################################################################################################################### # This script handels the loading and processing of the input dataset for cell segmentation with Unet # # Contains the pytorch lightning DataModule ...
dc32d3414e29173b2af582683c2399d128b00645fe6d33bc23c6f03bf734bae1
Python
28,168
739
from __future__ import annotations import re from functools import lru_cache from pathlib import Path from typing import Mapping import numpy as np import pandas as pd import scanpy as sc from .._registry import register_function _LIANA_PRIMARY_COLUMNS = ("source", "target", "ligand_complex", "receptor_complex") _...
7864e23bb3d950cd38ba7b8eb7fcf9767b3cf81998b677d31604f6322177f28b
Python
28,175
741
import argparse, os, sys, datetime, glob, importlib, csv import numpy as np import time import torch import torchvision import pytorch_lightning as pl from packaging import version from omegaconf import OmegaConf from torch.utils.data import random_split, DataLoader, Dataset, Subset from functools import partial from ...
f85d3a861fffcaa6f9c4da54ad4eb8e47610e52f3e3bc13208a7ba0596a47c56
Python
28,206
697
import logging import sys from pprint import pformat from scipy.sparse import coo_matrix, vstack from typing import Dict, List, Optional, Union, Set import numpy as np import pandas as pd import copy import torch from deeprvat.utils import calculate_mean_std, standardize_series_with_params logging.basicConfig( fo...
6f6c02b3f7f2527fd19fa1050ffb82cd3f4996fcab3616d5fec440bc10215291
Python
28,209
538
from setup import * def get_general_ts_all(test_type): """ A generic function used to get all the rows of a specific general touchscreen test. After the csv is generated, it will ask for the user to save the file in a directory. Used for Habituation 1 and 2, Initial Touch, Must Touch, and Mus...
fed80012c5b7ca4d0ddbce4c37920b09ae7426eb7a13c832076fd6ac5f9efd78
Python
28,217
874
import copy import json import logging import os import re import time from functools import partial, reduce import google_auth_httplib2 import googleapiclient import httplib2 from google.oauth2 import service_account from google.oauth2.credentials import Credentials as OAuthCredentials from googleapiclient import dis...
dda9830e31c6e4198b3693223e179048af1fe459439ca0a06b20ea9242ee37dd
Python
28,260
720
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
04c3be0314b32793ea7398cc287cb35a01a9ea1e352b5f9c48da21ff937f3ba8
Python
28,267
655
# coding: utf-8 import argparse import time import math import os import copy import torch import torch.onnx import torch.nn as nn import torch.optim as optim import numpy as np import logging import random import data torch.multiprocessing.set_start_method('spawn') torch.set_num_threads(16) ###...
9be07a304bbdd41f1bd6be937ad9a4aebc88d4d6397bffefdf3beae0bed010fd
Python
28,281
771
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import datetime import errno import json import logging import os import random import subprocess from abc import ABC, abstractmethod from col...
3b61f88a62783fa54eda8a7c29afa28128a140649a22f765bac6cecbbdd3dc13
Python
28,282
730
r""" This module contains the definition of the AnalysisDataStructure API and implementation of some basic analysis data structures. For more documentation refer to :doc:`mozaik.analysis` """ import mozaik import numpy from mozaik.tools.mozaik_parametrized import MozaikParametrized, SNumber, SInteger, SString logger ...
78c37cabed35cc1f1cd652cb42f34d337df47516b0fdf8f81f7d5054f5e62a85
Python
28,320
718
import contextlib import math import re import time import cv2 import numpy as np import torch import torch.nn.functional as F import torchvision from ultralytics.yolo.utils import LOGGER from .metrics import box_iou class Profile(contextlib.ContextDecorator): """ YOLOv8 Profile class. Usage: as a deco...
4217c2922eb4292209737636343e55e419bfdf2361c93a511b92d9416f98cabf
Python
28,331
582
#################################################################################################### # Copyright (c) 2023, EPFL / Blue Brain Project # Author(s): Nadir Roman <nadir.roman@epfl.ch> # Adrien Fleury <adrien.fleury@epfl.ch> # Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is p...
91dba053c5eeb1f6fbcb0a9c6e522a7492483e178d8435e1644b27fa7fd84d72
Python
28,331
704
#!/usr/bin/env python # ============================ # ===== EXPERIMENT SETUP ===== # ============================ # ----- CALLING PACKAGES ----- from __future__ import absolute_import, division from psychopy import prefs from psychopy import sound, gui, visual, core, data, event, logging, clock, colors from psychopy...