sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
19065aea9593a3835c527a754ee5b14911d6ce39ee1a979163c3ab2b205e172a | Python | 5,042 | 143 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: A.Akdogan
"""
from utils import *
from data_visualizer import *
from dataset_builder import NailDataset
from trainer import Trainer
import os
from torch.utils.data import DataLoader
import pickle
import cv2
import torch
import numpy as np
from PIL import Image... |
51acf723d294f3688de3d7328366d239e002e42070eab4eb3ee4cf6fc1872f9a | Python | 5,042 | 189 | import numpy as np
from numpy import linalg as LA
def feature_ranking(W):
"""
This function ranks features according to the feature weights matrix W
Input:
-----
W: {numpy array}, shape (n_features, n_classes)
feature weights matrix
Output:
------
idx: {numpy array}, shape {n... |
91783a77845897028b86ba96e8ddab10a5cabdc7974ae7de9efbfaad52d48969 | Python | 5,044 | 165 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
3f9c9dd21a116b4bd8227ce7a85d42086d848fa80764185cf4af3c72c017faca | Python | 5,045 | 162 | ''' Script to estimate inverse solution '''
# Append to path
project = 'MINDLAB2020_MEG-AuditoryPatternRecognition'
project_dir = '/projects/' + project
scripts_dir = project_dir + '/scripts/working_memory/'
import sys
sys.path.append(scripts_dir)
# Load libraries
import mne
import os
import os.path as op
import numpy... |
556a91e448b82afee6a81620aa5d2e91bbd918dfaa039584d674a8e2c7546b0f | Python | 5,046 | 117 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 27 08:38:34 2023
@author: daltonm
"""
from pynwb import NWBHDF5IO
from neuroconv.datainterfaces import PhySortingInterface
import ndx_pose
from importlib import sys
import os
sys.path.insert(0, '/project/nicho/projects/marmosets/code_database/data... |
6a97ef3864685c5296521d2152935171d094ed2a1a297f37365cccae2bdf22de | Python | 5,046 | 159 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
b46458f05fbc733b328ee36b97622d3b8d12bfcf99d53215cb0c813d7070a2a1 | Python | 5,047 | 88 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from downward.reports.compare import CompareConfigsReport
import common_setup
def main(revisions=None):
SUITE = suites.suite_optimal_with_ipc11()
B_CONFIGS = {
'rl-b50k': ['--search', 'as... |
c64a18847c70522c986b057481038b880aba72c6a507b6ce47c06bc936eda86c | Python | 5,047 | 171 | import numpy as np
from abc import ABC, abstractmethod
'''
author: matthias wilms
'''
class KernelBase(ABC):
def __init__(self):
super().__init__()
@abstractmethod
def apply(self, x, y):
pass
class LinearKernel(KernelBase):
def apply(self, x, y):
return np.dot(x,y)
cl... |
d5b63d6f0f054fde131a7695faae7b84ca2dfc01989a2f0e1f74b3ccaafd6e15 | Python | 5,050 | 139 | import pickle
import numpy as np
from sklearn.preprocessing import StandardScaler
import openturns as ot
def export_predictions(y_test, y_pred, Q2, complete_filename):
"""
Exports the objects to the metamodel .pkl
Parameters:
----------
y_test: array
test data used ... |
e5da7cea0b5f2ae45f3b201a960ed79c16e221f2b85db60b4049449a0369f8ca | Python | 5,050 | 154 | import argparse
import cv2
import multiprocessing as mp
import numpy as np
import os
import pandas as pd
import shutil
from typing import *
from tqdm import tqdm
from constants import *
from src.preprocessing2 import resize_padded, create_label_files
"""
this script expects your data to be organized like this:
├──da... |
ec2c95dba2b2f17c377ca1ee1ab4c5a9a261956d8c6a4622a8c92c9f3c10b96f | Python | 5,050 | 151 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
629b19335e8b3cda200643ab8ae94bfd01ac94b1e12030b379002e1ff21cf640 | Python | 5,053 | 157 | # Node-group asset "Evaluate Per Group" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHE... |
de8b87c9aa43095253c7e64904cf7784a5982e333a1875c391e15bb2dae65028 | Python | 5,053 | 133 | """Tests for the 2D foreground_init: the auto scale+centroid initialiser
(Triangle foreground mask -> ANTs spacing + origin) and its flag threading."""
import tempfile
import numpy as np
from regtools.registration.registration_2d import (
_foreground_scale_origin_init,
_clean_foreground_mask,
r... |
e97717b468a98da107e8cfe8ddf0323d9b093e41c01ed80db233aa3a9ba73a97 | Python | 5,053 | 160 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any
from wikibaseintegrator.models.basemodel import BaseModel
from wikibaseintegrator.models.snaks import Snak, Snaks
from wikibaseintegrator.wbi_enums import ActionIfExists
if TYPE_CHECKING:
from wikibaseintegrator.mod... |
dc503c69b7d8c75d623b4802745b2460eeff1bd7f05bbaa3b311978c07878fca | Python | 5,054 | 167 | #!/usr/bin/env python3
import os
import pandas as pd
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask
from nilearn import plotting as nplot
import warnings
warnings.filterwarnings("ignore") # suppress warnings
# ------------------------------------------------... |
59f6899b03d238fb284e8c5da0459afbbd6ba678d9bc66452f42136d38162dc5 | Python | 5,056 | 114 | """code for managing real-time email notifications"""
import time
import datetime as dt
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import (
Mail, Attachment, FileContent, FileName,
FileType, Disposition, Content)
import logging
import base64
import os
logger = logging.getLogger(__name__)... |
43f236ec8f6db8deeea41d7a592a36fdac9688857ac8c7c60e0cc90ee2144f12 | Python | 5,057 | 143 | """
OXASL - Python package for ASL-MRI analysis
===========================================
Copyright (c) 2008 University of Nottingham
The modules in this package are mostly Python replacements for existing shell script
and C++ code from the oxford_asl FSL module.
For many tools, FSL is required. The ``fslpy`` pack... |
020a6f5774c467d43175e0c648bb76fc1fc8f74cfb4273b31ffe0f57dc4583ff | Python | 5,058 | 134 | ##
# \file linear_operators_test.py
# \brief unit tests of linear operators
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date November 2017
import os
import unittest
import numpy as np
import re
import SimpleITK as sitk
import pysitk.python_helper as ph
import pysitk.simple_itk_helper as sitkh
impo... |
4e91c71cb824cf24fb6076f08feda2eb07916aaf88bf2dbe3149eb0e48dabbe5 | Python | 5,058 | 152 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2017 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""
Parser for the environment markers micro-language defined in PEP 508.
"""
# Note: In PEP 345, the micro-language was Python compatib... |
6f022e85928f505b29648cb6896e89e40e76e324e53824ee9c92ee7896b96c1e | Python | 5,058 | 148 | import pandas as pd
import numpy as np
import glob
from scipy.stats import multivariate_normal
from scipy.spatial import KDTree
import matplotlib.pyplot as plt
from scipy.stats import spearmanr
from sklearn.metrics import adjusted_rand_score
import shutil
import os
import json
import argparse
parser = argparse.Argum... |
6392fdefa51a26d59e258e51bc9b29cec0c06c71ab6a14f2737a4a38c3f66cf2 | Python | 5,059 | 160 | import numpy as np
from pathlib import Path
from PIL import Image, ImageOps, ImageFilter
import torch
from torch.utils.data import Dataset
import torchvision.transforms.functional as F
from mmseg.datasets import build_dataset
import mmcv
from mmcv.utils import Config
from segm.data.utils import STATS, IGNORE_LABEL
... |
c30c52ecd2b798a2bde5720071dcd4a1a8586dce926877d4d16b8084fef25630 | Python | 5,060 | 156 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
06b6d9a4bfb47126fad70752457ebe14d716ae61477bf8edc27ecebb4bed9e71 | Python | 5,062 | 155 | """ EnTestAgent: This class runs the unit tests for the agent """
import numpy as np
import unittest
from TaskAgent.EnAgentVars import AgentVars
from TaskAgent.EnAgent import Agent
import random
class TestAgent(unittest.TestCase):
""" This class definition implements the Agent unit tests
in order to test... |
290edeb618d27d4f79078ea5b0e5c2a419382fc5e358fdd90a9f254f491e47e5 | Python | 5,062 | 135 | import argparse
import cv2
import numpy as np
import os
import sys
from basicsr.utils import scandir
from multiprocessing import Pool
from os import path as osp
from tqdm import tqdm
def main(args):
"""A multi-thread tool to crop large images to sub-images for faster IO.
opt (dict): Configuration dict. It co... |
aac6c05f27627563bb29dbd4a71809eac52bd9c3f15430f23fdad1f800cf5936 | Python | 5,062 | 150 | import os
import json
import numpy as np
import h5py
from scipy.linalg import block_diag
from .constants import bohr2ang, hartree2ev
from .structure import Structure
from .matlcao import MatLCAO
from .lcaodata import LCAOData # this might be unsafe?
from .utils import slice_same
'''
This module implemements several f... |
0714477112700c960786d42fb5471029667791052a64c85847791d863bcaf016 | Python | 5,064 | 109 | from ase import Atoms
from hotpp.layer import BehlerG1, SmoothCosineCutoff, SOnEquivalentLayer, ChebyshevPoly
from hotpp.utils import setup_seed
from hotpp.data import AtomsData
from torch_geometric.data import Batch
import unittest
import numpy as np
import torch
class TestMolecule(unittest.TestCase):
def setUp(... |
75844eb365ff16d1feeba16ea29ec50ecd90a7857ac2db83a12cf250bbb5f4b7 | Python | 5,064 | 168 | # ### Modules
# basic
import os, glob, logging, pysam, h5py
import pandas as pd
# multi
import multiprocessing
from multiprocessing import Pool
from functools import partial
# scripts
from .ResquiggleUtils import get_traceboundary
### logger
def create_log(tag, path, job, clean = False):
if clean == True:
... |
8fd79d9d0a40957b727b12824546eb8d0fd2187ce95d66b61026e8f4f3577676 | Python | 5,064 | 138 | import numpy as np
from sklearn.datasets import load_iris
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
import h5py
import numpy as np
import torch
import random # Add this import
from torch.utils.data import DataLoader, TensorDataset
import torch.nn as nn
import torch.optim as optim
import h5py as... |
94089409211da13c9df814311c410a86b648eda0d6b9db7cb083c28f14e2cb27 | Python | 5,064 | 135 | import torch
import torchvision
import torchvision.transforms as transforms
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import torchvision.models as models
import torch.nn as nn
import torch.optim as optim
from tqdm.notebook import tqdm as tqdm
def T_scaling(logits, args):
temperature = ar... |
d235e0fb41b75884cfaf3d6241f2e083da657dc9c8d7550dad6a8b2d798a758a | Python | 5,064 | 57 | """posthoc_one_inequality_activity_2026-10-02.py — POST HOC (after ONE_INEQUALITY: L1 PARTLY, L2 NO with AUC 0.992).
Single flips break the lobe at a lower s_U than random multi-flips. One reason: s_U counts the synapses of silent cells, and
45% of the unlabelled local neurons are silent at the laboratory prior. Here e... |
0192781e60fc7bb0af6e7090f9adfa2a26bd876ae7b5a187357c86c453aabc9e | Python | 5,066 | 130 | import numpy as np
import pandas as pd
import os
import sys
from Bio.PDB import PDBParser, MMCIFParser
from Bio.PDB import PDBIO, Select, MMCIFIO
import argparse
from tqdm import tqdm
parser = argparse.ArgumentParser(description="python clean_pdb.py a.pdb a_cleaned.pdb")
parser.add_argument('input', type=str, defaul... |
27ce0a6414a83c56e6932b952bda75cb14f5271ab3b020b654443834adaf7191 | Python | 5,066 | 136 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
a426d6dd084596767210fabd56b4503bf455b520bda4e32a96bb5bdb051e803f | Python | 5,066 | 150 | """
Tests module experiments
# Author: Vladan Lucic
# $Id$
"""
from __future__ import unicode_literals
__version__ = "$Revision$"
import sys
from copy import copy, deepcopy
import pickle
import os.path
import unittest
import numpy
import numpy.testing as np_test
import scipy
from pyto.analysis.experiment import... |
98360b931b6984c4938a80aba3c7ca6f0fe040f4b59f3cf5571e634e7157cd75 | Python | 5,067 | 190 | from os.path import exists
from pathlib import Path
import pytest
from elasticai.creator.file_generation.resource_utils import (
get_full_path,
)
from elasticai.creator.testing.cocotb_runner import (
run_cocotb_sim,
run_cocotb_sim_for_src_dir,
)
_path2src = str(
Path(get_full_path("tests.unit_tests.t... |
1256ef8450d283a7bf7a55b2fe399c391b589c0ec6910bdf263d69e0eddb1f9f | Python | 5,069 | 161 | """
Script for inserting template matching results (scores y angles) in a GraphMCF
Input: - GraphMCF
- Template matching output (Pytom)
- Refinement parameters
Output: - Graph with template matching information inserted as vertex and edge properties
"""
__author__ = 'Antonio Ma... |
f183a6bd9916d6fb135bd311ddcbe1bad7ee5c67b5114467f4577cf502bb36ea | Python | 5,069 | 153 | """AsyncTask runs a callable off the main thread and reports via signals.
Uses the project's plain-QApplication test convention (no pytest-qt); the
threaded path is driven with QTest.qWait, which spins the event loop.
"""
import pytest
@pytest.fixture(scope="module")
def _qapp():
try:
from P... |
fa91af33403fad997f0ea47d93c35dfa4552cf79a96118b20b8b91016a30fbb4 | Python | 5,069 | 125 | #
# Copyright Bradley Lowekamp
#
# 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.txt
#
# Unless required by applicable law or agreed ... |
12e0244011bde95551a3edbc4114183e39c24b7963b7f524ee7a5fe0d83f63bf | Python | 5,070 | 100 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, geometric_mean
from downward.reports.absolute import AbsoluteReport
from downward.reports.compare import ComparativeReport
from common_setup import IssueConfig, ... |
2ab770a9bc04ab752d40bd3a56b7446bbfd61d757e85b56b7e199fbe5325e80d | Python | 5,070 | 137 | """Closing the geometry-registration window mid-run must not freeze or abort.
The old closeEvent called ``worker.wait(5000)`` with no interruption request:
the GUI thread blocked up to 5s and, because run_pipeline usually runs longer,
the wait timed out and the dialog closed with the QThread still running --
dest... |
5d3554af54b873f5ff06f24edaa684a2af064f3ec6a13ea5f77ae3c3e82c557c | Python | 5,070 | 129 | from collections import defaultdict
import logging
from typing import Dict, List
import torch
from .predict import predict
from chemprop.data import MoleculeDataLoader, StandardScaler
from chemprop.models import MoleculeModel
from chemprop.utils import get_metric_func
def evaluate_predictions(preds: List[List[float]]... |
8a48a30e0573834c3084f50b7bf94f59449d0d60ebc088c473b0212152ec9d20 | Python | 5,072 | 125 | from collections import defaultdict
from pathlib import Path
import cv2 as cv
import numpy as np
from wsilearn.utils.asap_links import make_asap_link
from wsilearn.utils.cool_utils import is_list, is_dict, is_ndarray
from wsilearn.wsi.anno_utils import AsapAnno
from .contour_utils import cmp_shape_spacing_factor, px_... |
30496cc3325e623aa7daabc9498bb01e43d83b922878f31cdd09457b0b762b43 | Python | 5,073 | 127 | #!/bin/usr/python3
# Use example: python predict_densenet_subids.py /home/melanie/sMRI_ASD/data/train4/BIDS_data_brain/test2_algo_train1_preprocessed/ /home/melanie/sMRI_ASD/data/Test2_algo_train1.csv /home/melanie/sMRI_ASD/net2/MedicalNet/good_exps/train1_models_lr_1e-3_densenet121_new_preproc_from_10ep/model_40_epoc... |
80fc6493905d0335930a06c41e0d65a4b8bed45e993e1e40fdaa2d80b5c79f38 | Python | 5,073 | 161 | """
pygments.formatters.other
~~~~~~~~~~~~~~~~~~~~~~~~~
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pip._vendor.pygments.formatter import Formatter
from pip._vendor.pygments... |
da03f2d1ec77a3483317dced2cb1243bedf4f5f7fcd0065ac9881a3bdf3b0160 | Python | 5,074 | 121 | # Node-group asset "Index Mix Float" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKI... |
ed2e1ebf9a6d1d7844c10f257948aab771bc83c928eb15b45d08dfd06027833a | Python | 5,074 | 115 | """Tests for the registered-h5ad write-back (copy + append, no X reload)."""
import numpy as np
import pandas as pd
import anndata as ad
import pytest
from regtools.registration.output.h5ad_writeback import (
write_registered_h5ad,
build_h5ad_writeback_arrays,
collect_slice_records,
)
def ... |
11db09026b08d8338e8345b6d9f963679ef323b3b4018c02fa0299f1c8eb920c | Python | 5,076 | 166 | import torch
import torch.nn as nn
class GlobalAveragePooling(nn.Module):
def __init__(
self,
in_channel=1,
hidden_channel=20,
kernel_size=29,
):
super().__init__()
assert kernel_size % 2 == 1
padding = (kernel_size - 1) // 2
self.conv_pool = nn... |
090b7526879949bd1477b29470ed79027512dd5bd7469b36ae055cb98a897d5a | Python | 5,077 | 99 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
13907a345fe1d3940443abdf9915b18b700a8874c9fed46cadf5ec2e25afef32 | Python | 5,077 | 171 | from __future__ import annotations
from pathlib import Path
import pytest
from ase.atoms import Atoms
from quacc.calculators.espresso.espresso import Espresso, EspressoTemplate
def test_espresso_kwargs_handler():
kwargs = {
"kpts": (1, 1, 1),
"input_data": {"system": {"ecutwfc": 30, "ecutrho": ... |
7e725c28ea8d46b7f4bc60c14477c82de31c3e865ed5aa84b26325d9f901d8e9 | Python | 5,078 | 98 | '''
Description:
Model wrapper of scNODE models.
'''
import copy
import torch
from tqdm import tqdm
import numpy as np
import itertools
from optim.loss_func import SinkhornLoss, MSELoss
from benchmark.BenchmarkUtils import sampleGaussian
# =============================================
def scNODETrainWithDiffPre... |
cc142316af767c50ed3da2ecac1e95b3b820b75fec153068015843fca4e63ba1 | Python | 5,078 | 156 | """
Model effect of increased excitability on selectivity
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.optimize import minimize_scalar
from scipy.interpolate import interp1d
from src.simulation import relu, simulate
from src.constants import pink, green, I_example
from src.cons... |
29d42957c0226ddfc4ad5495c0257f3e224b88e3a53c0ad06507c2c78f1965cf | Python | 5,079 | 129 | ################################################################################
# Import, Set up MPI Variables, Load Necessary Files
################################################################################
import os
from os.path import join
import sys
import matplotlib
import matplotlib.pyplot as plt
from matp... |
336f6b82771451af442c2cfed7c7a1e54e5d8e789ad9a205a9b5408654257581 | Python | 5,079 | 108 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import argparse
from setting import *
from dataset import *
from loader import *
# Arguments
argParser = argparse.ArgumentParser()
argParser.add_argument("-n", "--name", type=str, help="dataset nam... |
88708a223f14d3545352c1075b0e74b6946f910e927567bb8ecbefe26875155f | Python | 5,079 | 121 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
1743523cf15a2551fd9f4b7d3519f60ffaf4f8d08ac75231507b527828c305d9 | Python | 5,080 | 151 | #!/usr/bin/env python
from __future__ import print_function
import math
import os
import numpy as np
from pddlstream.algorithms.focused import solve_focused
from pddlstream.algorithms.incremental import solve_incremental
from pddlstream.language.constants import And, Equal, TOTAL_COST, print_solution, Fact
from pddl... |
7629031d23f7c0cfd77a4fd3c3e0f93a84cc08084003a68c19010cd153629129 | Python | 5,083 | 147 | import scipy.special
import autograd.numpy as np
from autograd.extend import defjvp, defvjp, primitive
from autograd.numpy.numpy_vjps import repeat_to_match_shape, unbroadcast_f
### Beta function ###
beta = primitive(scipy.special.beta)
betainc = primitive(scipy.special.betainc)
betaln = primitive(scipy.special.betal... |
a11d9902f7296cf4782ab02c46960576ee1f47bcf998fa2a98e5cc4b30c7a852 | Python | 5,083 | 152 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
ae6ed47a83999aaa8847627732b7f2e9bb839b2571972222bd85b4a5d0d6f8c1 | Python | 5,083 | 159 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
c037dac8713f0991f5edf25da0a6bc1beaf7d3f04feab20e47a6b68cb0f0841f | Python | 5,085 | 103 | # set QT_API environment variable
import os
from pathlib import Path
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core... |
dc26d8bf1d7f02c5ca01847f90914a61367bcc3444c0f6e39c285d91c3070e02 | Python | 5,085 | 149 | import numpy as np
import pandas as pd
from cdt.causality.pairwise import ANM, CDS, IGCI, RECI
import pyEDM
from pyspi.base import Directed, Unsigned, Signed, parse_bivariate, parse_multivariate
class AdditiveNoiseModel(Directed, Unsigned):
name = "Additive noise model"
identifier = "anm"
labels = ["uns... |
29fbe598bd0f5ba81886a18ff0f8855260efa76ca208f7dca4d3b790a90c25b7 | Python | 5,087 | 154 | import bct
import numpy as np
from tqdm import tqdm
from sklearn.utils import check_random_state
def strength_preserving_rand_sa(A, rewiring_iter = 10,
nstage = 100, niter = 10000,
temp = 1000, frac = 0.5,
R = None, connect... |
7c1f9ab8334c5df4aca48814aca85a72775a12a9673f5769359289267fe15059 | Python | 5,089 | 139 | import itertools
import torch
import torch.nn as nn
import numpy as np
class BBoxTransform(nn.Module):
def forward(self, anchors, regression):
"""
decode_box_outputs adapted from https://github.com/google/automl/blob/master/efficientdet/anchors.py
Args:
anchors: [batchsize, bo... |
2c2382dc6c9dff6559aa3bc55a742e838a0252b6945a5628426e8ab83e518154 | Python | 5,091 | 142 | from torch import nn
import torch
from nnunetv2.training.nnUNetTrainer.variants.network_architecture.nnUNetTrainerNoDeepSupervision import \
nnUNetTrainerNoDeepSupervision
from nnunetv2.utilities.plans_handling.plans_handler import ConfigurationManager, PlansManager
from nnunetv2.training.lr_scheduler.polylr impor... |
5d8a7f04102ab1775262c3000b2b332f2dd9f14e2bb68d10c6ab8055fb68cc9f | Python | 5,091 | 143 | from typing import cast
import torch
from elasticai.creator.arithmetic import (
FxpArithmetic,
FxpParams,
)
from elasticai.creator.nn.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.fixed_point.math_operations import MathOperations
from elasticai.creator.vhdl.shared_designs.precompu... |
71921afa47a3df2f00c839ec61113464fe67248bdcefad7241d41d0dc9130e8d | Python | 5,092 | 111 | import argparse
from matplotlib import pyplot as plt
import os
import sys
import pandas as pd
import pytorch_lightning as L
from pytorch_lightning import Trainer
import seaborn as sns
from sklearn import cluster, metrics
from statsmodels.stats.nonparametric import rank_compare_2indep
import torch
from typing import Any... |
869bcb18db7f0212460958b189ec2c95906aa4744d4bfe22b9bd5e52cf4dacbd | Python | 5,094 | 145 | """Batch 2D gets the same optional output directory the single-run tab has.
``_make_output_root`` used to unconditionally mint
``output/<timestamp>_batch_2d/`` with no way to override it - automatic, but not
optional, unlike the main registration tab's "Select Output Directory
(Optional)". The chosen root round-t... |
c72f197f7b573a8e8c5ab5e1ef23c65b1de5544920fc3858e02c66b036f4215a | Python | 5,094 | 170 | """
pygments.formatters.groff
~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for groff output.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import math
from pip._vendor.pygments.formatter import Formatter
from pip._vendor.pygments.util import... |
64baedd1cd02b7a81f99d1ec340a12248f22b845b67885fa4d2209baae58edf4 | Python | 5,095 | 138 | import warnings
import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin, clone
from sklearn.linear_model import LinearRegression
from sklearn.utils.validation import check_array, check_is_fitted
from sklearn.utils import _safe_indexing
class ConfoundRemover(BaseEstimator, Trans... |
cdce650f7b02966bb8d8d4fc2af793dcfee22ec691587414803ea8f959d96d10 | Python | 5,095 | 183 | # -*- coding: utf-8 -*-
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import color_palette as cp
# -----------------------------------------------
# Parameters
# -----------------------------------------------
if "snakemake" in sys.modules:
input_file = s... |
3e95ebc23a9cb7437edcef8c077103ce2f15717ab58dc31eba9333b749a1ed1e | Python | 5,096 | 170 | """Mocked unit tests for rootstock MLIP integration in quacc."""
from __future__ import annotations
import sys
import types
from typing import ClassVar
import numpy as np
import pytest
from ase.build import bulk
class _StubRootstockCalculator:
"""Minimal stand-in for rootstock.RootstockCalculator."""
ente... |
7d45f3de205d6ec7c03ea3a2370332f248f737859ef620bc764af38838b09614 | Python | 5,096 | 135 | #!/usr/bin/env python
"""
Convert a Taiyaki chunkify training file to set of Bonito CTC .npy files
"""
import os
import h5py
import random
import numpy as np
from argparse import ArgumentParser
from collections import OrderedDict
from itertools import islice as take
from argparse import ArgumentDefaultsHelpFormatter
... |
814b5649e74cf5b8d256b3967f61fb90ffc29bee9523c75e79abc11be7396bd3 | Python | 5,096 | 155 | # -*- coding: utf-8 -*-
import numpy as np
from omni_anomaly.spot import SPOT
def calc_point2point(predict, actual):
"""
calculate f1 score by predict and actual.
Args:
predict (np.ndarray): the predict label
actual (np.ndarray): np.ndarray
"""
TP = np.sum(predict * actual)
T... |
1d5d2991de3271ff128060385a4e507dda47f9660c0d2efb36624ab931b6c3b1 | Python | 5,097 | 149 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.ffn.design import FFN as FFNDesign
from elasticai.creator.nn.integer.linear import Linear
from elasticai.creator.nn.integer.quant_utils import (
AsymmetricSignedQPa... |
b8280f0c4081703cc2c9b4ea0c2d90b54540870d636b737f483dc2c80606127a | Python | 5,097 | 179 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
3575222cf625debad1fe3160be4621ff4b391128833d342a9f1e2be45bdb8f59 | Python | 5,099 | 142 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
32729ba4cd96807ae8e8cc66fe9a4179b45acbec4e8a6c53b1e281cf9e593406 | Python | 5,101 | 147 | ##
# \file correct_intensities.py
# \brief Script to perform intensity correction across images given a
# reference image
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date October 2017
#
# Import libraries
import numpy as np
import os
# Import modules
import niftymic.base.data_... |
00a64d922cd1cd26cab83ca9d9849a1a918ec3c913962a54810cb07bf577c4a9 | Python | 5,102 | 138 | """
Functions used for preprocessing spike trains
@author: Iris Yoon (irishryoon@gmail.com)
"""
# ==========================================================================
# Updated neuron selection
# ==========================================================================
# Select neurons according to the followi... |
e1b0ee89cb3c2782688f16c75f7689cb78c4935b83a782c94c8141823a8d824e | Python | 5,102 | 88 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its 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 argparse
from utils import str2bool
import sys
def add_params(parser):
parser.add_argumen... |
16598ed9feace49c2935dbdf049606d8df1c052f496b4e6580274470e9a66fe9 | Python | 5,103 | 161 | import numpy.fft as ffto
from autograd.extend import defvjp, primitive, vspace
from . import numpy_wrapper as anp
from .numpy_vjps import match_complex
from .numpy_wrapper import wrap_namespace
wrap_namespace(ffto.__dict__, globals())
# TODO: make fft gradient work for a repeated axis,
# e.g. by replacing fftn wit... |
3cdffa51eb81fe2f7a181359e18e1418395ea0ebd94195614e646c6e06877110 | Python | 5,103 | 136 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import torch
from sklearn.metrics import balanced_accuracy_score
import argparse
from sklearn.model_selection import StratifiedKFold
from torch.utils.data import DataLoader
from setting import *
from... |
5307499b9cd3fd9406d95e27d65dfe1844fabebd5c9adee7a8d036e80d8cd6c9 | Python | 5,105 | 175 | # Node-group asset "Menu Residue Mask" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHEC... |
08c0853645213338d87e5ba37d5263b50063e6b56ace6e109d6d59a1bdd5e8bf | Python | 5,107 | 126 | import sys
import random
import os
import argparse
import sys
import pwd
import time
import subprocess
import re
import shutil
from sklearn import metrics
import re
from sklearn.metrics import roc_curve,roc_auc_score
import numpy as np
import glob
import logging
import io
import tensorflow as tf
#from callbacks import... |
85c225c9d6a607922c5cec377ef726b508a011f758fbf671bc11837746f47f48 | Python | 5,108 | 196 | import matplotlib.pyplot as plt
import numpy as np
import PyMieScatt as ps
import meep as mp
r = 1.0 # radius of sphere
wvl_min = 2 * np.pi * r / 10
wvl_max = 2 * np.pi * r / 2
frq_min = 1 / wvl_max
frq_max = 1 / wvl_min
frq_cen = 0.5 * (frq_min + frq_max)
dfrq = frq_max - frq_min
nfrq = 100
## a... |
17c40bfd809c98c960f973f67beb1427c4f3f1df7e1ea35b0538b7cef247dea2 | Python | 5,109 | 194 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
5ebc424795130f1e76e1d20186f420189a463bf142443beab8d3c887e0872c2b | Python | 5,110 | 144 | # -*- coding: utf-8 -*-
"""
Created on Apr 20 2023
@author: Jonas A. Thiele
"""
###Plot performances of prediction models trained with FC links between nodes of intelligence theories vs. models
###trained with FC links between the same number of random nodes
import numpy as np
import scipy.stats
impo... |
8244c2b09ddb9ba269e12900fa252dfbffbe76c55531a9919d3eb6c31f290c90 | Python | 5,110 | 98 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
8bab223422ceb319cc9df94a4f2622df636991efc27de8820c9550c648868f18 | Python | 5,110 | 49 |
import numpy as np
import scipy.stats
from ..model_compare import *
def noiseceilingcalc(actvect_group_first, actvect_group_second, full_report=False, print_report=True, reliability_type='conditionwise_compthenavgthen', avgthencomp_fixedeffects=False):
"""
Function to calculate the repeat reliability of the d... |
052cc3568b86426255800f834ec79188d918cdcf315d3289a50f34bd222fdcf8 | Python | 5,112 | 136 | # coding=utf-8
# Copyright 2026 The Google Research 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 applicab... |
2472fa5ba4d355d7bbd96bb721a45e737006f3a714e3de0255fd41e1c500ea8b | Python | 5,113 | 170 | import cocotb
import numpy as np
import pytest
import torch
from cocotb.clock import Clock
from cocotb.triggers import ClockCycles, FallingEdge, ReadOnly, RisingEdge
from cocotb.types import LogicArray
from cocotb.utils import get_sim_time
from elasticai.creator.arithmetic import FxpParams, int_converter
from elastica... |
2875a90d64b8852662fdabc0da1f2a66604e3048e912ebd15dc906d217eeabe4 | Python | 5,113 | 152 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
aadad74d5c2a5b85786390df4071466acc57e028279fe499c97c473125e0d9f4 | Python | 5,113 | 147 | # 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.
from typing import Union
import torch
import torch.nn as nn
import esm
from esm.modules import ContactPredictionHead, ESM1bLayerNorm, Roberta... |
a2c74d6e7759fc9f34a1a0ec976905b5691b30550bdfbd02f6aa627a4e7132a2 | Python | 5,114 | 111 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core as core
import control.m... |
a573f2c55a437d51fbfb1e7432b2da30ed4f24a0f2b24fd9dc54ea11062de9ce | Python | 5,116 | 120 | from os.path import join as pjoin
import os
import numpy as np
from nilearn.image import load_img, new_img_like
from nilearn.masking import apply_mask, unmask
from tqdm import tqdm
import pandas as pd
from dimension_encoding.utils import calc_nc
import glob
class B5kLoader():
def __init__(self, b5k_dir="../da... |
f33d23fae4f78e524d259c4dd8c7a8bfd0c837908ea1d92d1d488965d9e1b3f8 | Python | 5,116 | 123 | import os
import h5py as h5
import numpy as np
from tqdm import tqdm
import os.path as path
import matplotlib.pyplot as plt
from single_nrn_tune.generator import syn_exp
from utils.utils import visualize_traces
def distance_compute(dynamic_, feature_, dynamic_exp_, feature_exp_):
return np.sum((np.abs(dynamic_ - ... |
133b9c9cb95a07d326f152742b7bac63b53407dc17d4916dfbe0825b9509a0b4 | Python | 5,117 | 131 | #
# Copyright Bradley Lowekamp
#
# 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.txt
#
# Unless required by applicable law or agreed ... |
3233a2802ef9cfaaa844c9201e21eaa2dedeab17f00d94ab11f94930f9be6c71 | Python | 5,118 | 151 | import hashlib
from typing import TYPE_CHECKING, BinaryIO, Dict, Iterable, List, Optional
from pip._internal.exceptions import HashMismatch, HashMissing, InstallationError
from pip._internal.utils.misc import read_chunks
if TYPE_CHECKING:
from hashlib import _Hash
# NoReturn introduced in 3.6.2; imported onl... |
84827cdc67ab74580509da1b200db726081eb5e825fee0b84a9e7cea7cc56cf1 | Python | 5,118 | 159 | import contextlib
import itertools
import logging
import sys
import time
from typing import IO, Generator, Optional
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.logging import get_indentation
logger = logging.getLogger(__name__)
class SpinnerInterface:
def spin(self) -> None:
... |
25818c8a587ac8b82eec8e30d01eb6d360edbd977985b57dd2bd3431380b2a17 | Python | 5,119 | 163 | """Plot decoding performance."""
from __future__ import annotations
import csv
from enum import Enum
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import pte_decode
import scipy.stats
import motor_intention.plotting_settings
import motor_intention.project_constants as con... |
590920e54d6f2472c9107ccf24674ae98eb7ead0509945011c6d2bef11175ce3 | Python | 5,120 | 130 | import optuna
import torch
from torch.utils.data import DataLoader, TensorDataset
import numpy as np
from sklearn.preprocessing import StandardScaler
from torch.optim import Adam
from torch.nn import CrossEntropyLoss
from lightning.pytorch import LightningModule
import pandas as pd
from optuna import create_st... |
83292259a91e1b2c42ee8df094bef5841249a803253bf7ab71c2681c53df5d67 | Python | 5,120 | 134 | import os
import pickle
import argparse
import pandas as pd
import numpy as np
def load_model(filename):
path = os.path.join('model', filename)
with open(path, 'rb') as file:
return pickle.load(file)
def evaluate_model(model_data, row_df, use_larger):
if use_larger:
model = model_data['l... |
1843e092aac53e9e6062a53c01ffbf166e67070076d30b446165fd910a484f74 | Python | 5,121 | 162 | import anndata
import numpy as np
def unique_timepoint(*populations):
"""Retrieves the unique time point at which all populations live.
Returns
-------
t : float
The said timepoint
Raises
------
ValueError
If all populations do not live in the same timepoint.
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.