sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5af92bc61f910e88ba8a1a99211a32d23b77a932f64683943750cf8b0ec1afe5 | Python | 6,338 | 277 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-201... |
8a67ddd137897684e34831bf40372122318207000d917fd2246aac232304230d | Python | 6,338 | 168 | import numpy as np
import shap
import matplotlib.pyplot as plt
import cv2
from matplotlib.collections import LineCollection
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.colors as mcolors
# --- Utility Functions ---
def make_cv2_colormap_from_matplotlib(cmap_name='coolwarm'):
c... |
d4a00248fe9c44f0ef1b61500bd3ed6efb38cdfcbbc9fa438e30c120eb8db733 | Python | 6,340 | 184 | from collections.abc import Generator, Sequence
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Any,
overload,
)
import torch
from torch.utils.data import DistributedSampler, WeightedRandomSampler
from eir.data_load.data_loading_funcs import get_weighted_random_sampler
from eir.setup... |
205eed8a0b0b07b2c96638a5fe5b40cd13346e36bede2de05939600768dfa271 | Python | 6,341 | 180 | from functools import cached_property
from typing import Any
import numpy as np
from argclz import AbstractParser, argument, int_tuple_type
from neuralib.plot import plot_figure, ax_merge
from rscvp.spatial.main_cache_occ import ApplyPosBinCache
from rscvp.spatial.main_cache_sortidx import ApplySortIdxCache
from rscv... |
ff69cdf61bcac431e06a161dcdcbe624a5c6ef5d3258f4b4f14f8b9311fb8316 | Python | 6,341 | 176 |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def plot_metrics_stats(means, stds, title=None, xlabel=None,
ylabel=None, figlabel=None, fill_color=None,
display_means=False):
"""
Plots the mean of a metric along n points with the standard de... |
1b955db3e57d4f1285101f8326458e7cbfca994f7139262b0c5ac556a960b636 | Python | 6,342 | 274 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-2... |
449ef6f5edaf3846511250fb58773a883950be5e8866d71ff813ade481b434e0 | Python | 6,342 | 211 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
02316e0ce316994574ccc326bfe56f9309b38668c2d50e2ce7add4fd73e28de8 | Python | 6,344 | 129 | ### script for writing meta information of datasets into master.csv
### for graph property prediction datasets.
import pandas as pd
dataset_list = []
dataset_dict = {}
### start molecule dataset
dataset_dict['ogbg-molbace'] = {'num tasks': 1, 'eval metric': 'rocauc', 'download_name': 'bace'}
dataset_dict['ogbg-molbbb... |
734e7cee2dba13ba2b2597109e91257d479906ad260f769a067ef0a02aaa87d0 | Python | 6,347 | 162 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
# This code is a modified version of the code from the MRIQC project
# available at https://github.com/nipreps/mriqc/blob/master/mriqc/qc/anatomical.py
#
# Copyright 2021 The NiPreps Developers <nipreps@gma... |
c2430c1dbae920a56784796e0766ca5f765ef2b4a253ec2bf9b695e58adeb6d1 | Python | 6,347 | 146 | """
Preparing M/EEG Data
====================
In this tutorial we will go through common ways to prepare M/EEG data. This tutorial covers:
1. Downloading example data
2. Time-Delay Embedding (and Principal Component Analysis)
3. Amplitude Envelope
4. Saving and Loading Prepared Data
"""
#%%
# Download the dataset
# ... |
771ef2d2f5a134ef778b4ff380a99ddad84a05a5d121865b4c7bcb97d77d59e5 | Python | 6,349 | 159 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import threading
import traceback
from datetime import datetime
import rq.registry
from redis import WatchError
from redis.client import Pipeline
from rq.exceptions import AbandonedJobError, InvalidJobOperation, NoSuchJobError
from rq.job import Job... |
a230d04ccfcd2b0e1c14453af06ba58333fde22af0929a5649261ec5771240dd | Python | 6,349 | 181 | import json
import time
import typing
import logging
import asyncio
from ..qt import *
from ..config import ObservableCollection, ObservableDict, ObservableList
from .. import util_pb2
from .. import thalamus_pb2
from .. import thalamus_pb2_grpc
from ..util import IterableQueue
from .util import create_task_with_exc_h... |
b245774977bbb1ad408023892e235c2130dd1d61806437874aeadf4701ce6670 | Python | 6,350 | 209 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""
Misc functions, including distributed helpers.
"""
import collections
import re
from dataclasses import dataclass, field as field_ptr_behaviour, fields, is_dataclass
from typing import Any, get_args, get_origin, List, Mapping, Optional, Sequ... |
18bd87c05a1124125568eb8fcbb20bb4d8737ef873472862cab3c9fb0a0a3543 | Python | 6,351 | 160 | import numpy as np
import ladyns.optimize as mx
def _generate_lambda_glasso(bin_num, lambda_glasso, offset, lambda_diag=None):
lambda_glasso_out = np.full((bin_num, bin_num), -1) + (1+lambda_glasso) * \
(np.abs(np.arange(bin_num) - np.arange(bin_num)[:,np.newaxis]) <= offset)
if lambda_diag:
... |
caab803e4f323512ddfd0b4db86ba8c56cf9c3c6ed46d68d2cec098de3c21fca | Python | 6,351 | 147 | """
Functions for computing and analyzing dSTRFs from NEMS model fits
"""
import numpy as np
import logging
log = logging.getLogger(__name__)
def compute_dpcs(dstrf, pc_count=3, norm_mag=False, snr_threshold=5, first_lin=False,
as_dict=False, flip_sign=True, method='pca'):
"""
Perform PCA on... |
5b3d9a3c75f999ab97f2c788ab9fbe8df2a35a9316dd1de76bd78a3d5ea27526 | Python | 6,355 | 166 | #!/usr/bin/python
#
## @file
#
# Generate XML for Dave given a position list and an experiment description file.
#
# Hazen 05/14
#
import copy
import math
import os
from xml.dom import minidom
from xml.etree import ElementTree
from PyQt5 import QtCore, QtGui
import storm_control.dave.xml_generators.nodeToDict as nod... |
fb40fcc3b74401673cb53ff11021e9a32eb9a2d56e37acd1e1103e64eb8bae40 | Python | 6,355 | 186 | from nipype.interfaces import utility
from PUMI.engine import FuncPipeline, NestedNode as Node
@FuncPipeline(inputspec_fields=['X', 'in_file'],
outputspec_fields=['score', 'out_file'])
def predict_pain_sensitivity_rpn(wf, **kwargs):
"""
Perform pain sensitivity prediction using the RPN signatur... |
7c0b427f9937ee3fe8593fc9ff5de04749d7c025cf36ff27e9aa1f548c75a535 | Python | 6,356 | 178 | import argparse
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from ogb.linkproppred import PygLinkPropPredDataset, Evaluator
from logger import Logger
class LinkPredictor(torch.nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels, num_layers,
... |
b09c2a9b284a31982221a5448395ba8fc3e29392e05830417c12cbe526f70e97 | Python | 6,357 | 171 | # 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... |
7409a1c7cd4ca2f8021ed4ea763a034513ccdfeca11aa84d978b0e17e0458c60 | Python | 6,358 | 187 | import os
from tkinter import W
import numpy as np
import pandas as pd
import torch
os.environ['CUDA_VISIBLE_DEVICE'] = '5'
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, Data... |
b30eca057f6ef03bf7a4b6dbc21dbcef58d9b3f6cd22680b47365f17df37b9f2 | Python | 6,358 | 194 | import warnings
import scipy.sparse
import scanpy as sc
from scipy.sparse import coo_array
import leidenalg as la
from scipy.spatial import KDTree
from tqdm import tqdm
import igraph as ig
import pandas as pd
import numpy as np
from sklearn.preprocessing import normalize
from scipy.spatial import Delaunay
from nest.... |
e727dc43656bcadcde6b59296b75919c4d3273f4112e31f27f78ecffba71d859 | Python | 6,359 | 161 | import nibabel as nib
from nilearn import plotting
from scipy import sparse
from scipy.io import loadmat
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import sys
import argparse
import numpy as np
import pickle
def argument_parse(argv):
parser=argparse.ArgumentParser(descri... |
e272b0f4aaa5a527070ce04ace7b97d3a99ee6020e333541eb8666454df04a5d | Python | 6,360 | 179 | # 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, ... |
f967045b9581dc21c78c2db4d4b9a81b8488ee6735dccc2dac5f74c33f06ec12 | Python | 6,360 | 149 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import zipfile
from datumaro.components.annotation import AnnotationType, Caption, Label, LabelCategories
from datumaro.components.dataset import Dataset
from datumaro.components.transformer import ItemTra... |
d1dc8844942ebe39dc5f3af3cc419c522388c5f1b851182590524581469bd619 | Python | 6,361 | 174 | from IndividualParcellation.global_config import *
import numpy as np
import torch as pt
import nitools as nt
import seaborn as sns
import matplotlib.pyplot as plt
import nilearn.plotting as plotting
from Functional_Fusion.dataset import DataSetMDTB
import Functional_Fusion.atlas_map as am
import PcmPy as pcm
import Op... |
2fd9c2680f040cd44c803f2adca12495854ee3284f38359b12540c253a0440ee | Python | 6,366 | 149 | """A module that contains non-cryptographic hashing functionality for Python objects. These are used to compute hashes of the inputs of operations
performed by instances of :py:class:`~corelay.processor.base.Processor` to identify them in a way that is independent of their memory address
and can be used to identify dat... |
7765c3908d42fa483db6c01042e7252bfb454d826daef569c4f499174f75b28f | Python | 6,368 | 167 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Use the NUFO map information to select the plausible number of tensors
in the Multi-Resolution Discrete Search (MRDS).
https://link.springer.com/chapter/10.1007/978-3-031-47292-3_4
scil_mrds_select_number_of_tensors uses the output from mdtmrds command.
Some mdtmrds o... |
8f6f3f45694132509bf627d4004aeb83ccc03978e2d6db45cbc11585d0176373 | Python | 6,368 | 180 | """
PyTorch Dataset for AVPENet.
Loads audio-visual segments and pain labels from a CSV manifest.
CSV format:
segment_id, audio_path, video_dir, pain_score, subject_id, age_group
"""
from __future__ import annotations
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset, Data... |
c6fba49c98c903a294f801de4221e4176dc4d6f207605aa9fccb63ebc522ac3a | Python | 6,370 | 176 | import sys
import os
# Add parent directory to path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import torch
import pandas as pd
import numpy as np
from torch.utils.data import DataLoader
from rdkit import Chem, DataStructs
from rdkit.Chem import rdMolDescriptors
from... |
4c0b7c0d0861a2bad2c193bd3aef1c6f9024189c015a8810b51eda50fc34bbd5 | Python | 6,373 | 150 | import numpy as np
import torch
from PIL import Image
from func import image_roi
from scipy.ndimage import zoom, uniform_filter
def stack_TemplateWindow(img, N_w):
"""generate image stack for each window size
Args:
img (2D/3D numpy array): original image or image stack [image number, y, x... |
664f2b40f5bd13ba0ddc5f0b74489f79051deda95a95250fa4a212f9ca25cccc | Python | 6,373 | 177 | from typing import TYPE_CHECKING, Callable, Dict, Tuple
from magicgui import magicgui
from qtpy import QtCore, QtGui
from qtpy.QtWidgets import QMessageBox, QPushButton, QStyle, QVBoxLayout, QWidget
if TYPE_CHECKING:
from brainways.ui.controllers.registration_controller import RegistrationController
class Regis... |
1453be9cfcfd32aa409cd61b5d4bd0a701e3e1bd21c6c0f40015fbc5dd3d15dd | Python | 6,374 | 120 | """This scripts generates 3 examples where we try to regress LR T2 scans into HR T1 scans. Because we assume that no
images are available, this script produces synthetic pairs of LR T2 scans along with aligned HR T1 scans.
If you use this code, please the SynthSR paper in:
https://github.com/BBillot/SynthSR/blob/mast... |
5166c7fc3585a729976a897d0d425a8ba0afc1b39a94c7ba0ed0fc422f4d496f | Python | 6,374 | 185 | # This file is part of Mooney computational modeling project.
#
# Mooney computational modeling project is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
48f597e18d2f1d122f7fab9a3392605b317e26b465297c584d91d5dc532b03c1 | Python | 6,375 | 129 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
import cv2
@dataclass
class SolutionConfig:
"""Manages configuration parameters for Ultralytics Vision AI solutions.
The SolutionConfig cla... |
54404e104c0fd0b361f01dd4944baec5184d0489383f785ac9cc01cc49fbbd7d | Python | 6,375 | 158 | from tqdm import tqdm
import numpy as np
import torch
from ..utils.helpers import normalize_g2g, calc_sphex, calc_gex
def train(epochs, learning_rate, model, loader, zmft_scalar=1e-1, seed=1, device="cpu", verbose=False):
"""
Trains the model using a stochastic gradient descent (SGD) optimizer over the specifi... |
431140ad7736df0fbb9835a9589a34672273f37f49bb04ff5d4a16f9c9284bd0 | Python | 6,377 | 180 | import numpy as np
from typing_extensions import Self
from argclz import AbstractParser, argument, as_argument, copy_argument
from neuralib.persistence import ETLConcatable, persistence
from neuralib.persistence.cli_persistence import get_options_and_cache
from rscvp.spatial.util import PositionSignal, normalized_tria... |
784acca14d7ea2277aef46480a8707fc99954bb9e20361e354770a49b3408808 | Python | 6,377 | 187 | """
Absorption coefficient (mu_a) and scattering coefficient (mu_s) computation.
Copyright (c) 2016-2023 German Cancer Research Center,
Division of Intelligent Medical Systems
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
followin... |
83563757ba3a00be59caad360d342ee9fd7701d2fb702d6c9891804aec9b8ff3 | Python | 6,377 | 159 | from __future__ import annotations
from typing import Optional, Iterable, final
import attrs
import numpy as np
from matplotlib.axes import Axes
from tqdm import tqdm
from argclz import AbstractParser, argument
from neuralib.atlas.ccf.matrix import CCFTransMatrix, load_transform_matrix
from neuralib.imglib.array imp... |
cb0343a6caafadf28f2c3319527fc4c5224adc1fbd66f75483500c8fa9e435e9 | Python | 6,377 | 193 | # torch imports
import torch
import torch.nn as nn
def get_bond_length_ABA(pos, nintdist):
"""
function that calculates the interatomic distances
of a molecule with ABA symmetry (such as HeH2+ or H2O)
This function does not take permutational invariance
into account.
the numbering is (fo... |
29a8abc22f4de85f6d7096cd7927da2e0de3912cbfeab1d48022317950dc5898 | Python | 6,379 | 184 | 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... |
a8ca3f42add72f222adcb154b17e88d30ca4a9d0eb1a143ea93dcc2961013872 | Python | 6,379 | 177 | import sys
import os
# Add parent directory to path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import torch
import pandas as pd
import numpy as np
from torch.utils.data import DataLoader
from rdkit import Chem, DataStructs
from rdkit.Chem import rdMolDescriptors
from... |
39f667d00f5902a5d6abf3950bbc9291725b249f6e2729a96b20ba8d0f0d36da | Python | 6,381 | 197 | #!/usr/bin/env python3
# Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import os
import shutil
import subprocess
import tempfile
from pathlib import Path
from urllib.parse import urljoin
import git
import toml
from packaging import version
# Number of... |
46eb983a94b927bdfc8dcdd0d36133b0b0e9eaea8d44727c5644d7413e8a809c | Python | 6,381 | 158 | #!/usr/bin/env python
"""
The filter wheel control UI.
Hazen Babcock 06/17
"""
from PyQt5 import QtWidgets
import storm_control.sc_library.parameters as params
import storm_control.hal4000.halLib.halDialog as halDialog
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.hal4000.halLib.... |
064b6b471bb294f2714c7f4582597060b2e315533760c112e5cc05fd0f7a4ab9 | Python | 6,382 | 167 | import os, json, sys, shutil
sys.path.insert( 0, os.path.join( os.sep, 'usr', 'share', 'gkg', 'python' ) )
from CopyFileDirectoryRm import *
def runVoxelBasedMorphomertry( Dir,
subject,
template,
group,
... |
13b96acd542e780770f961e1fd9d7fa3d3eb291825b0adaaf3e7b4abb81e7ea6 | Python | 6,382 | 179 | import numpy as np
from connectomics.data.utils.data_io import readvol, savevol
from connectomics.utils.evaluate import adapted_rand
from connectomics.utils.process import remove_small_instances, cast2dtype
from skimage import exposure
from skimage.morphology import remove_small_objects
from skimage.segmentation impor... |
c6c35f0d63699e2be0860a1a1ea58fa7fc76a13bb1e618d2aa45bd7070a3fd8e | Python | 6,384 | 155 | import pytest
import numpy as np
from brainscore_vision import load_dataset, load_stimulus_set
# --- 8-subject volumetric assemblies ---
@pytest.mark.private_access
class TestAllen2022fmriAssemblies8Subj:
def test_train_assembly_shape(self):
assembly = load_dataset("Allen2022_fmri_train")
assert... |
fa0d243d80caf1d27e44b9509498d6d20cdd9d95e210c421020092e74b2f2112 | Python | 6,384 | 207 | from __future__ import annotations
import asyncio
import json
from typing import Any
import pytest
# Skip when the optional 'academy' extra is absent; core.tools imports
# academy.agent at module level.
pytest.importorskip("academy")
from chemgraph.academy.core.tools import build_chemgraph_reasoning_tools
from chem... |
5da12ab41e8c7fe1a0c075def651ab34fafd174d5923d866240f507e494047e4 | Python | 6,386 | 131 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
fetch_data(get_testing_files_dict(), keys=['btensor_testdata.zip'])
tmp_dir = tempfile.TemporaryDirectory()
def test_help_option(script_runner):
... |
79832ce1c843d481e2f58f0e09839ace83eab31603125f4879f55694aef548fc | Python | 6,387 | 167 | import yaml
import sys
import matplotlib.pyplot as plt
import os
import csv
import numpy as np
from glob import glob
import pandas as pd
import matplotlib as mpl
import h5py
pathpath,myrun,ncluststr,cmethod = sys.argv[1:]
'''
pathpath = 'PATHS/filepaths_carlen.yml'
myrun = 'runC00dMP3_brain'
ncluststr = '8'
cmethod =... |
d10d718c8f22c2dc2dd3cb1ae31c9236b7879236d718230d90aaf80a4207b56a | Python | 6,388 | 170 | # Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder.
#
# This file is part of Slamdunk.
#
# Slamdunk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your o... |
04874f8440fffc345afa2f19383040b852fadd4cb1b425d9b6894556ff67ef0d | Python | 6,392 | 186 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: Yong Bai, yong.bai@hotmail.com
@License: (C) Copyright 2013-2022.
@Desc:
"""
import numpy as np
import pandas as pd
import cv2
import shapely.geometry as shp
from shapely.geometry import LineString, GeometryCollection, Point, Polygon
from shapely.ops import s... |
6708b5566a3009eb3db42eaf18560843fb0267bb153046adcfac63b4f7dcf572 | Python | 6,395 | 226 | import time
import unittest
import warnings
from datetime import datetime
from typing import ClassVar
from unittest.mock import patch
from rscvp.statistic.csv_agg.main_pf_agg import PFAggOptions
from rscvp.statistic.csv_agg.main_spatial_agg import SpatialAggOptions
from rscvp.statistic.csv_agg.main_visual_agg import V... |
1345d25b942ea3b77d8b8a48fd30382ae8d6a004f3a08dece7f086d95411cca9 | Python | 6,396 | 160 | # 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, sof... |
8fb99550204a7af16230d7f64541304faa7c267a64cf2ef022001254844a9c21 | Python | 6,396 | 147 | import nighres
import os
import nibabel
import numpy
import glob
import scipy.ndimage
indir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead/tissues/'
outdir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead/topology/'
wmprior = indir+'Ahead_brain_122017_thionin-interpolated_cr_... |
0bfcfb36dd09714c8f6bd5f66f9044fbddaf8d40cfb007bf7b4ed123d66bd52b | Python | 6,397 | 200 | import traceback
import numpy as np
from comind_utils.g1.models.cw_dcs import d_dcs_g1_d_adb
from scipy.optimize import curve_fit
from mc_analysis.fitting.fit_funcs import d_sexp_d_decay, dcs_g1, single_exp
def run_bfi_fit(lags, g1, fit_name, min_g1=0.5, min_lag_points=5, sds=1, p0=None):
"""Fit g1 with td-dcs ... |
621a78adfdd0359a5549bd89ed3ec4454a5fb103e6224b02b00e64a8e674b9dd | Python | 6,397 | 181 | import os, sys, string, subprocess
libsRequired = set()
updateFiles = False
processLibs = False
OSTYPE = "Linux"
MACHINETYPE="x86_64"
OSVERSION = "1"
GCC_VERSION="0"
def getGCCVersion():
global GCC_VERSION
try:
GCC_VERSION=(getCommandOutput("gcc --version|grep gcc|awk '{print $NF}' |awk -F \".\" '{print ... |
8aa794c5d917e9bb8ed51881a0ba3a9ae7a99d227742536741d83c3d88611354 | Python | 6,398 | 180 | import numpy as np
from physical_objects import Isolated, Stick, Hinge
from tqdm import tqdm
class System:
def __init__(self, n_isolated, n_stick, n_hinge, delta_t=0.001,
box_size=None, loc_std=1., vel_norm=0.5,
interaction_strength=1., charge_types=None,
):
... |
dbb3c40471096e0338bd656b0e891a243c58afb3d85c2f0d5a777ec8badf8756 | Python | 6,398 | 174 | """
Empty Cell Image and Mask Settings Widget
This widget provides UI controls for configuring empty cell image (blank image)
and mask settings, including enabling/disabling their application.
"""
from pathlib import Path
from PySide6.QtWidgets import QPushButton, QCheckBox, QGridLayout
from .collapsible_groupbox imp... |
02348fa56afdf210fb57e310cdbf290ac80d1f3ec8fb375575e1c2563cd5b6da | Python | 6,399 | 186 | import os
import csv
import pandas as pd
import tensorflow as tf
#class PrintMeanPredictionCallback(tf.keras.callbacks.Callback):
# def on_epoch_end(self, epoch, logs=None):
# tf.print(epoch," ",self.model.MAE_train)
import tensorflow as tf
class PrintMeanPredictionCallback(tf.keras.callbacks.Callback):
... |
1347d31cff8caf068c9477dd072908d2d1c9afeec6bdb7ff83dde5306adafd95 | Python | 6,399 | 171 | ##
# Import functions
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import csv
##
# # Parameter to change
# Import_file_name = "20250605_ILC_R_S1R4_30Hz_Atosiban"
# data_folder = Path(f"C:/Kai-Yi.WANG/exvivo_GRAB_csv/")
... |
499368de6cd3cc1306a24ce6978b2b13ee1e05f3d9fe48c2268ea2fc3549a65a | Python | 6,399 | 74 | import numpy as np
from brainscore_core import Score
from brainscore_vision import load_metric, load_stimulus_set, load_dataset
from brainscore_vision.benchmark_helpers.screen import place_on_screen
from brainscore_vision.benchmarks import BenchmarkBase
from brainscore_vision.metric_helpers.transformations import appl... |
6d18cc5e4d5c19c5649b93518efcf279083015ee09bac702275ee11d4b78e008 | Python | 6,400 | 209 | from typing import Any, Optional, Union
import matplotlib.pyplot as plt # type: ignore
import numpy as np
from anndata import AnnData # type: ignore
from matplotlib.colors import LogNorm # type: ignore
from mpl_toolkits.axes_grid1 import make_axes_locatable # type: ignore
from numpy.typing import NDArray
from scip... |
31171ddf8590874f055c83d3bbca9937b8865df50ab4cae1aef37e87a86c57f8 | Python | 6,401 | 235 | import attrs
import numpy as np
from memory_profiler import profile
from scipy.interpolate import interp1d
from typing import cast
from argclz import AbstractParser
from neuralib.locomotion import CircularPosition
from neuralib.persistence import persistence
from neuralib.widefield import compute_singular_vector
from ... |
54c859b3cb48f98548cd5ea2d04a63d9a2d9bf45700bf28e3c0de93520ed381d | Python | 6,401 | 185 | import argparse
import os
import os.path as osp
import time
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import f1_score
import pandas
import json
import torch_geometric.transforms as T
from tqdm import tqdm
import spacy
import re
import ijson
from vaderSentiment.vaderSentiment i... |
7f65fc4d98c03973e4e83099862e676ed29b26d97e0b5b8f0131b5ca6840c094 | Python | 6,402 | 192 | import textwrap
import numpy as np
class Backend:
def __init__(self, nems_model, data, verbose=1, eval_kwargs=None, **backend_options):
"""Interface between NEMS Models and optimization libraries.
Each Backend must implement `_build`, `_fit`, and `predict` methods.
Parameters
-... |
b6c5a6a3dadb3e98f358c53ad420b8caf3fd650d4770af826f807ae1e9cbbe44 | Python | 6,403 | 179 | # deploy.py
import argparse
import warnings
import numpy as np
import torch
from monai.transforms import (
LoadImaged,
EnsureChannelFirstd,
Orientationd,
Spacingd,
ScaleIntensityRanged,
EnsureTyped,
Compose,
)
from monai.inferers import sliding_window_inference
from monai.utils import set_d... |
e90833b8a31bf53c8f10d4dcc236504a8c3d82a8bd39f95acf02013fe0385cb0 | Python | 6,404 | 168 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
# external inputs
import numpy as np
import nibabel as nb
from scipy.interpolate import InterpolatedUnivariateSpline as Interp
# local inputs
#from ..io.get_filename import get_filename
from fmri_tools.io.get_filename import get_filename
def _set_t... |
7e245669e9f2e8b952ae50a3c437d2f4fd8a3a02589ba9ad79ec1e4d505c6e62 | Python | 6,405 | 161 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Human body parts detection and exctraction of some related features from videos
"""
import os
import cv2
import numpy as np
from tqdm import tqdm
from detectron2.config import get_cfg
from detectron2.engine.defaults import DefaultPredictor
from densepose import ad... |
d5d7c94f04fe55f846966232f6f798389ea9ee163cc39e15243e556241ea54ed | Python | 6,405 | 175 | #%%
# interactive window settings
%reload_ext autoreload
%autoreload 2
import numpy as np
from scipy import ndimage
import pandas as pd
import matplotlib.pyplot as plt
import re, seaborn as sns
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning) # turn off warning messages
... |
9b3a98bd2fd77caf281863a1c51451a13dce8f63f798d3a9f47aaa00104e59d5 | Python | 6,406 | 160 | ##
# Import functions
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import csv
from GRAB_exvivo_AnalysisTool import *
from scipy import stats
##
# Parameter to change
Import_data_list = ("20250619_ILC_L_S1R5_30Hz_red_At... |
a91e2ae14be5b0ca2960d2bd9c8c86d91e8d52cd0c4479671b6bf0ede0e2d521 | Python | 6,407 | 146 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code adapted from AlphaFold (https://github.com/deepmind/alphafold):
# -----------------------------------------------------------------------------------------------------... |
c8976a3ff30e3ca9f8de4eb60334b2689848645151a694ce9a9d2a79bd549075 | Python | 6,408 | 214 | """
Loss functions for Bicephalous autoencoder.
A bicephalous autoencoder has two decoders --
one for classification (segmentation), the other
for regression.
The BiLoss will calculate both classification
and regression losses and a linear combination of them.
During training the two losses will be dynamically
balance... |
7a1707b1b17c21f4482ef30f0fc71d257f849d9d69dc3e1ab7c891b1fae53055 | Python | 6,411 | 153 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from copy import copy
from typing import Any
import numpy as np
import torch
from ultralytics.data.utils import add_polygon_background
from ultralytics.models import yolo
from ultralytics.models.yolo.detect import... |
c92de9fbc669675c342e3fad46c47355d7941dd3bb2fad17b1b1fea7eacc7137 | Python | 6,411 | 171 | import os
from argparse import ArgumentParser
from utils import null_metrics, calc_metrics, is_better
import torch
from dataset import get_train_data
from torch_geometric.loader import NeighborLoader
from tqdm import tqdm
import torch.nn as nn
from model import BotGAT, BotGCN, BotRGCN
device = torch.device('... |
f107e34ba0343b3d6c7d62b063e8d234bc5f1f93cd436f64fd644bd27fced4c1 | Python | 6,411 | 218 | # Author: Lucas Berg
#
# Butterfly plotter:
#
# Program that plots the transmembrane potential of every cell in the grid
import sys
import subprocess
import time
import numpy as np
import matplotlib.pyplot as plt
def forwarddiff(y, h):
n = len(y)
res = []
for i in range(1, n):
res.append((y[i] ... |
00563e2794aea3dc043b02b7aba50d72e26bd913d722b5a6f0cf2c5bde32d8f7 | Python | 6,413 | 271 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-20... |
9c2dc5aea42e5ddfa894463ba492f6f4e5b5cb86be856be44965873fdd5d2cfe | Python | 6,413 | 153 | """Scoring functions that operate on the evaluation results objects.
These functions depend on the causallib.evalutation results objects and are
less reusable than the functions in metrics.py.
"""
import pandas as pd
from .predictions import (
OutcomePredictions,
PropensityPredictions,
WeightPredictions,
... |
f1b34602b3b171cd1eaa44e2861e1f553ef2a479cbfa2446107e6907fe6c5600 | Python | 6,415 | 185 | import itertools
import numpy as np
def correlation(x, y):
"""Compute Pearson correlation coefficient for arrays x and y.
Correlation is computed for corresponding output channels in `x` and `y`,
i.e. `corr(x[..., i], y[..., i])` for all `i`.
TODO: Support for batched data.
Parameters
----... |
c458991319cc3b52a32718edfccb9ba72df0cf2a67ac73acb4889a7cf6701c8e | Python | 6,418 | 200 | import math
from collections.abc import Sequence
from functools import lru_cache
from typing import Literal
import numpy as np
from torch import nn
from eir.models.layers.lcl_layers import LCL, LCLResidualBlock
def get_1d_projection_layer(
input_dimension: int,
target_dimension: int,
projection_layer_ty... |
9aacda0eca239c8ccc389e9104a1bd4ca38e7ca362eec491a8e4c846186adb01 | Python | 6,419 | 141 | from dipy.io.streamline import load_trk
from fury.colormap import create_colormap
from fury import actor, window, colormap as cmap
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
from os.path import join as ospj
import pandas as pd
from scipy.ndimage import gaussian_filter, zoom
# This script... |
09778b17c225fc9c88cd1b05a0b379a861495a177d006244a3829eac30de7ea7 | Python | 6,421 | 278 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-201... |
b459ce40babed3bd9ede169050c7089ed1c4b2bf0052a552fa5b72457e7c9979 | Python | 6,421 | 133 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import walk_coords
from brainscore_vision import load_dataset, load_metric
from brainscore_vision.benchmark_helpers.screen import place_on_screen
from brainscore_vision.benchmarks import BenchmarkBase
from brainscore_vision.metrics impo... |
c6167391bd88dd5ccdf5c3b2ec8d913c136f4762a7d2b22c303e6dbc8f0a504c | Python | 6,422 | 171 | # 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 math
import numpy
from scipy import stats
fro... |
40463875a0e7ffdb6a512d278e7a44e98135b8dc87d047ab628df5abdcee63c4 | Python | 6,425 | 212 |
import torch, torch.nn as nn, torch.utils.data as data, torchvision as tv, torch.nn.functional as F
import pytorch_lightning as L
import numpy as np
from torch.utils.data import Dataset, DataLoader
from sklearn.metrics import roc_auc_score
from pytorch_lightning.callbacks import ModelCheckpoint
class modulerNetwork2... |
435ac7f0460407017f46ad6185421b353c2231ce689cef69c69e23e141acfac6 | Python | 6,425 | 190 | from ..qt import *
from .. import thalamus_pb2
from .. import thalamus_pb2_grpc
from ..observable_item_models import FlatObservableCollectionModel, TreeObservableCollectionModel, TreeObservableCollectionDelegate, get_selected_rows
from ..config import ObservableDict
from ..task_controller.util import create_task_with_e... |
e43e07e3770a6472896f4042040abb271341e005ae78dad8de55bfd4bdfcd445 | Python | 6,425 | 115 | from nipype.interfaces.base import traits
from nipype.interfaces.base import TraitedSpec, InputMultiPath
from nipype.interfaces.matlab import MatlabCommand, MatlabInputSpec
from nipype.interfaces.spm.base import ImageFileSPM
class cat12_seg_InputSpec(MatlabInputSpec):
in_file = InputMultiPath(
ImageFileSPM... |
1ab78703a923a256133ef4128bc6abe527737187a6e3c0d146074c7b57af4030 | Python | 6,426 | 225 | # FetMRQC: Quality control for fetal brain MRI
#
# Copyright 2023 Medical Image Analysis Laboratory (MIAL)
#
#
# 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/lice... |
08dc692b27d4f0b683559b61571c86e490488fbefc1d422934765486c0dc851d | Python | 6,429 | 138 | import sys, os
from timeit import default_timer as timer
from rdkit import Chem
from rdkit.Chem.MolStandardize import rdMolStandardize
from rdkit.Chem.rdchem import Mol
from src.utils import DrawTautsFromList
from typing import Type, List
from src.optimize_xtb import get_lowest_energies_xtb
import numpy as np
from logu... |
27cf27e5209cc4e707219d63c26185ee540acb710d5c2b8d5d933ea07b991aa6 | Python | 6,429 | 174 | """Functions to detect and separate events from ground truth data.
Some of the functions are from napari-eda-highlight-reel"""
import numpy as np
import scipy.ndimage as ndi
from tqdm import tqdm
def basic_scan(data, size=256, threshold=0.7, additional_post_frames=1):
open_events = []
framenumber = len(data... |
7ea6c0d9e73225fecd13545ac446af416f745134080783bcba56fc1b5d2d8735 | Python | 6,429 | 190 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 18 16:39:35 2023
@author: szh
"""
import numpy as np
import pandas as pd
from tqdm import tqdm
import scipy.sparse as sp
import SpaNCMG
import Mix_adj
import torch
import torch.backends.cudnn as cudnn
cudnn.deterministic = True
cudnn.benchmark = True
import torch.nn.f... |
907928d6a2c05c7bce5294ace27533a16964e54eb4f33dbfb1a31447d3db2a0a | Python | 6,430 | 206 | ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the gradunwarp package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
from collections import namedtuple
import numpy as... |
bbd89e4d3c7911a3679c4a01e420aebd7bc84402e7a47affd88f4a78b984ea81 | Python | 6,430 | 173 | import ijson
from pathlib import Path
import torch
import numpy as np
import time
import csv
import statistics
from urlextract import URLExtract
from transformers import (
pipeline,
BertTokenizerFast,
BertModel,
)
import pandas as pd
root_dir = Path.cwd().parent.parent.parent
dataset_dir = root_dir / 'data... |
0577bb21258e4e95f5b4589e37f55024f9f706e6281ad8d1d38ebe4214f76da4 | Python | 6,431 | 160 | import argparse
import glob
import os
from concurrent.futures import as_completed, ProcessPoolExecutor
from tqdm import tqdm
import pandas as pd
import nrrd
# Paths
PATH_TO_T_TYPES_NRRDS = "/gpfs/bbp.cscs.ch/data/project/proj84/csaba/aibs_10x_mouse_wholebrain/results/density_calculations/scaled_nrrd_CCFv3a"
PATH_TO_P_... |
db06c9a066c56e8a50c46f8576399fe44a0ff129d6e7cb8be67d8bcdf846346c | Python | 6,431 | 277 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-201... |
2cdc5708213be3ef2149216b944d9792aa9b23165250b6b4c05ca3c08f0a8fdf | Python | 6,432 | 181 | """
This class overlays lines on top of the image stacks.
This class can handle csv files with columns in the format:
line_series, z, x, y but the loading itself is handled by
line_reader_plugin.py
The first column in the CSV file, "line_series", is a scalar
line_series is a scalar. All points within the same line_ser... |
bf39c90b1fcd5f8cc4a5de5c4c36dd53c58b566635ad15354032e8e765e74cdc | Python | 6,433 | 221 | #!/usr/bin/env python
# coding: utf-8
import sys
import os
import argparse
import pandas as pd
import numpy as np
import yaml
import logging
import scipy.io
import scipy.stats
from sklearn.cluster import KMeans
from dna3bit import DNA3Bit
logger = logging.getLogger("correct_fp_doublets")
logging.basicConfig(
le... |
02eb618fc6f372168e159fbc447974db242ff3619300b1ca72c0e030d3aa47b0 | Python | 6,434 | 149 | import nighres
import os
import nibabel
import numpy
import glob
import scipy.ndimage
indir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead2/tissues/'
outdir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead2/topology/'
wmprior = indir+'Ahead_brain_152017_thionin-interpolated_c... |
d9ecaa7b3664dfdb92a3d62776d134ef1e1b7455fe0e48eb01471549be7f8a88 | Python | 6,434 | 179 | """
Module to build a bioFAM model
"""
from sys import path
from time import time,sleep
import numpy as np
import scipy as s
#from joblib import Parallel, delayed
from mofapy2.build_model.init_model import initModel
from mofapy2.build_model.utils import *
class buildModel(object):
def __init__(self, data, data_o... |
4a335cb827d2535ca667b1b8e974fa9f688b3466954286bf052a2e17f094cc67 | Python | 6,435 | 170 | #!/usr/bin/python
#
## @file
#
# Generate XML for Dave given a position list and an experiment description file.
#
# Hazen 05/14
#
import copy
import math
import os
from xml.dom import minidom
from xml.etree import ElementTree
from PyQt5 import QtCore, QtGui
import storm_control.dave.xml_generators.nodeToDict as nod... |
51de3208487144f4ce2fb57785a66402fc54e3ab9778fa756dee9a54955ea214 | Python | 6,435 | 274 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.