sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
dad14c5c229bed662cd9760245c9c499d3b424cedfde3fa6385bddaa81aee8aa
Python
7,445
136
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import json import types import zipfile from pathlib import Path import torch from ultralytics.nn.modules import Detect from ultralytics.utils import LOGGER from ultralytics.utils.export.engine import _NormalizeCo...
c97dfaebffbc2b4ab4717e3d4874f8ffd4b69f054f1a3fc950de822904257b35
Python
7,447
211
import copy import numpy as np from numpy import convolve from scipy.interpolate import pchip from scipy.signal.windows import gaussian from mc_analysis.utils.absolute_paths import IRF_PATH def interp_pchip(x, y, x_smooth): """1D PCHIP interpolation.""" func = pchip(x, y) return func(x_smooth) def con...
187be4b0d6c63d8f95e54aba0ab3294a0b5b2cda18c5e6b843a7c9fa9c51845e
Python
7,449
196
# -*- coding: utf-8 -*- """ Created on Wed Nov 6 19:33:28 2019 @author: Yoshi """ import os import numpy as np import tifffile as tiff import csv import pandas from roi_zip_reader import * from key_reader import * from cell_and_background_array import * from data_sorter import * from data_reader import * from dfo...
bfa8638be2ecc60d86c6fa49359caaf977b5a7c8947f3c1a65f120bb9a280f46
Python
7,449
202
import fcn_megfmri import numpy as np import pandas as pd import seaborn as sns import scipy.stats as stats import matplotlib.pyplot as plt # get custom colormaps cmap_seq, cmap_seq_r, megcmap, megcmap2, categ_cmap = fcn_megfmri.make_colormaps() plt.rcParams['svg.fonttype'] = 'none' plt.rcParams['font.sans-serif'] =...
7c667f52bb452484e88ab77b7c02622f36d3079111a4a1bd6a739f00da7de4cf
Python
7,455
353
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Segment, mask and bin 'MB-STn' files """ import os import matplotlib.pyplot as plt import numpy as np import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_processing as pro import mbflim.image.image_set_processing as setpro import ...
3d134b08ca2a14ad90dd083ef3acc7884ffd4cddc205d3955165bb8413a471fb
Python
7,456
217
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from collections import OrderedDict from datetime import datetime, timedelta, timezone from typing import Any, Callable, TypeAlias, cast import attrs import cvat_sdk.auto_annotation as cvataa import PIL.Image from .agent_driver import ( AgentFu...
5cee187d5e91c5541cd74c2f315648b79514a8363185926f060d93a240ba7d8d
Python
7,456
176
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from typing import Any import torch from ultralytics.data import YOLODataset from ultralytics.data.utils import get_split_fraction from ultralytics.models.yolo.detect import DetectionValid...
fd1c6130abfe33b752bb2096b533c6d21b5265e6261e0c650fb0b352e1e08081
Python
7,456
133
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mosaic_dialog.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObj...
11b8c60a0afb19cb645e9dfad8d1cad7b27ef9bc9ee64c5b641ecc5aff79ebb3
Python
7,459
138
"""This scripts generates 3 examples where we regress HR real scans from multi-modal LR scans. Specifically we regress HR T1 scans from LR T1 and T2 scans. We assume here that HR label maps are available with corresponding T1 scans. Thus this script produces pairs of real HR T1 scans along with aligned HR synthetic sca...
09a4ce05728ea66ae1eb248c21803de1aebdf3e4f7b0cd2ba77e465529ed988a
Python
7,460
207
from __future__ import print_function import numpy as np from PIL import Image import cv2 import os.path as osp import torch from torch.autograd import Variable import h5py def srgb2rgb(srgb ): ret = np.zeros_like(srgb ) idx0 = srgb <= 0.04045 idx1 = srgb > 0.04045 ret[idx0] = srgb[idx0] / 12.92 r...
2bf4de8dccb99c412c9e5462ff3612d28dabed49d66d4bec2c8886cc857ae31d
Python
7,460
229
import os import glob import numpy as np import h5py from em_util.io.box import compute_bbox_all from tqdm import tqdm from nicety.conf import get_conf from joblib import Parallel, delayed from scipy.interpolate import splprep, splev, interp1d from sklearn.decomposition import PCA from cloudvolume import Skeleton from ...
d98db625c72294bfe490b62e92c52fa3a2095ab02c46c4937c8f3d8f4ba855cb
Python
7,460
170
from typing import Optional, Callable, List, Union import numpy as np import tensorflow as tf import pickle from ..config import TF_COMPLEX, NP_COMPLEX from ..helpers import random_gaussian_batch from ..tensorflow import MeshLayer, SVD def complex_mse(y_true: tf.Tensor, y_pred: tf.Tensor): """ Args: ...
5779f911ac9f252d832adc0bf492f53ec36cfa2aafba82f1aa069ad432a63ee7
Python
7,462
259
from collections import deque import numpy as np import pandas as pd import scipy.sparse import scipy.spatial import scipy.stats import sklearn from tqdm import tqdm from nest import get_neighbor_adjacency class GaussianExpressionModel: def __init__(self, dim=16, pca=True): self.dim = dim self.u...
c36c23d98969cd857f2113afae0cea07aa3085490a89aaaf1e80f5192f28a2ec
Python
7,462
353
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Segment, mask and bin 'MB-Gn-cond' files """ import os import matplotlib.pyplot as plt import numpy as np import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_processing as pro import mbflim.image.image_set_processing as setpro imp...
320341fc59488de88b37d527945d0192d3f47b6e4b268cb20763fab971245f69
Python
7,463
195
import numpy as np class Stimulation: def __init__(self, fname, depvar_sort=True): self.load_data(fname) self.fname = fname # if depvar_full is None: # depvar_full = [] # else: # self.depvar_full = depvar_full if depvar_sort: self.depvar_sort() ...
befa522511cd11114e42e26244e9409be9ffc6f8998eca09a6ab1229126c5c89
Python
7,463
353
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Segment, mask and bin 'MB-Gn-cond' files """ import os import matplotlib.pyplot as plt import numpy as np import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_processing as pro import mbflim.image.image_set_processing as setpro imp...
74f053e43fdeb153fa6a079e056882f84439b62174b300d9a7323c478964bc45
Python
7,464
211
from __future__ import annotations import json from pathlib import Path import numpy as np import pytest from PySide6.QtWidgets import QFileDialog from pytestqt.qtbot import QtBot from labelme._shape import Shape from .conftest import MainWinFactory @pytest.mark.gui def test_actions_follow_image_and_shapes( *...
12bac0d00021f5aaa382b1fc774868d7031f623d8b735e22a57c970b612c3950
Python
7,466
238
import re from pathlib import Path from typing import Literal, Optional import numpy as np import pandas as pd import scipy as sp import skimage import tqdm def apply_affine(T: np.ndarray, X: np.ndarray) -> np.ndarray: """Apply homogeneous-coordinate affine matrix T to each row of of matrix X of shape (N, 3)...
8e45b19b23b51d2834c0d6fb4f46248447ff7e0b7893971238431e2c252d9db9
Python
7,466
187
import sys sys.path.append('..') import inspect import torch import torch.nn as nn import torch.nn.functional as F from copy import deepcopy from typing import Dict, Any, List, Optional from common.utils import get_regression_pred from common.mapping_utils import CONV_MAP from models.graph_models import GraphModel def...
b03377d7813cd1b23eff1ccde5f5fe7229d796a5d1544d21fcf059efe72c7c49
Python
7,466
354
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Segment, mask and bin 'MB-ABn-cond' files """ import os import matplotlib.pyplot as plt import numpy as np import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_processing as pro import mbflim.image.image_set_processing as setpro im...
436700ab8431f88eef9d770375127a50cb8753dec090c99c84ec9261ed25e043
Python
7,467
180
#!/usr/bin/env python # -*- coding: utf-8 -*- import math import torch import torch.nn as nn import torch.nn.functional as F def nearest_neighbor(src, dst): inner = -2 * torch.matmul(src.transpose(1, 0).contiguous(), dst) # src, dst (num_dims, num_points) distances = -torch.sum(src ** 2, dim=0, keepdim=True...
71de6a4cf397b5aa2bae4b0ceebe65704ee6b7d488ebbc94ceb7832436552f8c
Python
7,467
213
import torch import torch.nn as nn import torch.nn.functional as F class TemporalSpatialBlock(nn.Module): """Temporal-spatial feature extraction block""" def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super(TemporalSpatialBlock, self).__init__() self....
7effe1c7e40bdbd0e2017320cccec74c6ad91c4cdbdc1ed5d0c9ad632c78d849
Python
7,469
298
# -*- coding: utf-8 -*- import json import os import sys from dataclasses import asdict, dataclass, field from multiprocessing import cpu_count from torch.utils.data import Dataset # ==================== # 工具函数 # ==================== def get_default_process_count(): """ 获取默认进程数 Returns: int: 默...
dde78f1e1674e245b9d91f39d7cb7994d406cede5f7f89e07eafd7620804a112
Python
7,471
182
import torch from torch import nn from torch.nn import functional as F #from models.networks_other import init_weights #### From Attention UNet Otkay et al. 2018 class GridAttentionBlock2D(nn.Module): def __init__(self, in_channels, gating_channels, inter_channels=None, dimension=2, mode='concatenation', ...
87be4f4cb21e48b1b6b0246c1b00327c62fe34c0c3b9eb8b1860ac9f72478e46
Python
7,472
162
import numpy as np import tensorflow as tf from src import TGCNN_layer class TGCNN_Model(tf.keras.Model): def __init__(self, num_filters=2, num_nodes=97, num_time_steps=100, filter_size=3, variable_gamma=True, exponential_scaling=True, dropout_rate = 0.2, lstm_units=16, fcl1...
a014b04ab515ba672f8b4854439d1891faeb50757808ab77cb8c2c30230444af
Python
7,472
130
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'focuslock.ui' # # Created by: PyQt5 UI code generator 5.8.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjec...
a19ef5b8ad3bb0657e47e5e22d2229e108ad53c32924f88adf12a9e85a54d76d
Python
7,472
218
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from enum import Enum from django.db import models from drf_spectacular.utils import extend_schema_serializer from rest_framework import serializers from cvat.apps.engine.models import Project from cvat.apps.engine.serializers import BasicUserSeria...
dd4a30a64ed144e287b03051f75ba9fb8c0164e2ee36fa089b513018a6dde6c1
Python
7,475
188
import glob import logging import os import warnings import h5py import numpy as np import pandas as pd import plotly.express as px import torch from sklearn.metrics import accuracy_score, auc, f1_score, precision_score, recall_score, roc_curve from sklearn.model_selection import train_test_split from deeprank2.datas...
e4e672fece747eb69eae453bacf6211f494668adca98f6d2b47f3805d627d307
Python
7,477
202
import argparse import glob import os import random import sys import csv import tqdm import numpy as np import torch from torch.utils.data import Dataset, DataLoader import pytorch_lightning as L from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.strategies import DDPStrategy from lightnin...
b5ddb636106bef1b7d0a87b795746bf0f9dd94a8fec26856e2a1f40546b105a0
Python
7,483
162
import argparse import utils import plotting import keras from keras.models import Model import tensorflow as tf from os.path import join import numpy as np import gc import yaml from model_zoo import MPRAnn_heteroscedastic ''' get the average of the predictions from all MPRAnn models trained with heteroscedastic in ...
74b87cd5122ef77e53c86886a46de701db0b66ec00e74cef3d330ad4663ecba8
Python
7,484
226
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from enum import StrEnum from typing import cast from django.conf import settings from rest_framework.exceptions import PermissionDenied, ValidationError from cvat.apps.engine.models import Job, Project, Task from cvat.apps.engine.permissions impor...
79380ff54d9364331387f5d392845ae6affd19621bda640d53ed9bef624243a5
Python
7,485
188
"""Is a matched pair really the same cell? Ask its activity. ROICaT matches on ROI footprint and position, so a spatial control cannot distinguish "the same cell" from "a different cell in the same place". This validates matches with signals the matcher never saw, after UnitMatch (van Beest, Bimbard et al.), which val...
7a5bdac6ca7101ccb410326e0756c2d05eeac6b7e03be3d07fa30e6dc6a0c26f
Python
7,486
249
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ """ import os import open_clip import torch import numpy as np from tqdm import tqdm from PIL import Image import cv2 from ..utils.io_helpers import check_outputfile def extract_clip_features( vr: object, params: dict, output_dir: str, ...
ebe84d076c67df316541fd1879f1989eacde30e16ff1af298730c7f966b5964a
Python
7,486
197
"""Prepare the NSD-core betas in fsaverage space. Parameters ---------- subject : int Number of the used NSD subject. train_test_session_control : int If '1', use the train and test splits consist of image conditions from non-overlapping fMRI scan sessions. zscore : int Whether to z-score [1] or not [0] the fMRI r...
428a5f6e76934a14ba9c80e40a752fe0faf82c06f0eb034117df96b5bdc98437
Python
7,487
164
""" Interfacing between causallib and sklearn to take advantage of sklearn's hyperparameter search machinery (e.g., GridSearchCV). Wraps causallib's models and scorers to look like sklearn's, and wraps sklearn's hyperparameter search models to look like causallib models. """ from typing import Type from sklearn.model_...
295b91d4dbe38b61bd0691c256c024749715df8de74cafe470a09feec551d061
Python
7,488
192
# -*- coding: utf-8 -*- """ Contrast-to-noise ratio of functional time series (task-based activation) This scripts calculates the contrast-to-noise ratio (CNR) in percent from functional time series containing task-based activation following a block design. The input can be a list of several runs. From the condition f...
fdd6329be73f15252fb5c8d6722df413b1cf3839e6f16dd9ac4698e59ba614a8
Python
7,488
245
"""Multi-layer perceptron.""" from typing import Any import torch from torch import nn import numpy as np from modules.linear import SpikingLinear, SpikingEiLinear from modules.norm1d import SpikingBatchNorm1d, SpikingEiNorm1d from modules.activation import LIF from utils.dim import AddTemporalDim, MergeTemporalDim,...
843a7909b540709fd1220a1b4a67b4d90d287a26f8ed6a2b200911eddd4a7391
Python
7,491
185
from pydantic import BaseModel, Field, model_validator from typing import Union, Optional, Any, List, Type from chemgraph.models.atomsdata import AtomsData from chemgraph.models.calculators.tblite_calc import TBLiteCalc from chemgraph.models.calculators.emt_calc import EMTCalc from chemgraph.models.calculators.nwchem_c...
2a28ac9144ab47c1b8a5b88510bc369ba90ee0f2352e3f90e01ab15665323337
Python
7,493
180
# Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717) # Github source: https://github.com/DingXiaoH/RepLKNet-pytorch # Licensed under The MIT License [see LICENSE for details] # Based on ConvNeXt, timm, DINO and DeiT code bases # https://github.com/facebookresearc...
8c3179dc147026b8727ea082851a9bbedf80a504b54a9e65f6b326ab7dab9b8c
Python
7,493
204
# %% # imports per usual from typing import Any, Callable, List, Optional, Tuple import torch import torchvision from torch import nn from torchvision.datasets import VisionDataset # %% # Helper function so the Dataset returns the supa raw emo class label # Now must feed in the class list as an arg, in the event tha...
2d3ff28a2a456d133ffae85dbe6d8cfe3bfefc1c8f3f6980bedd15376d79c1b9
Python
7,494
236
"""Strategy 1. Align code with destvi, make notebook run 2. Remove all duplicate code 3. Push """ import logging from typing import Optional, OrderedDict import numpy as np import torch from anndata import AnnData from scvi.data import register_tensor_from_anndata from scvi.dataloaders import DataSplitter from scvi...
7e3fbc9e10a274a0fc21e02519e28bbeae7120341842b1004279f7061569b5d0
Python
7,494
133
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import plotting_related_functions import KC_population_calcium_rate_model_functions as mdl import os from sympy import nsolve from sympy.abc import x,y,z rng = np.random.default_rng(666) # Set random seed # Get the MBON ...
a5101d50d5a3463acd6a2a38db957a8a1ffdb19ca1546b0796f6ba80befea759
Python
7,496
206
import numpy as np import pandas as pd from obspy import UTCDateTime from obspy.clients.fdsn import Client import seisbench import seisbench.util from .base import WaveformBenchmarkDataset class DummyDataset(WaveformBenchmarkDataset): """ A dummy dataset visualizing the implementation of custom datasets ...
cc97058a4a6cf44fffbebbde793fd969aa0aa4ef7715a39ca0ee7e2cbb0d5ec7
Python
7,496
148
"""Export fixed paper membership from Excel without accessing any image files.""" from __future__ import annotations import argparse from collections import Counter, defaultdict import csv import gzip import hashlib import io import json import os from pathlib import Path, PurePosixPath FIELDS = ["sample_id", "source...
b51c64785372c7043fe11d0c98ce4241c453e8ebc108989aae16819a15c44728
Python
7,497
249
"""LangGraph workflow for the RAG (Retrieval-Augmented Generation) agent. This graph combines document retrieval tools (load_document, query_knowledge_base) with the standard chemistry tools so the agent can answer questions grounded in user-provided text documents *and* run molecular simulations when needed. Graph s...
2635ec0afe534ecc12f0ac5c9e4d8070c5fa1ebb9efeb4b3858b58f6b4f04d57
Python
7,500
213
""" Evaluate Classifier Predictions Modified from PDX PPTC Machine Learning Analysis https://github.com/marislab/pdx-classification Rokita et al. Cell Reports. 2019. https://doi.org/10.1016/j.celrep.2019.09.071 Gregory Way, 2018 Modified by Krutika Gaonkar for OpenPBTA, 2020 This script evaluates the predictions made...
a68e214c4f8d2de1d707d784821b567781a22253794a01164b2bce1e93a051ef
Python
7,500
180
import logging import unittest import numpy as np import pandas as pd import scipy.stats as stats import diffxpy.api as de class TestVsRest(unittest.TestCase): def test_null_distribution_wald(self, n_cells: int = 2000, n_genes: int = 100, n_groups: int = 2): """ Test if de.test_wald_loc() genera...
5524c1eb99589974eb38865b50e02b606aa76c3eebde9866e7c811d4808e45b8
Python
7,501
250
""" Unit Tests for H-FNO Models Run with: pytest tests/test_models.py -v """ import pytest import torch import sys from pathlib import Path # Add parent directory sys.path.insert(0, str(Path(__file__).parent.parent)) from hfno import HFNO, HFNOConfig, FNO, FNOConfig from hfno.models import SpectralConv2d, SpectralC...
6c81890c88c9f9686ab87b21981b3b99ff17484b72cc126f1ad2913788d89359
Python
7,503
180
from PUMI._version import get_versions import argparse import ast class BidsApp: def __init__(self, pipeline, name, bids_dir=None, output_dir=None, analysis_level=None, participant_label=None, working_dir='.', run_args=None, description=None, **kwargs): if description is None: ...
586cd7d72c399151f208eb7270e8069d0ab4bace700ea7bed9bc4f781c908d1d
Python
7,505
200
#!/usr/bin/env python """Agent + MCP + Globus Transfer + Globus Compute demo. LLM agent on the laptop drives a local ``mace_mcp_hpc`` subprocess. With both Compute and Transfer env vars set, the MCP server auto-registers the transfer tools (``mace_mcp_hpc.py:310-313``). The agent is told to (a) stage the demo's struct...
0399c0cb0f45768b778c33bcb8bba2f363f2f96cd329d9873eae52fc5690a4e5
Python
7,506
213
""" Generate observer-ignoring behavior from single player dataset and compare with social condition data. """ # import sys # import os # sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ...
7ab0af8539ac8c2c3334c8885c96126f081e7ad948c821e4995c79a42ad00bc4
Python
7,507
247
import logging import numpy as np import pyfocus __all__ = ["train_model", "METHODS"] LASSO = "LASSO" GBLUP = "GBLUP" ENET = "ENET" METHODS = [LASSO, GBLUP, ENET] def _lrt_pvalue(logl_H0, logl_H1, dof=1): from scipy.stats import chi2 from numpy import clip, inf epsilon = np.finfo(float).tiny lrs...
5290dddeb562f31047ae28d116148c591cc6579cfd2e277f61c156b99b4bba14
Python
7,509
231
# 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, ...
7e341151456e9f7f6f30102ba77420abaf1e3ea7adb08098eda6a842d9687ea5
Python
7,510
212
from collections.abc import Callable from dataclasses import dataclass from functools import partial, update_wrapper from pathlib import Path from typing import Any import numpy as np import polars as pl import torch from PIL.Image import Image from eir.data_load.data_preparation_modules.input_preparation_wrappers im...
78ded533acbff72a00def70aaebfc1b904375176ad507fff97e830f3cad4d9be
Python
7,514
182
# Copyright 2016 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. import numpy from scipy import stats from nab.detecto...
8c83ae59e7c3ef72a26b9ca28ffd99995d1c5610f5f09efc7d043a2423cc8604
Python
7,514
203
# coding: utf-8 """Compatibility library.""" import inspect from typing import TYPE_CHECKING, Any, List # scikit-learn is intentionally imported first here, # see https://github.com/lightgbm-org/LightGBM/issues/6509 """sklearn""" try: from sklearn import __version__ as _sklearn_version from sklearn.base impor...
f2f6c5e69e4de6e806a73d5525595413af93bae6f3a3627efd92f51f6e2c89d9
Python
7,515
230
# 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, ...
b6215c34933917a630a13018ecfa999d7feb45e6465b660f00f8513661fe2998
Python
7,518
197
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from pathlib import Path from ultralytics.utils import LOGGER, SETTINGS, TESTS_RUNNING, checks try: assert not TESTS_RUNNING # do not log pytest assert SETTINGS["dvc"] is True # verify integration is enabled import dvclive assert ...
7d4a2535431023edd659c5c937f261993a741e84163f7b75bdee2b429347eda5
Python
7,521
197
from joblib import Parallel, delayed import numpy as np from nilearn import image import nibabel as nib import seaborn as sns import matplotlib.pyplot as plt from connattractor import network def get_attractors_per_timesample(timeseries, hopnet, threshold=0): def workhorse(ts_i): activity = timeseries.loc[...
decf9686cf54f7108ff5c7e3407937fbb83096e50366f6ad874e8581232a14ec
Python
7,521
236
"""Per-exchange artifact attribution for the ChemGraph Streamlit UI. All queries in a chat share one log directory, so "newest file in the directory" heuristics attribute artifacts from later queries (or stale files from unrelated runs) to earlier exchanges. Instead, the UI snapshots the log directory before each age...
425dcb036ef1c154515bfab6d1dde325babbd39cf7efbb988fbee732734639d0
Python
7,525
176
"""Pydantic schemas for MACE Parsl simulations. These schemas define the API contract for MACE single and ensemble calculations dispatched via Parsl. """ from __future__ import annotations from pydantic import BaseModel, Field class mace_input_schema(BaseModel): input_structure_file: str = Field( descr...
71c34b42aa5bb0c31ffc8c77eea53e6666966fc5e74871121c8a51157365b45e
Python
7,525
224
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from abc import ABCMeta, abstractmethod from collections.abc import Callable from typing import Any, ClassVar import django_rq from django.db.models import Model from django_rq.queues import DjangoRQ from rest_framework import status from rest_frame...
540793a525fa10a84621e2b4e1a2ac37767ec9cef04e226431ffe6edabebfe5f
Python
7,526
158
"""Tests for the activation-cache stimulus-identifier contract. Regression guard for the Zerbe rdm/cka family, which lost caching entirely because the benchmark synthesised an identifier that no registered plugin matched. See :mod:`brainscore_vision.benchmark_helpers.cache_contract`. """ from __future__ import annotat...
bdbac4a7db753b03a2455c8e355b82748432a980fb8d65388a7c034ed57552d5
Python
7,528
230
import torch import numpy as np import pandas as pd from tqdm import tqdm from datetime import datetime as dt from dataset_tool import fast_merge,df_to_mask import os print('loading raw data') node=pd.read_json("../datasets/Twibot-20/node.json") edge=pd.read_csv("../datasets/Twibot-20/edge.csv") label=pd.read_csv("../...
2f664c7a6310ba7fc40319e8be31f19ab3d962b835276a4fc0c777651b73d89c
Python
7,530
180
import pandas import json import torch import os.path as osp from tqdm import tqdm from torch_geometric.data import Data from torch_geometric.loader import NeighborLoader from model import BotGAT, BotRGCN import torch.nn as nn from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score ...
ca47acb54bdb2ea79d912fb91dd888d70434264078c20808b9f73d12097c4eb9
Python
7,530
173
# -*- coding: utf-8 -*- """ Created on Sat Oct 16 15:48:15 2021 @author: Yoshi """ import os import shutil import math import statistics import numpy as np import matplotlib.pyplot as plt import pandas as pd from numpy.polynomial import Polynomial def bandwidth_analysis(path,key,cell_flags,correlation_coefficients...
3c9ebb1b11a29c09cb73a914d18778e3c4620452532a77fc135c7c459017e744
Python
7,531
178
# 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. import torch from torch import nn from torch.nn import functional as F from typing import Any, Dict, List, Tuple from .i...
00b585796a8bf9cf4af809ada920ba80b2bfbd3f4c352ec9247490d1dff40ace
Python
7,532
227
# -*- coding: utf-8 -*- import unittest import arbor as A from arbor import units as U import numpy as np """ tests for cable probe wrappers """ # Test recipe cc comprises one simple cable cell and mechanisms on it # sufficient to test cable cell probe wrappers wrap correctly. class cc_recipe(A.recipe): def __...
1a39d1a61f55e3c3fb8a32365f701becbe69f2d8db65fba61ed2c3212350fc54
Python
7,534
209
"""Test network constructor and BaseModel and KANModel integration.""" import copy from collections.abc import Generator from itertools import product import pytest import torch from omegaconf import OmegaConf from mcmlnet.training.models.base_model import BaseModel from mcmlnet.training.models.kan_model import KANM...
dc9d4310be238718f7f2faa062183fa962a3dac7507df484a7af016c2992506d
Python
7,537
249
from __future__ import annotations import json import numpy as np import osam import pytest from numpy.typing import NDArray from labelme._automation._text_detection import MaskOutputUnavailableError from labelme._automation._text_detection import get_bboxes_from_texts from labelme._automation._text_detection import...
0117eacdbcf98de64f031ff43b96ad23a0d735b529511cfa0aab22c919f6d4dc
Python
7,540
177
"""Test node cartography / modularity-dependent metrics parity with MATLAB. Run from the repo root:: uv run python python/test_pipeline_cartography.py Modularity (community detection via Louvain + consensus clustering, ``modularity.py``) is inherently stochastic — MATLAB's own runs aren't bit-reproducible across...
1ad39c06096eaf4ee94a5c98127fb24e5db60c6c966423ae7425443c2a8311c1
Python
7,542
209
# Brandon Amos, J. Zico Kolter # A PyTorch Implementation of DenseNet # https://github.com/bamos/densenet.pytorch. import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.autograd import Variable import torchvision.datasets as dset import torchvision.transforms as ...
f05e54a37c43f836271750a54794e6cc6a9a5c23d388001a96ac3f97759f7b5b
Python
7,543
298
# -*- coding: utf-8 -*- """ Spyder 编辑器 这是一个临时脚本文件。 """ import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd ############ data prepare res18fp_x = np.load('S-ResNet18_FP_x.npy') res18fp_y = np.load('S-ResNet18_FP_y.npy') res18fp_x = np.delete(res18fp_x, 1...
30c0074b9947fdf91df02ea3b71a92d956410d3ddd0029f2fc61f0bb9d35b095
Python
7,544
178
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np import sys import os from datetime import datetime from tf_agents.environments import utils from tf_agents.distributions.utils import SquashToSpecNormal f...
5c76e4944413f5db9424ed6e3a7b35571614eb9d9591341110136c03e02bff9e
Python
7,544
195
"""Fast regression tests. None of these need the models or the reference database. Each test corresponds to a defect that reached a release or a release candidate, so a failure here means a bug we have already shipped once is back. """ import subprocess import sys import textwrap import numpy as np import pandas as p...
8a78e2ac31be11033dcc6b63b50a03f5c57c76db0f99d52b84942a8d2fb1e0d0
Python
7,547
214
import json from pathlib import Path # Define notebook categories. Note the order is retained in the website. MODELS_NOTEBOOKS = [ 'ipw.ipynb', 'standardization.ipynb', 'doubly_robust.ipynb', 'TMLE.ipynb', 'rlearner.ipynb', 'xlearner.ipynb', 'causal_survival_analysis.ipynb', 'matching...
283f60bdb72e97efd7fb191284b25fcf33c8ce86390803ce40a00a040ce55c2c
Python
7,548
198
import numpy as np from mat73 import loadmat import os import pandas as pd def save_datastructure( path="datasets/DataFromVahid", expert=True, save_video=True, save_clusters_info=True, ): """Transforms the matlab file with the data in a folder structure that can be loaded easily to a pytorch datas...
68873d86773d553465cfbb17e2741fb709a758d6887ce2ecd30c9650ce8681ea
Python
7,549
127
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'galvo.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(...
885b8fd2ccfb8ee27c02d3a382e2951622fdcbc2af2bbca375aaf71d40f5f246
Python
7,549
200
''' Modified from https://raw.githubusercontent.com/pytorch/vision/v0.9.1/torchvision/models/resnet.py BSD 3-Clause License Copyright (c) Soumith Chintala 2016, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions a...
165a25cb0fa0f8348d6def9c378974701cde6c4b21bd0c2956279235ce9620ff
Python
7,550
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
4862490ad2992edcb4d9ec356b58e79852c64d7a81415cd50f71c894343cd03a
Python
7,550
147
"""Acquire public audit inputs without overwriting or silently refreshing them.""" import hashlib import json from datetime import datetime, timezone from pathlib import Path from urllib.request import Request, urlopen from urllib.error import HTTPError ROOT = Path(__file__).resolve().parents[2] MANIFEST = ROOT / 'me...
4a8f3b9f51abab8607f4f158909f2084cb01486316c5fd5455884a9b9d57b7fd
Python
7,550
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
8a1650f96627733ea0a4a926bb549b67cae8529d8246c4503860d89c87166405
Python
7,550
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
c32bf3cff372b265da0dc0ef836c5d72092cacdc892a775ca87dc94f3e8fbf97
Python
7,550
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
2c9f40998b02bd14932321b56bac5054ead486b143462453bf1c259fd09d5786
Python
7,553
279
# -*- coding: utf-8 -*- """ Interface to tif image files and stacks. The interface makes use of the tifffile library. Example: >>> import os, numpy >>> import ClearMap.IO.TIF as tif >>> from ClearMap.Settings import ClearMapPath >>> filename = os.path.join(ClearMapPath,'Test/Data/Tif/composite.tif') ...
5a31741dc8304337f1bcb9b543ad58928b067a2d8ec5a6d437d423689bf45f27
Python
7,553
235
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import pysam from pathlib import Path from statistics import median impor...
ece9dc0a3bf2c17465700121a86a3504d38e8b6cd737499b86d29e0b20f0cc1f
Python
7,553
77
import utime # Segment 1: The ECG Signal Data # We use a tuple of tuples for better memory efficiency on the Pico # Fixed Segment 1: All inner braces replaced with parentheses ECG_SIGNAL1 = ( (53,79),(52,78),(50,76),(47,74),(44,72),(41,70),(37,68),(34,67),(31,66),(28,65),(26,64),(24,62),(22,60),(21,58),(20,5...
1a7884aba847c0891707dbf796a5032af97ca5e87a5eed2ffe00f8fec7303fc2
Python
7,556
227
from pathlib import Path import json import pytest from chemgraph.tools.ase_tools import ( run_ase, get_symmetry_number, is_linear_molecule, ) from chemgraph.tools.cheminformatics_tools import ( smiles_to_atomsdata, molecule_name_to_smiles, ) from chemgraph.schemas.atomsdata import AtomsData from ch...
7523b0882d931a8cebdfe6c6ade2858bc3ba1b03ab8c1d8a4ffee820db3b1774
Python
7,557
141
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 5 16:05:31 2024 @author: Amit Jaiswal, Megin Oy, Espoo, Finland <amit.jaiswal@megin.fi> USAGE: * This script is meant to check the quality of ICA applied through MEGnet and override the ICA application with user's own selections. ...
c75a09b488c6b2c2dd7561ab08b39676bd6ce3ad1efe7726c96e084229c2097f
Python
7,557
235
#!/usr/bin/env python # author: Jannes Spangenberg # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import pysam from pathlib import Path from statistics import median import numpy as np import json import sys from...
68f7bf27d7708858064ea26f0000b822907cdd9bcff213fb4fd4b891577669f5
Python
7,558
188
"""Custom state initializers with permanent properties between trials""" import numpy as np import collections from moog import sprite from . import poll_generator from moog.state_initialization import distributions as distribs class ParentStateInitializer(): def __init__(self, agent_0_factors, agent_1_factors, ...
0dfd4e3c72a88dc081892218c677104e705d556af32c31e30f1af366e601fccb
Python
7,561
207
#!/usr/bin/env python """ This script is used to extract sequences from bed file. USAGE getseqfrombed.py {OPTIONS} <.bed file|-> <reference .fasta file> OPTIONS -b/--seqerror [error file]\tSpecify the positional error profile to be used. The file should include at least 100 lines, each containing a positive numb...
18f8d151c8767bc28be9d2ca4eb055557d14b40fd9c13f956caab67022569859
Python
7,561
184
import torch import torch.nn as nn from torch_geometric.nn import GATConv, global_mean_pool from torch_geometric.utils import add_self_loops class GSR(nn.Module): """ Graph Structure-Recognition (GSR) model for molecular property prediction using Graph Attention Networks (GAT) - TChemGNN from the paper. ...
739c7eef0b514b345406aac6766b79b01c89091486cd4ca987ee91302e68257a
Python
7,561
196
import copy import io import socket import subprocess from concurrent.futures import ThreadPoolExecutor from pathlib import Path from typing import Any, Dict, Generator, List import numpy as np import pytest from sklearn.datasets import make_blobs, make_regression from sklearn.metrics import accuracy_score TESTS_DIR ...
7d75c41bd2193d50ead5e3cb7fd3dd45bd2595b3ec0a707fcd61dfc2a2c62955
Python
7,561
189
# /------------------------------------------------------------------------------+ # | 19-JUL-2022 | # | Copyright (c) Bone Imaging Laboratory | # | All rights reserved ...
b56cf00a37d3f5c15d41493b5405fb2940ca2ae2261cacc4b153e16a134b1f60
Python
7,561
190
from bread.data import Features, Segmentation, Lineage import networkx as nx import pandas as pd import numpy as np from numpy.linalg import norm import cv2 __all__ = ['build_cellgraph'] def build_cellgraph(feat: Features, time_id: int, cell_features, edge_features, return_df: bool = False, seg: Segmentation = None)...
039151bc3d576269e21dfa6b9c4827df5a18d2de3cefc74933e5129b0f3bcb90
Python
7,562
221
import json from collections.abc import Callable from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np from aislib.misc_utils import ensure_path_exists from sklearn.preprocessing import KBinsDiscretizer, LabelEncoder, StandardScaler from eir.target_setup.target_setup_utils import IdentityT...
24af09b73fe808d3f029caf22f2d8c884487ee1865f997f9e4db3c4f16eaa3b7
Python
7,565
262
from dataclasses import dataclass from functools import partial from typing import ( TYPE_CHECKING, Literal, Protocol, TypeGuard, Union, ) import torch from torch import Tensor, nn from eir.models.input.array.models_cnn import CNNModel, CNNModelConfig from eir.models.input.array.models_locally_con...
cd63a0c3bb8f9ba3020584123c9cde8a3a130d36ba82464bf66cdf1d80d9c5da
Python
7,567
208
import pandas as pd import numpy as np from sys import argv import pickle as pk import os import random import xgboost as xgb from sklearn.preprocessing import MinMaxScaler def add_into_single_df(list_of_dfs): df = pd.concat(list_of_dfs) df = df.reset_index(drop=True) df["locus"] = pd.factorize(df["filenam...
e0e8e8fc8700b54951c9d7c1baa50517e3a63ac76b8ee72e8670ee95dd683fc2
Python
7,567
211
#!/usr/bin/env python3 """Audit cached pretraining clips using canonical kinescope kinematics modules.""" from __future__ import annotations import argparse import pathlib import numpy as np import pandas as pd import matplotlib.pyplot as plt from kinescope.kinematics import ( angle_features, corr_lr, g...