sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
5aa30fb4ffe6a05fc00d27b5584581022586633fab57ab99f1f7b1555debfd61 | Python | 14,992 | 408 | # coding: utf-8
"""Helper script for generating config file and parameters list.
This script generates LightGBM/src/io/config_auto.cpp file
with list of all parameters, aliases table and other routines
along with parameters description in LightGBM/docs/Parameters.rst file
from the information in LightGBM/include/Light... |
507a1d1e974015e834d0e4150202836a05b999d1b0a04d0f85ff57dbb662f2fb | Python | 14,994 | 432 | # -*- coding: utf-8 -*-
import requests
import hashlib
import os
import shutil
import sys
import tarfile
import time
import typing
import zipfile
from pathlib import Path
from tqdm.autonotebook import tqdm
import numpy as np
import six
from six.moves.urllib.error import HTTPError
from six.moves.urllib.error import URL... |
cb32b52aa439f0e0b8b70480322e5ef1e0bbed9868b59394f7a02cd43b9d0b78 | Python | 14,995 | 438 | # 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 math
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from .multihead_attention import ... |
68ebc6c3e09212de2c5c3479b29f3a353d6a76eb3e1d65d663a76be530a9fb8b | Python | 15,004 | 502 | import json
import os
import random
from collections.abc import Sequence
from pathlib import Path
from unittest import mock
import pytest
from aislib.misc_utils import ensure_path_exists
from transformers import PreTrainedTokenizer
from eir.setup import schemas
from eir.setup.input_setup_modules import setup_sequence... |
d3306b0f44257bcf24bdac0a83c3a4a56831d4f0e125d901a0c8c5ee3f2f6f1c | Python | 15,005 | 348 | import numpy as np
np.set_printoptions(legacy='1.25')
from matplotlib import pyplot
from matplotlib import gridspec
from scipy import optimize
from PatchAnalPlots import line
SEC_PER_MIN =60
######## This function calculates averages across experiments
def exp_avg(datas, datatype=None,somethreshold=999e6):
if not... |
a1a2a593a7b8e0d3c7f51f84c41f29bb9a0b18855762536c9b750a253a02506f | Python | 15,007 | 338 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 29 23:05:13 2025
@author: Lukas Oesch
"""
from chiCa import * #Mke sure to be inside the chiCa folder
import chiCa
import pandas as pd
import numpy as np
from labdatatools import *
import os
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "Arial"
from glob ... |
2823cbb2448fc450e7b8c11c121343d106edceff2dec9945c6ed39b2ed7f54ae | Python | 15,009 | 428 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""Various utility models"""
import copy
import math
import weakref
from collections.abc import Iterator
from contextlib import AbstractContextManager
from enum import auto, Enum
from typing import Dict, List, Optional, Union
import numpy as np... |
004ea83713e153e39b5ece458949028ac59470b28df744dfb4b0316e4a923ce4 | Python | 15,017 | 294 | """SGCN runner."""
import time
import torch
import random
import numpy as np
import pandas as pd
from tqdm import trange
import torch.nn.init as init
from torch.nn import Parameter
import torch.nn.functional as F
from utils import calculate_auc, setup_features, train_test_split
# from sklearn.model_selection import tr... |
2c2505a3943ad236cfc1df34d0aebd4b6d7e5896f6e31092eb900f3dd63bc574 | Python | 15,022 | 519 | #!/usr/bin/env python3
"""Serial gradient-based symmetry refinement for MuscleX calibration refinement."""
from __future__ import annotations
import math
import time
import cv2
import numpy as np
from scipy.optimize import minimize
try:
from musclex.utils.fold_symmetry import _compute_fold_symmetry
except Except... |
4ae81e96eac339d0f8a0c757add9e970c3fd5ce3647dbaae2e66991dad32867e | Python | 15,022 | 384 | """Tests for mcmlnet.training.optimization.analytical_baselines module."""
import copy
import numpy as np
import pytest
import torch
from mcmlnet.training.optimization.analytical_baselines import (
AnalyticalModelConstants,
compute_mu_a,
compute_mu_s_prime,
jacques_1999,
modified_beer_lambert,
)
... |
0ec3105b78a1c3a7707330298e0e5d44a179e361fe347ece33b8435a3872542a | Python | 15,024 | 331 | import gensim
import sklearn, sklearn.datasets
import sklearn.naive_bayes, sklearn.linear_model, sklearn.svm, sklearn.neighbors, sklearn.ensemble
import matplotlib.pyplot as plt
import scipy.sparse
import numpy as np
import time, re
# Helpers to process text documents.
class TextDataset(object):
def clean_text(... |
b8744cc62c590613443b79437c5bd4d0bdace195cf6fb809523570233e44c0f6 | Python | 15,027 | 479 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
from copy import deepcopy
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
from sklearn.neighbors import NearestNeighbors
from uac.element import Element
from uac import utils
import uac.vars as var
# Create the parse... |
9383211709d9af9d26efae20b322da2eb24fe8085a3d1ad3204785fe8c7cf0f6 | Python | 15,030 | 560 | """Miscellaneous utility classes and functions."""
import os
import inspect
import logging
import pickle
import sys
from copy import copy
from pathlib import Path
from shutil import rmtree
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import yaml
from yaml.constructor import ... |
497ad8749cf42abc3db3182ad5e5bb5b49923d35df701ac002d76f263014ef40 | Python | 15,044 | 496 | # laminar_rs/graph_metrics.py
from __future__ import annotations
from typing import List, Tuple
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
from scipy.stats import f_oneway
import hcp_utils as hcp
# ---------- rich club, most common members ----------
def rich_club_sweep(connectivity_m... |
1dc3b43616b77150aba735871afef533cb33bb5ed35ff03d1ea46123fe828810 | Python | 15,047 | 455 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""
Transforms and data augmentation for both image + bbox.
"""
import math
import random
from typing import Iterable
import PIL
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as F
from sam3.model.box_... |
9ddf8dcb6d8dc0d1891b7eee2cf58b8ec6d65a093cad6904be74f9fba5afa155 | Python | 15,050 | 448 | # -*- coding: utf-8 -*-
from enum import Enum
import numpy as np
from fury import actor, window
from fury.utils import get_actor_from_polydata
from scilpy.utils.spatial import get_axis_index
class CamParams(Enum):
"""
Enum containing camera parameters
"""
VIEW_POS = 'view_position'
VIEW_CENTER ... |
dc118b59c7a4779d9903ed825ec9dd0eb5adefce8d60a6f78f71270a014b8e3f | Python | 15,051 | 329 | import logging
import os
import atom3.case as ca
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
from absl import flags, app
from dgl.data import DGLDataset
from torch.utils.data import DataLoader
from project.utils.deepinteract_constants import NODE_COUNT_LIMIT, RESIDUE_COUNT_LIM... |
f04d4a4329b040533a44097b32da5c05cc64d7d841ab9edfa4d7f771ef81d653 | Python | 15,051 | 345 | """Test the encoding model's prediction accuracy in-distribution (using 284
NSD-core's shared images), and out-of-distribution (using NSD-synthetic's 284
images).
Parameters
----------
subjects : list
List of the used NSD subjects.
train_test_session_control : int
If '1', use the train and test splits consist of ima... |
35b552e4ccd478a446af58456283fe7716248f1212533ed31060b36b2fdce2fd | Python | 15,052 | 362 | """Module allowing for ray-casting operations and measurements
Source code taken from: https://bitbucket.org/somada141/pycaster
This module contains the `rayCaster` class which allows for ray-casting
operations to be performed on any mesh represented by a 'vtkPolyData'
object.
The class uses the `vtkOBBTree` class to... |
e87a62203ee1a679d31edda54a99657e3fbb4a4e529ec790d08813a63ad8ca4a | Python | 15,054 | 299 | import argparse
import random,os,sys
import numpy as np
import csv
from scipy import stats
import time
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.metrics import roc_auc_score
from sklearn import preprocessing
import pandas as pd
import keras
import keras.ba... |
8a15c3afa5d7fc27bcccf9a4428e180a565b2e706ac6a8039bcca3d9732a1100 | Python | 15,058 | 306 | #!/usr/bin/env python
# author: Jannes Spangenberg
# e-mail: jannes.spangenberg@uni-jena.de
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import numpy as np
import read5_ont
import multiprocessing as mp
import pysam
import sys
from argparse import ArgumentDefaultsHelpFormatter, ArgumentPa... |
c6592755c2192472c96b2ffbefed4b84bb7b0b44f2474782f4afe73996b10d77 | Python | 15,058 | 438 | import attrs
import numpy as np
import rastermap.utils
from functools import cached_property
from matplotlib.axes import Axes
from rastermap import Rastermap
from scipy.interpolate import interp1d
from typing import Literal, TYPE_CHECKING
from argclz import AbstractParser, argument
from neuralib.persistence.cli_persis... |
36568a15463992cf6f568a187b9dab96f9f056b8d1a1a54fff6ce0d363cca3a9 | Python | 15,063 | 521 | import math
from typing import Literal
import torch
import torch.nn.functional as F
from einops import rearrange
from torch import nn
from torchvision.ops import StochasticDepth
from eir.models.layers.attention_layers import SwiGLU
from eir.models.layers.norm_layers import GRN, LayerScale
from eir.utils.logging impor... |
55895ab4e38f331e3452d8e70111e8b920df21078f6c16679419aeb3e2757305 | Python | 15,065 | 375 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import numpy as np
class EnsembleModel(nn.Module):
'''Combine two pytorch models'''
def __init__(self, modelA, modelB):
super(EnsembleModel, self).__init__()
self.modelA = modelA
self.modelB = modelB
self.inpu... |
f6b1c4e6094b6625d80de6505e8b9705a0ea021da2b1acbdd81e47eee8a0c9dc | Python | 15,067 | 445 | #!/usr/bin/env python3 -u
# Copyright (c) DP Technology.
# 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.
"""
Train a new model on one or across multiple GPUs.
"""
import argparse
import logg... |
40c7302984f72182b396f41404ee78b80708beb10b8ac38405e6201f52364b43 | Python | 15,074 | 327 | #!/usr/bin/env python
# author: Jannes Spangenberg
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pysam
import seaborn as sns
import sys
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespa... |
732f8e742390215f51611fd14887e892d46ecc6e12833259d9f05a64fae45bc8 | Python | 15,076 | 310 | import sys
import os
from pathlib import Path
script_dir = Path(__file__).parent
project_root = script_dir
while not (project_root / 'Deps').exists() and project_root.parent != project_root:
project_root = project_root.parent
# Add project root to the Python path if it's not already there
if str(project_r... |
d797f701a22347001d780b0dc4d0f2f5cabdfefb895c36bbab084ceb2dfc4000 | Python | 15,078 | 355 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import copy
import cv2
import numpy as np
from ultralytics.utils import LOGGER
class GMC:
"""Generalized Motion Compensation (GMC) class for estimating camera motion between video frames.
This class est... |
b20244bc02c345f7a9948d920fab02ba6f3605ea055400805cb58c0feeecaa7a | Python | 15,080 | 376 | import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange, repeat
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
import timm
class ConvBNReLU(nn.Sequential):
def __init__(self, in_channels, out_channels, kernel_size=3, dilation=1, stride=1, norm_layer=nn.B... |
8fc4c8aa2afc42911ba46c15bbfe120b490909f1c4f7b519bdd310998e67c81a | Python | 15,086 | 343 | """
This module selects data based on task_variable and implements cross-validation.
"""
import numpy as np
import pandas as pd
# select data based on task_index
def tdrSelectByCondition(
data,
task_index,
crossvalidate="none",
min_trials=10,
p_test=0.5,
random_seed=0, # random
):
rng = ... |
941bd0034a4e41f18d44e4154b46cea30a4e074f4ec06cf3ac44b01a77fcde03 | Python | 15,092 | 389 |
import numpy as np
import imageio
import os
import pandas as pd
from glob import glob
import matplotlib.pyplot as plt
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
class Stimulus:
def __init__(self, size_px=[448, 448], bit_depth=8,
stim_id=1000, save_dir='imag... |
663cf7994f4b736efe04dfcaddd1cef46703b4019a88a43c489c8d05fcb84e21 | Python | 15,102 | 411 | # 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, software
# distributed under the... |
0502908ec3a6684669321c9dfdee6183edecc33b96d0135386f899044726e609 | Python | 15,106 | 324 | """Contains some helper functions for processing images."""
import math
from typing import cast, Literal, TypeAlias
import matplotlib.cm
import numpy
from numpy.typing import NDArray
from PIL import Image
BorderMethod: TypeAlias = Literal['fill_zeros', 'fill_ones', 'edge_repeat', 'mirror_edge', 'wrap_around']
"""Re... |
1e84ba99051370ab376c09a27f6e774bde327688d84077a0492ff52308ac6546 | Python | 15,113 | 380 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import torch_geometric.transforms as T
import torch.nn.functional as F
import yaml
from math import ceil
from torch_geometric.data import InMemoryDataset, Data
from torch_geometric.loader import DenseDataLoader
from torch_geometric.nn impo... |
c22f4195540546a03667a2ab72343b2b1e6052fd7555cca1c30a836657b8c897 | Python | 15,114 | 365 | #!/usr/bin/env python3
__doc__ = \
"""The Developmental Cognition and Neuroimaging (DCAN) Labs fMRI Pipeline [1].
This BIDS application initiates a functional MRI processing pipeline built
upon the Human Connectome Project's minimal processing pipelines [2]. The
application requires only a dataset conformed to the BID... |
a892bd92125cd9898384e69f618cbd7b8fa4f4801af40b00929dd8751d22cd42 | Python | 15,115 | 276 | from typing import Optional, Union, Tuple, List
import numpy as np
import tensorflow as tf
try:
import torch
from torch.nn import Parameter
except ImportError:
pass
from .helpers import butterfly_permutation, grid_permutation, to_stripe_array, prm_permutation, \
get_efficient_coarse_grain_block_sizes, g... |
018537f7cf1d616c48c3cf903fd1698529cc09c8598b992b85c1ac2bd36bd477 | Python | 15,121 | 331 | #! /usr/bin/env python
"""Export a quantified surface (.vtp) to a colormapped OBJ + MTL for Blender etc.
A surface mesh from the pipeline carries per-triangle quantifications (curvature,
thickness, distances, patch ids, ...). This writes the geometry as a Wavefront
OBJ, with one chosen quantification baked into the su... |
62da1ede3bb95a25c8d8bfdd86cd5c698ab73eb145e6b04c220c757d7f02bb7e | Python | 15,121 | 341 | """The Run tab: start one analysis, or work through a queue of them.
These were two tabs, and most of each was the same tab. Both had a Run button
and a Stop button, both had a progress bar with an estimate under it, both had a
log — duplicated widgets, duplicated wiring, and a guard in the window to stop
someone star... |
3111a405a748136e031e5fa7057608978faeff26d3ebbf59477bebbb7f8c4286 | Python | 15,126 | 362 | #!/usr/bin/env python3
"""
Main manuscript - Figure 6: SpinWalk simulation orientation dependence
3x2 subplot layout showing relative changes in R1 and R2 as a function of fiber-to-field angle:
- Left column: All SpinWalk simulations with in vivo data overlay
- Middle column: 3T simulations only (detailed view)
- Righ... |
afd946b72730bb673f9daee7596ab4487cc33d1aac3f5ff483da278d922549e3 | Python | 15,129 | 315 | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from torchvision import transforms as T
from .utils import gaussian_kernel, circular_kernel, gabor_kernel
EPSILON = 1e-5
class Identity(nn.Module):
def forward(self, x: torch.Tensor, *args) -> torch.Tensor:
ret... |
ab390f1db269eacd7252c098c02f959f99f25f36cf086327fa6ff898a43aaf60 | Python | 15,137 | 345 | """
Algorithm: Static_IO
==============================
"""
# Windows users have to encapsulate the code into a main function to avoid multiprocessing errors.
# def main():
import pygpc
import numpy as np
import matplotlib
matplotlib.use("Qt5Agg")
import os
import matplotlib.pyplot as plt
import pathlib
from enum impor... |
477bf3b317cb74d1ff12ded4ca1708a20d2aa7a421015a5cbcd6044b6532f649 | Python | 15,140 | 506 | import skoots.train.loss
from typing import Dict, Tuple
import torch
from torch import Tensor
from tqdm import tqdm
import skoots.train.loss
from skoots.validate.utils import imread
def mask_to_bbox(mask: Tensor) -> Tuple[Tensor, Tensor]:
"""
Calculates the 3D bbox for each instance of an instance segmentat... |
ae3d251e4898df76bcd72e0fd54a46fadcedb6c9dd2f7b9aa0c3f97a61444b28 | Python | 15,140 | 404 | import os
import cv2
import numpy as np
import SimpleITK as sitk
from collections import defaultdict
from sklearn.cluster import KMeans
from sklearn.linear_model import LinearRegression
from scipy.ndimage import (
binary_erosion, binary_dilation, gaussian_filter1d, binary_fill_holes
)
from skimage.filters import ... |
2ada91628d99fb46c8f494fa1df178a64f4a902feade3fbd3d2ccd1189161b8f | Python | 15,142 | 383 | from __future__ import print_function
import torch
import numpy as np
from scipy.sparse import issparse
import pandas as pd
import anndata as ad
import ruptures as rpt
from scipy.spatial import cKDTree
import gc
import scanpy as sc
import torch.optim as optim
from torch.optim.lr_scheduler import MultiStepLR
from .model... |
94452e70d2f1227efa91b06805bdab1a3d1059faf7a709bd103a75ce47991110 | Python | 15,142 | 383 | from __future__ import print_function
import torch
import numpy as np
from scipy.sparse import issparse
import pandas as pd
import anndata as ad
import ruptures as rpt
from scipy.spatial import cKDTree
import gc
import scanpy as sc
import torch.optim as optim
from torch.optim.lr_scheduler import MultiStepLR
from .model... |
379ada9b31903f6a63173766ae789e62b9bce007bc63ebe8aab7e28cbcdcd0bc | Python | 15,146 | 358 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import torch
from torch import nn
from ultralytics.nn.modules.utils import _get_clones
from ultralytics.utils.ops import xywh2xyxy
def is_right_padded(mask: torch.Tensor):
... |
f3f94a198cf8a12de42a74c60a6d730e4957b7ef2006c23ac78c304ac7d914be | Python | 15,146 | 256 | from .base_classes import LearningRule, BiasLearningRule
import torch
from EIANN.utils import get_scaled_rectified_sigmoid
import math
class BTSP_19(LearningRule):
def __init__(self, projection, neg_rate_th=None, dep_ratio=1., dep_th=0.01, dep_width=0.01, max_pop_fraction=1.,
temporal_discount=0.... |
476dcae355c00ca3ec9ad75f944bfd36a0c477a6e10c2bad6d62742c7b98e496 | Python | 15,148 | 409 | #!/usr/bin/env python3
"""
Script to compare two different runs from melanoma_runs.csv
This script performs statistical comparisons between two runs:
1. Q-Q tests (normality tests) for each run individually
2. Independent samples t-test to compare the two runs
Usage:
python compare_runs.py <run_id_1> <run_id_2> <... |
71c698d2b6cbf5a62eafa5f12106fdf3bff676102adf1aed2287df3b3990b4e0 | Python | 15,148 | 372 | # 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 numpy as np
import torch
from torchvision.ops.boxes import batched_nms, box_area # type: ignore
from typing impor... |
3057ceb3de0cc9903062e36255be232013018a52c03f6f90e71803eb050eb922 | Python | 15,150 | 372 | # 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 numpy as np
import torch
from torchvision.ops.boxes import batched_nms, box_area # type: ignore
from typing impor... |
14121f5339bc0bca58905311a2097c6b845df6277097b32be93f3c75bbb75aed | Python | 15,163 | 611 | import coolpuppy
from coolpuppy.lib import io
from matplotlib.colors import LogNorm, LinearSegmentedColormap
from matplotlib.ticker import LogFormatterSciNotation
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from coolpuppy import plotpup
import pandas as pd
from matplotlib import gridspec
#... |
0b5a072279ae4d6d1a6a3e28cad8615ab9f87ebeabb097959f2988b11befb4b0 | Python | 15,172 | 357 | from __future__ import division
import numpy as np
import scipy as s
import pandas as pd
import numpy.ma as ma
import os
import h5py
from mofapy2.core.nodes import *
from mofapy2.core.nodes import *
# To keep same order of views and groups in the hdf5 file
# h5py.get_config().track_order = True
class saveModel():
... |
11baa6b203541461d8e36f75537178f06f12eec812d1234b79699d732583da71 | Python | 15,173 | 447 | # import tensorflow as tf
import numpy as np
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Layer
from tensorflow.keras.layers import Conv1D
from tensorflow.keras.regularizers import Regularizer
from tensorflow.keras import initializers
import scipy.interpolate as si
DNA = ["A", "C", "G", "T... |
1a171d4186ece56b0336b763e4be9df0a8e279b0516e48684e17b6abea67365c | Python | 15,180 | 440 | from PySide6.QtWidgets import (
QMainWindow,
QDoubleSpinBox,
QTabWidget,
QWidget,
QStyleOptionTabWidgetFrame,
QStackedLayout,
QSlider,
QGraphicsPixmapItem,
QGraphicsView,
QGraphicsScene,
QDockWidget,
QLabel,
)
from PySide6.QtGui import QPainter, QPen, QPixmap, QColor, QFo... |
3ae4b9d3baac61985d1c82cf28489c3a0aaabb4f92b93a9c690bf0ef09b81487 | Python | 15,181 | 359 | import copy
import warnings
from typing import List, Optional, Tuple, Union
import torch
from torch import Tensor
from torch_geometric.data import Data, HeteroData
from torch_geometric.data.datapipes import functional_transform
from torch_geometric.data.storage import EdgeStorage
from torch_geometric.transforms impor... |
c2ab498097f658498328a0f9aa396c3ceedd5b88f20303b173456167e7ecd430 | Python | 15,183 | 335 | from fastai.vision import *
from utils.nms_WSI import non_max_suppression_by_distance, nms
from object_detection_fastai.helper.Evaluator import *
from utils.detection_helper import *
class BBLossMetrics(LearnerCallback):
"Add `loss_func.metrics` to metrics named by `loss_func.metric_names`"
_order = -20 #Needs... |
0b958f6e594adbea4b540f45c5c2c22741cc27a912506f80e26b48ae3db18ff3 | Python | 15,189 | 325 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or
... |
0fd7788442211d640618f467ff1e452978300299dfac772443571b766cadff1f | Python | 15,192 | 303 | """
PyVISAScope provides an interface to different scopes.
Copyright (C) 2016 Ye-Sheng Kuo <yesheng.kuo@gmail.com>
Copyright (C) 2019 Julius Zimmermann <julius.zimmermann@uni-rostock.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publi... |
443032872470de2856dbd412f7be1331bf2062947237f2cd65949efe9b846831 | Python | 15,193 | 402 | # 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, ... |
0081da994771416b52e3f996eee17b1943a928ab9cfa16a37ac5aab0f2f332d9 | Python | 15,196 | 425 | import os
import glob
import random
import monai
from os import makedirs
from os.path import join, basename
from tqdm import tqdm
from copy import deepcopy
from time import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from dateti... |
31877718e93f6b4eaddfb216a0e5252029f83692964dada632311a017a4c4324 | Python | 15,198 | 427 | # encoding : utf-8
"""This module implements filtering functionailty for core nelpy objects."""
__all__ = ["sosfiltfilt"]
import ctypes
import sys
from copy import deepcopy
from itertools import repeat
from multiprocessing import Array, cpu_count
from multiprocessing.pool import Pool
import numpy as np
import scipy.... |
6bcf3806101e41153a68222baac8c7edea75e7f9fafe4b65723ec03cfca9f180 | Python | 15,201 | 407 | # 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
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional, Tuple, Type
from .common... |
ad214deb32cc41f87e30b5879eef9d6d2656c200a29f49734ac1e4fe465497fd | Python | 15,204 | 489 | #!/usr/bin/env python
import sys
import tempfile
import os
import gzip
import shutil
def main(options,libl):
pool_junc_reads(libl, options)
refine_clusters(options)
sort_junctions(libl, options)
merge_junctions(options)
get_numers(options)
def pool_junc_reads(flist, options):
outPrefix ... |
fddddd96e919dbe53078b00cb21b4eac6d7e66804696ebc2ecb352c05d787d8f | Python | 15,216 | 385 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import yaml
import torch_geometric.transforms as T
import torch.nn.functional as F
from math import ceil
from torch_geometric.data import InMemoryDataset, Data
from torch_geometric.loader import DenseDataLoader
from torch_geometric.nn impo... |
7fb9c88ce3971f0d3140c74bc228538dbff8a6f49d031822955339046edd215d | Python | 15,219 | 339 | #Lucas Sancéré -
import os
import matplotlib.pyplot as plt
import numpy as np
import yaml
from attrdictionary import AttrDict as attributedict
#############################################################
## Load configs parameter
#############################################################
# Import parameters va... |
52ecd41eea01933fab4c294736e92b53a5b24c10b95bae623dcf14e3a4f3ef89 | Python | 15,223 | 123 | """Regenerate reporting tables from frozen outputs, without refitting/selecting tests."""
from pathlib import Path
import hashlib, json, itertools
import numpy as np
import pandas as pd
ROOT=Path(__file__).resolve().parents[2]
T=ROOT/'tables/transcriptomics'
def md(frame):
def f(v):
if isinstance(v,(float,... |
cb6e324133d8ea218ff004db8366854c7d94123216ea20ab9a94caa3860a8dd3 | Python | 15,232 | 371 | ##########################################################################################################
### Script to extract the time series of activated/most active cell assemblies from spike raster data, ###
### and to compute probabilities of activation and transition, ###... |
e9eee3938dbc70a90b52e00439d0c9af44977dc95cb8670361468cbb42783a7c | Python | 15,232 | 385 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Kathrin Rack, Annette Lutz
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... |
1f1eb38fd1fc6e86d88d2ae1229476001374a61deeef106db5da78a81d6a6de9 | Python | 15,237 | 442 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... |
c5caef8143b546ea9f5c8be0b7234eaf46ee8f0d5675cbc2f8304646880ca676 | Python | 15,239 | 372 | # This file is part of Zennit
# Copyright (C) 2019-2021 Christopher J. Anders
#
# zennit/image.py
#
# Zennit is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your ... |
0a334f87be5d04b293872bb36f7cac9101d66983c88958e2425233b7cf25b523 | Python | 15,241 | 433 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Maximilian Betz
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... |
3227410f3c3570c8047d241211f26ff57cb46862dee1d114242d846f7868f6bf | Python | 15,241 | 349 | from random import randint as rand
import multiprocessing, functools
import sedef, random
def test_sedef():
seq1 = 'ATCCTTGAAGCGCCCCCAAGGGCATCTTCTCAAAGTTGGATGTGTGCATTTTCCTGAGAGGAAAGCTTTCCCACATTATACAGCTTCTGAAAGGGTTGCTTGACCCACAGATGTGAAGCTGAGGCTGAAGGAGACTGATGTGGTTTCTCCTCAGTTTCTCTGTGTGGCACCAGGTGGCAGCAGAGGTCAGCAAG... |
e5e714df1f5cc0dff073fad39f12383cdd184b1696015931ba4adf4fe6e4c4c1 | Python | 15,242 | 344 | """Network burst detection on a densely firing array.
Run from the repo root::
uv run python python/test_burst_detection.py
Both things checked here were found on ``HCNT26_DIV58_E2``, a 16-channel
recording firing at ~460 Hz array-wide, on which burst detection reported *no
bursts at all* even though its raster ... |
0b9a1d32dfd7a77353ad6551f958d09fc4458830fe72b7f68ba65b9b476bd67f | Python | 15,243 | 418 | # -*- coding: utf-8 -*-
# @Author : LG
import json
import math
import os
from PyQt5 import QtCore, QtGui, QtWidgets
from shapely.geometry import Polygon as ShapelyPolygon
from shapely.validation import explain_validity
from ISAT.ui.annotation_data_tools import Ui_Dialog
# 等宽字体候选:Windows 优先,Linux 兜底(DejaVu/Liberati... |
be6070bd224981c3ffb8a74f9e0fef8fe8ecde7a28c8d61b459e41a7e468bff7 | Python | 15,250 | 473 | #!/usr/bin/env python
import argparse
import sys
parser = argparse.ArgumentParser(
description="", formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument(
"infile", help="input bam file"
) # , type=argparse.FileType('r'), default=sys.stdin)
parser.add_argument("outfile", help="output pl... |
3a7dde09ec958a1845aab7871cae99e74f8994cde3025c011638dc91861ea050 | Python | 15,254 | 558 | from collections.abc import Callable, Sequence
from pathlib import Path
from typing import Literal
import torch.backends
import torch.cuda
from eir.setup.config_setup_modules.config_setup_utils import recursive_dict_inject
from tests.conftest import get_system_info
def get_test_base_global_init(
allow_cuda: boo... |
9670fb07cf59ac7a2e96401ca013be2ea78e6900cc64713017dee7ac6eada8c3 | Python | 15,262 | 495 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: GM
@edited: CD
"""
from __future__ import print_function, division
import nibabel
from scipy import ndimage
import numpy as np
import torch
import matplotlib.pyplot as plt
import math
class LoadNifti(object):
def __call__(self,file):
# Load mri... |
c9d073073270e2a7ffe6b1d65a2d63f9a7a2c65bb5a27d906f1fb8decb4cfbc1 | Python | 15,263 | 338 | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import numpy as np
from models.rec_weight_matrix import *
class PopRSNN(nn.Module):
def __init__(
self,
input_size,
n_units,
pop_per_area=2,
dt=1.0,
tau=[10.0],
n_delay=5,
in... |
596bf2ce27b3c26fdeca60049d57e6540594ad8f13659444462b6e49979b5791 | Python | 15,274 | 346 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# A class to load, parse, and control predefined valve commands, i.e predefined
# changes to the port configurations of a valve chain.
# -------------------------------------------------------------------------... |
ccc91300956c8a32ed8dca1736bc857c9c5527157765d91ffc73fb9369355384 | Python | 15,274 | 284 | """A module that contains processors for pre-processing data and images."""
import typing
from types import FunctionType
from typing import Annotated
import numpy
import skimage.measure
import skimage.transform
from corelay.base import Param
from corelay.processor.base import Processor
class PreProcessor(Processor... |
75f3b376b455454fd7fda7ebec26388bffd8c1aea13185b0c591239a1457dd63 | Python | 15,275 | 306 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from itertools import cycle
from tqdm import tqdm
import matplotlib as mpl
from scipy.stats import sem
import matplotlib.style as style
import pingouin as pg
import numpy as np
def plot_target_roi_merged_hemi(target_roi):
color... |
96751eaeba7b9f5929d5531b42ac15fcb3713223684f77bd697e713cea09e490 | Python | 15,286 | 343 | """Cell types on tracked cells: reading, ID-space mapping, annotation.
The ID-space test is the one that matters. Cell-type files hold raw suite2p
indices while tracking works on iscell positions, and with non-iscell ROIs
interleaved an off-by-mapping bug labels the wrong cell with no error at all.
"""
from __future_... |
bbb6a66545212815f14cad08a3bbe7313272a46736b50e19c6d1e29e5e880a9b | Python | 15,287 | 386 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import yaml
import torch_geometric.transforms as T
import torch.nn.functional as F
from math import ceil
from torch_geometric.data import InMemoryDataset, Data
from torch_geometric.loader import DenseDataLoader
from torch_geometric.nn impo... |
8934c31466c17370806c66629e9b6ce9b0c11366e43b232a5759e3313fff6bc9 | Python | 15,291 | 449 | """Tests for the UI's Codex login status and device-code login helpers."""
import threading
import time
from types import SimpleNamespace
import pytest
from chemgraph.models import codex as codex_model
from ui import codex_auth
class _FakeAccountResponse:
def __init__(self, account):
self._account = ac... |
6f1642182f6e9f7f3739d997365ac57116cea817be6c1dba79cbc408ec053d6e | Python | 15,294 | 438 | #!/usr/bin/env python3
"""
Robustness analysis for laminar gradients: inter-layer coupling weight.
Instead of varying the number of gradients, this script varies the
inter-layer coupling weight used in build_multiplex_adjacency() from
0.0 to 1.0 in 0.1 steps. The off-diagonal blocks of the multilayer
adjacency matrix ... |
ff8290b55c2fb12e30df4dcdbbf321b5584f60847ef0b3d8212c0b20c3988ad8 | Python | 15,296 | 372 | ##########################################################################################################
### Script to extract the time series of activated/most active cell assemblies from spike raster data, ###
### and to compute probabilities of activation and transition, ###... |
609427dd7ec4233b3b19206ec210681ecd185d230b49078c1a48825ffc1ade00 | Python | 15,297 | 378 | import warnings
warnings.filterwarnings("ignore", message="It is not recommended to directly access")
import os
import math
import pickle
from typing import List, Tuple, Union
import torch
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import BRICS
from rdkit.Chem import MACCSkeys
from rdkit impo... |
4cb2748503749ce38f77a9c056b299d1b84403b36d06b1a8b2652a72d2fb7b31 | Python | 15,298 | 377 | """Folding the less-used settings away without losing them.
The risk in hiding settings is not that they are hard to find — it is that a
hidden setting stops being *used*: a value that does not reach ``Params``, a
loaded parameter file that silently drops half of what it carried. So most of
what is checked here is tha... |
77842dcb57c68e6eeaeed8a73c5fd079cd20967c2176daf1f115d5be2b2416d9 | Python | 15,301 | 383 | # -*- coding: utf-8 -*-
# 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 numpy as np
import torch
from torchvision.ops.boxes import batched_nms, box_area # type: i... |
eb5db86b51f61a38c1b26df37dc1623482cbdae6f146f9170a01e2db544effcf | Python | 15,303 | 423 | import sys
import os
import pandas as pd
import numpy as np
import pyreadr
import torch
import glob
import functools
from torch_geometric.loader import DataLoader
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import GCNConv
from torch_geometric.nn import global_mean_pool
from torch... |
8d2b988333e27304658f1767656eb1297b1f62c6bc4ff93d073270f5892b3df2 | Python | 15,309 | 427 | # Utilities
# Author: Zhe Liu, Jinwei Zhang
# Date: 2018-08-26
import numpy as np
import tensorflow as tf
PRECISION = 'float32'
EPS = 1E-8
# Data I/O
def load_nii(filename):
import nibabel as nib
return nib.load(filename).get_fdata()
def save_nii(data, filename, filename_sample=''):
import nibabel as ... |
ce9ce7d19261b0f605f7ea6a5da8c96a21409adf3bb0bb136ff9f35241571731 | Python | 15,310 | 426 | #pylint: skip-file
#type: ignore
"""
Implementation of the simple touch and look task.
"""
import time
import math
import typing
import asyncio
import logging
import datetime
import numpy as np
import os
import stl
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util ... |
dde04ba6212cbbbdff6d8abf914da94bb57e6e58a677051ba457d134c41d583f | Python | 15,310 | 432 | import os.path
import unittest
import tests.base_test
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class StrandedBaseTest(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._test_base_dir = tests.test_config.TEST_BASE_DIR
self._test... |
e65eebfc2e8615702ecee3e80b6e099c32eb4c629f2ec2a2a9680b73ceec897d | Python | 15,310 | 437 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 4 15:28:12 2024
@author: aka2333
"""
#%%
import numpy as np
import scipy
import pandas as pd
# turn off warning messages
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
# system paths
from itertools import permutations,... |
8c07dc7c7366ded59ca3770760c361e6e24b67f1bb40fb9a8cc352541de8d3d6 | Python | 15,311 | 314 | #
# fiberprofile/analysis/gather.py (from FiberProfileAnalysis/gather_profiles.py)
#
# Gather along-tract profiles across subjects/sessions into one CSV per (tract, metric):
#
# <out>/<tract>/<tract>_<metric>.csv rows: Arc_Length samples, columns: one per dataset identifier
#
# Inputs (any mix, searche... |
03c0eb4a10a2ce3f29271afe9f0f6c636337335f10fffe3f3c7cc1357887d348 | Python | 15,314 | 354 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script computes a variety of measures in the form of connectivity
matrices. This script only generates matrices in the form of array, it does not
visualize or reorder the labels (node).
See also
>> scil_connectivity_compute_simple_matrix
which simply computes the... |
818e343a7cbaf3964914e86993b94a47d846a6d90b81a832803bd5cee3958bfb | Python | 15,316 | 358 | from torch import nn
import torch
import torch.nn.functional as F
def aggregate(message, row_index, n_node, aggr='sum', mask=None):
"""
The aggregation function (aggregate edge messages towards nodes)
:param message: The edge message with shape [M, K]
:param row_index: The row index of edges with shap... |
10ef25ae9fbb06ae71e21429a75d694e1b303bd1f300d8a35782c09a092391ac | Python | 15,321 | 318 | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from torchvision import transforms as T
from .utils import gaussian_kernel, circular_kernel, gabor_kernel
EPSILON = 1e-5
class Identity(nn.Module):
def forward(self, x: torch.Tensor, *args) -> torch.Tensor:
ret... |
0a82e3088aa554bf4435e28c71d2f597064f8a8b716fa311847916b39a962427 | Python | 15,323 | 373 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
from __future__ import annotations
from copy import deepcopy
import torch
from ultralytics.nn.modules.utils import inverse_sigmoid
from ultralytics.utils.ops import xywh2xyxy... |
9d1efb8e4d0f145846dd285dba7e55501ce9c1e2062c11417e320c490a72dcb8 | Python | 15,333 | 346 | import sys
sys.path.insert(0, './..')
import os
import numpy as np
import matplotlib.pyplot as plt
from HopfiledNetwork import *
from utils import *
import json
from skimage.filters import threshold_mean
from tqdm import tqdm
import configargparse
import pickle
from torchsummary import summary
global args
parser = con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.