sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0fb47968b7212afa50fef26df1780a313f1bf2d3fed1c214b20221e763ad53f2
Python
4,549
129
import logging import numpy as np from copy import copy from typing import Optional, List, Dict, Tuple, Union from .parser import dataparser_mapping from ase.io import read import pytorch_lightning as pl log = logging.getLogger(__name__) class LitAtomsDataset(pl.LightningDataModule): def __init__(self, p_dict)...
6522f70ba92ec18d0ace9795352faf79a1d1e77da611e016de877b78465c009e
Python
4,549
158
import pandas as pd import numpy as np import torch import torch.nn as nn import torch.optim as optim from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, roc_auc_score, average_precision_score, precision_score, recall_score, \ f1_score filename = 'data/western_china_tra...
9573a06724e53a6e4798af2dc398b0d00dffe40eb0473b171ce690908bef9685
Python
4,549
136
"""Support functions for working with wheel files. """ import logging from email.message import Message from email.parser import Parser from typing import Tuple from zipfile import BadZipFile, ZipFile from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import UnsupportedWheel VER...
905d52940fe2204eebaa8f4d9cbdd21c6d55c2e173925d5e48e67088fcdaa40f
Python
4,552
151
# Node-group asset "Visualize Chi Angle" (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_CH...
b17994a4fddea2516bba19186710f6afbd95377abff0d7f2261ddf580d4a4f5f
Python
4,552
138
# # MIT License # # Copyright (c) 2024 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,...
c6c70bb5f6da26de86701becf6384c20e586eae961cb54689254ef1200c651a0
Python
4,552
126
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_port from elasticai.c...
36a58fdac58a078608f18bcf642a3a24dd40b28e6821b964b0e2315898a4a3ab
Python
4,554
133
import os import numpy as np import pandas as pd import argparse import pyreadr import scanpy as sc import anndata import sklearn import umap import annoy import torch def read_data(args): """ - Load csv preprocessed with scanpy or Seurat. - Must be a csv with format n_cells x n_genes with normalized (no...
7a1bbb135a223de375db9cc8b450f25e0f8339bde335b4ba1d10820040ac97fd
Python
4,554
107
# Copyright (c) 2022, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
fddc163caae01eae1fc127b5fd27e0a9e45b6c50b4874fcbd543df4172b81fe0
Python
4,554
115
# Script to launch particle swarm optimization # Requires an argument that is the directory with the settings files that specifies objectives/constraints # Ex: settings_2013_31_120RMT, settings_2020_43_120RMT # Must be run with at least 2 processors import os os.environ["OPENBLAS_NUM_THREADS"] = "1" from os i...
02e684b353fb482f622a7208443395c8c6c43fc109a0b8f6d24182df83b1f67e
Python
4,555
141
"""Plot performance Medication OFF vs ON.""" from __future__ import annotations import csv from enum import Enum from pathlib import Path 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 constants import m...
4be046104502e6ef07df5384127a4c1e6a2f72c30fe74f142dca64b718e98593
Python
4,555
156
"""Tutorial example for dipole current sources in cylindrical coordinates. tutorial reference: https://meep.readthedocs.io/en/latest/Python_Tutorials/Cylindrical_Coordinates/#nonaxisymmetric-dipole-sources """ from typing import Tuple import meep as mp import numpy as np RESOLUTION_UM = 50 WAVELENGTH_UM = 1.0 N_SL...
a550a882231d0155aaf57b1897a9f44392a26e99b6743deb273a590a51cf7f1b
Python
4,557
128
""" Unit tests for regtools/registration/core/config.py Covers: - HAS_ANTS flag - DEFAULT_REGISTRATION_METHOD - check_ants_environment - estimate_registration_memory - Color constants """ import numpy as np import pytest # ====================================================================...
b126250e6178b7deeb63faead1708f0f6781ee1fc995200126e652e2664e1b95
Python
4,557
114
from __future__ import division, print_function import os os.environ["CUDA_VISIBLE_DEVICES"] = "7" from Dataset.mydataset import Dataset import argparse import numpy as np from BDNN_Model import BBP_Model from BDNN_Model_Wrapper import BBP_Model_Wrapper import time import torch.utils.data #%% def mkdir(paths): if ...
ff407c59cd6f86240c61590dd9f0d4dfa6f3821154c895f372062e66c69346c9
Python
4,559
113
import gc import logging import model.optimiser import torch from sklearn.preprocessing import MultiLabelBinarizer from torch.utils.data import DataLoader from src.utils import calc_measurements logger = logging.getLogger(__name__) class Client(object): """Class for client object having its own (private) examp...
99056e23e4559937c8b4bce0ab765053c73c5887db9e8c424d5beb1bddb76727
Python
4,560
135
import os import logging import json import random import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from sklearn.metrics import roc_curve, roc_auc_score, average_precision_score, f1_score, confusion_matrix def eval_ddi_model(true_label, pred_score, threshold: float = 0.5, opt_thr:...
711d14bfd68f1c4e19b3351c697bdd8b9b8ff1cbbac9615e066c7089f57bb8c3
Python
4,561
150
from pathlib import Path import yaml import torch import math import os import torch.nn as nn from timm.models.helpers import load_pretrained, load_custom_pretrained from timm.models.vision_transformer import default_cfgs from timm.models.registry import register_model from timm.models.vision_transformer import _create...
8162f218d243a8b0f3b9ec2ee9d33ef535e9c5b2fcd3d49dcc0f90b5ccdd0acd
Python
4,561
100
import torch from torch.optim.optimizer import Optimizer, required class PIDAccOptimizer_SI(Optimizer): r"""Implements stochastic gradient descent (optionally with momentum). Nesterov momentum is based on the formula from `On the importance of initialization and momentum in deep learning`__. A...
3d9d41c65eaaa2282e849334a54cbe8b3baea6f6119b0173c7e6a76ea80cdd7b
Python
4,563
126
import gzip import xml.etree.ElementTree as ET import numpy as np from ..utils.orbutils import FracPolyRGD, ExpRGD, GridFunc, grid_overlap class gpaw_psp: def __init__(self, filename): if filename.endswith('.gz'): with gzip.open(filename) as f: source = f.read() else: ...
4a14d9c806aafcfcf0c15b9708e18daeecd2d8997e2443290292c3ca479c8cf9
Python
4,563
120
import sys, math sys.path.append("../../../../../bin/") from pybioshell.core.data.basic import Vec3 from pybioshell.core.data.io import Pdb from pybioshell.std import vector_core_data_basic_Vec3 from pybioshell.core.calc.structural.transformations import * from pybioshell.utils import LogManager LogManager.INFO() i...
c7a3c63d54043b1130fc20cfb2752326f128f7aedfcd2e39372d318e532e9487
Python
4,563
145
from scconfluence import model, unimodal import anndata as ad import numpy as np import mudata as md def create_synthetic_adata(n_obs, n_features, n_batch, dim_pca, obs_prefix=""): """ Create a synthetic AnnData object with the specified number of observations, features and batches. :param n_obs: number o...
67cbf46d547d8099926884a6cacd3435b1276a4f14731cda661b3db5c4693d24
Python
4,564
150
import csv import os from typing import Dict, Optional, Union import matplotlib.pyplot as plt import numpy as np import torch from torch.utils.tensorboard import SummaryWriter class CallbackSaveImage(object): def __init__( self, dataset, model, device, output_dir, num_sample=4, vmin=-2, vmax=6 ): ...
d1db5049fd8a888f119abf68d67105590c7bb837beca0376934d8ed074609f0b
Python
4,564
129
# 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...
1d4311f98187aa83ecd93107875e804ba7951cf641f0a23f1f53319a17556a7a
Python
4,566
105
# importing libraries import tensorflow as tf from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras import Sequential from tensorflow.keras.layers import Conv2D, MaxPooling2D from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense from tensorflow.keras import backend ...
0da010a895cae970cbbbfcf1fc95d7ffe6b6313b07415adcd7f920bb2e7b53eb
Python
4,567
113
from .cave import CaveDataset from .ds_utils import ( BANC_CAVE_DATASTACK, _load_live_banc_annotations, _load_cave_banc_annotations, ) __all__ = ["BANC"] class BANC(CaveDataset): """Brain-and-Nerve-cord dataset. Parameters ---------- label : str A label used f...
f0ce4e4734cca58fd6919603888b57eb3c15ec33c27a15479a04700eebdc2ec7
Python
4,567
112
""" Utility functions for HED command-line scripts. This module provides common functionality used across multiple HED scripts, including logging configuration and argument handling. """ import json import logging import sys from hed import __version__ from hed.errors import ErrorHandler, get_printable_issue_string,...
07d47540a6aafd3c911bc091ce75fddb8b1a6fb816367ef946ce99bce510532f
Python
4,568
125
# Node-group asset "oxDNA Recover Vectors" (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_...
b83e8e1ebc4dfbc0dfc26ca523cd1605aac3bd4bc8be11a0360fec1090b62e62
Python
4,568
151
"""Euclidean layers.""" import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.module import Module from torch.nn.parameter import Parameter def get_dim_act(args): """ Helper function to get dimension and activation at every layer. :param args: :return: ...
bd951aab5b8dfb8db65453d9ef285e09b3f077a3cc525cfd38de66277d2a9862
Python
4,569
156
"""Core recipes for the tblite code.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from quacc import job from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize, VibSummarize from quacc.utils.dicts impo...
7a6787255637fe2aab61ab60b3fde2bd4eec320154c37d5cfff561abfe10d37a
Python
4,570
109
# 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...
3298924563ce2dfedc3f3fba26a5116bfdacd9d98c8099399e3fe8ed8caa4373
Python
4,571
76
import warnings warnings.simplefilter('ignore') import numpy as np import nibabel as nib import matplotlib.pyplot as plt import os import subprocess sub=['sub-010005' , 'sub-010009' , 'sub-010011' , 'sub-010014' , 'sub-010015' , 'sub-010016' , 'sub-010017' , 'sub-010018' , 'sub-010020' , 'sub-010021' , 'sub-010022...
56a78e303263faf88a2e1ad0a914d411df0120d8581599f0400732d7e72fd79e
Python
4,571
134
# 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...
a898f3683f58ac6f481c3c19e9ebceaa527a06f842cb700f82112529f9bccc0f
Python
4,571
108
import pandas as pd import os from tqdm import tqdm from tabulate import tabulate import matplotlib.pyplot as plt from matplotlib.lines import Line2D import seaborn as sns from src.utils import map_to_score_grid from constants import N_ITEMS, DATA_DIR from src.preprocessing2.process_ratings import merge_rating_file...
3f15536a06215a856fe7a5e76628eb45a14e97af5cf922a90fd3975fbfe91fa4
Python
4,572
123
import os import tempfile import pandas as pd from tests.mock_data import MockTrainingData, MockCuppaClassifier, MockCvOutput from cuppa.classifier.cuppa_classifier import CuppaClassifier from cuppa.runners.prediction_runner import PredictionRunner from cuppa.runners.training_runner import TrainingRunner from cuppa.cl...
970eb0b9b0f47a174b241ab7621bd3a8bb6b8635a01e6239c1b2e809dcecec31
Python
4,573
146
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 3 17:33:29 2024 @author: felipe """ import numpy as np import matplotlib.pyplot as plt import scipy.signal as signal def plotStep(system,t,ax='None',show=False): """ Plot the step response of an LTI system (discrete time) Parameters...
9193dee745867657321e9656b213db9493016fdd370d3a20fab79a89b868736b
Python
4,574
123
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: carlos atico ariza """ import os import re import tensorflow as tf # import tflite_runtime.interpreter as tflite import numpy as np import pandas as pd import sys def tflite_img_class(image_dir=[], prediction_csv='malaria.csv', trained_m...
a2486eb86ade69f6d34a7e43620d5fa34f16ae89c2895fa42ef822471375d1f2
Python
4,574
119
import os import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from datasets.SequenceDatasets import dataset from datasets.sequence_aug import * from tqdm import tqdm #Digital data was collected at 50,000 samples per second signal_size = 1024 #Three working conditi...
b4da7ff0dd05f7171494f059c4ecc8a404783deecca29f7a522a6eb290cbc799
Python
4,574
142
"""Interactive Molecular Dynamics (IMD) streaming trajectory support. Provides support for real-time trajectory streaming from molecular dynamics simulations using the IMD protocol via MDAnalysis and imdclient. """ import logging from pathlib import Path from typing import Optional import MDAnalysis as mda from ..bas...
5c1a09fe79448f33653a3f3df89582a3ee4b4786b54442d0843be84fa18e4ae3
Python
4,575
129
""" Simulate effect of increased LTD """ import os import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from src.constants import pink, green from src import constants from src.constants import lr, control_th, increased_th, min_th, max_th, Tplasticity from src.constants import fi...
681c080285a606bb2682eb418aaa6e2ce1839f9d2bc93875572605b06989b177
Python
4,575
141
from pathlib import Path from typing import Literal import cocotb import hypothesis import pytest import torch import torch.nn as nn from cocotb.clock import Clock from cocotb.types import LogicArray from hypothesis import strategies from hypothesis.strategies import DataObject from elasticai.creator import ir from e...
1f0fabdbdc8f51a4637d0ad343bac02ca93204f34a083a919829f3a453854091
Python
4,576
112
# 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...
9d938b774f90425fe31ef53206b5f26ee715c007e1aff69abd8920ac61a01a25
Python
4,576
114
import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Wedge from matplotlib.collections import PatchCollection def wedge_plot(ax, data, index, data_label, num_regions, num_zones, color_palette, start_degree, end_degree, show_index=True): """ Generate a wedge plot with data, index, ...
30841f87b0e8f3d36412f4ee16b80d392c21fc640868d7b2f80136e76422eb41
Python
4,577
133
from pyclamp.gui.pyplot import * from pyclamp.dsp.fpfunc import * import pyclamp.gui.pyqtplot as pq class pywanim (pq.anim): roi = None roispec = None fps = None rcf = 1. ind = None Ind = None Act = None Anim = None _i = None def __init__(self, _obj = None): self.setObj(_obj) self.setRes() ...
38acf213773b666e511df0c0f28b18f5c1bd3b860c6c505faf5a04264a8f5415
Python
4,577
88
# 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...
d2e9e9612a78d59b1a996f5889c791b4ffb43f71c7290f2d36411a9c0f10bae4
Python
4,577
111
""" DeepLabCut2.0 Toolbox (deeplabcut.org) copyright A. & M. Mathis Labs https://github.com/AlexEMG/DeepLabCut Please see AUTHORS for contributors. https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0 """ import os #import yaml from pathlib import Path #impor...
306bf6d3ee4feeb911f31a2b6624588fef50e723768b6c02ee2781a20469468e
Python
4,578
106
from bioimageio.spec import save_bioimageio_package from bioimageio.spec import load_description # import bioimageio.spec from pathlib import Path from ruamel.yaml import YAML import tempfile import zipfile import re import os def export_bmz_notebook(notebook_id, output_path): zerocostdl4mic_path = os.path.abspa...
57a50611d54db8fec344042b61111c1aace03d5537e13395639ca99da74ebc6c
Python
4,579
112
# regtools/tests/test_batch_2d_points.py import os import numpy as np import pandas as pd import pytest from regtools.registration.gui.batch_2d_model import BatchRow, BatchConfig from regtools.registration.gui.batch_2d_points import ( resolve_points_per_image, resolve_points_single_csv, points_ro...
32193bbf869a2018f3993ebbd575a2a6913d01a13c2346c923b927d59067bac3
Python
4,580
138
# -*- coding: utf-8 -*- import logging import tensorflow as tf import tensorflow_probability as tfp from tfsnippet.distributions import Distribution class TfpDistribution(Distribution): """ A wrapper class for `tfp.distributions.Distribution` """ @property def is_continuous(self): return...
87be8480616cab47dd9c4dc2c54fa8caae3ca20722d3fd107f926878d1a00b50
Python
4,581
115
from predictor import Predictor, SingleNail from utils import * import cv2 import random as rng import matplotlib.pyplot as plt import pandas as pd import numpy as np from PIL import Image # variabili da impostare SOGLIA_AREA = 100 ITER_ERODE = 5 SOGLIA_REGIONE_UNGHIA = 0.95 class MyProcessing: def __init__(self)...
94bb1e963e9b1b00300828995cb8f2328559084b5323565fab043c59af1908f3
Python
4,581
135
import json import torch import tqdm import numpy as np import torch.nn as nn from pathlib import Path from typing import Any from ..prixfixe import Trainer, PrixFixeNet, DataProcessor, DEFAULT_METRICS from .dataprocessor import UnlockDNADataProcessor from .add_blocks import SequenceMaskLayer class ScheduledOptim(): ...
b130cdc41ac64e5ba7ea19525ac9b80d6dc4ee5f257b094314b4b609a7d6a6b1
Python
4,581
127
"""Pure-Python status snapshot for the config menu GUI. No Qt or matplotlib dependency - safe to import from tests and from the matplotlib viewer. GUI code consumes these dataclasses/dicts. """ import json import os import platform import re import shutil import subprocess import sys from dataclasses imp...
78443a50341fdef05c84e6bda5f7c699d1c4e36f873061eef10fecc304b2d788
Python
4,584
109
r"""Test ChemDoodle JSON format using the OpenBabel Python bindings On Windows or Linux, you can run these tests at the commandline in the build folder with: "C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake -R pybindtest -VV You could also "chdir" into build...
7feac4f5b4501b0dcde672c50d92e497b0f04ab5edeafc0e7c690bb9bf3d9fb6
Python
4,585
122
""" Unit tests for regtools/cell_counting_legacy/points_converter.py Covers: - read_legacy_txt - convert_txt_to_napari_csv """ import os import tempfile import shutil import numpy as np import pandas as pd import pytest DATA_DIR = os.path.join(os.path.dirname(__file__), "data") # ==========...
c2441b9333a2adc36df2bd974f7c1caf094966a7d7c941ad90e417921059a2d4
Python
4,586
162
# -*- coding: utf-8 -*- # # Helper functions for frontend test design # # The `run_` function signatures take a callable, # the `method_call`, as 1st argument # # 3rd party imports import itertools import numpy as np import os import matplotlib.pyplot as plt from syncopy.shared.errors import SPYValueError, SPYTypeErro...
fe6a83c4c2a7aa2c1263a92c34ce19ffde5c3b6ae13e5a9caba8ef3bf96f97dd
Python
4,586
164
import torch import math from segm.utils.logger import MetricLogger from segm.metrics import gather_data, compute_metrics from segm.model import utils from segm.data.utils import IGNORE_LABEL import segm.utils.torch as ptu import gc import numpy as np import torch.nn as nn import torch.optim as optim import matplotlib...
0b92d1fdbcacce62a769286c7ddfc1e6c4f20ac41338c9307df564c8a038ece4
Python
4,588
1
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import scipy.sparse as sparse class ConnectedGroups: """ Flexible class that gets string based definitions of neuron groups and connections (between layers) as input and creates the net """ def __init__(self, net, topology, params, ...
aebf23f65ac23d17b4b15e66bfec557f6c0d21dd2fce9ea220977572a3a4d0fe
Python
4,588
190
# Node group ".MN_peptide_chi_values" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are r...
25c7802b2c1ebbbbe701518e5b4643803e0f53f357f1bcb401ffb5bada2bea17
Python
4,589
130
import random import unittest import torch.nn as nn import torch from torch.utils.data import Dataset from torch.utils.data.dataloader import DataLoader from torcheeg.trainers import CWGANGPTrainer, WGANGPTrainer from torcheeg.models import BGenerator, BDiscriminator, BCGenerator, BCDiscriminator class DummyDataset(D...
31a7ee6e2b5b823394f7ea762341140631ce9d8b9869ee917df5ce5f36714c33
Python
4,590
128
import pandas import numpy as np from merlin.core import analysistask from merlin.util import spatialfeature class PartitionBarcodes(analysistask.ParallelAnalysisTask): """ An analysis task that assigns RNAs and sequential signals to cells based on the boundaries determined during the segment task. "...
59c02c886e67a44d51ed5831f894870299f65be27b65e6448e024f4f26d6f418
Python
4,590
133
""" Cell detection and counting utilities. Consolidated from cellAnalysis/cell_detection.py and gui/gui_shared.py """ import numpy as np import scipy import scipy.ndimage import cv2 from skimage.feature import peak_local_max from skimage.segmentation import watershed from .io.tiff_io import read_tif_sec...
4f0d6616dfa369d09f1536a0f70d35d8fc8b87d16e23b37104b2e0591bd96366
Python
4,591
148
from __future__ import annotations import pytest torch = pytest.importorskip("torch") from importlib.util import find_spec import numpy as np from ase.build import bulk from ase.md.langevin import Langevin from ase.units import fs from quacc.recipes.mlip.md import md_job libraries = [] if has_matcalc := find_spec...
bbeb14e3766c859777a53c244be65659e547d2b317c19704fa6914899ecc4bed
Python
4,591
140
# 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...
6931f5b4d379aea5e1e81e6e3ead6443850b3e3046de32c31c1a702ad5eefcda
Python
4,593
117
''' Description: Basic neural networks. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import torch.nn as nn import torch # =========================================== # Dictionary of activation functions ACT_FUNC_MAP = { "none": nn.Identity(), "sigmoid": nn.Sigmoid(), "tanh": nn.Tanh(), "so...
5b83d10ec11c861b7aad55c17946a2129b114325061f4918ed262c9f035650cb
Python
4,594
107
#!/usr/bin/env python # coding: utf-8 import argparse import pandas as pd import random import numpy as np from keras import models, layers, regularizers from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler # Set up argument parser parser = argparse.ArgumentParser(description="Ke...
0cc00be002907aeb71012c568a277fac8c1974b4d12eb506a842280f1cfd2945
Python
4,595
119
import os from os import path import sys d = path.dirname(__file__) parent_path = os.path.dirname(d) sys.path.append(parent_path) from BDNN_Model import BBP_Model from BDNN_Model_Wrapper import BBP_Model_Wrapper from Dataset.mydataset import Dataset import torch from Dataset.Environment import Environmen...
17151bc3fc425d0018a2fea44d2597596e0c119a585152443a2458e4ba3bf102
Python
4,595
124
import numpy as np import h5py from ..constants import hartree2ev from ..io.bgwio import bgw_vsc from .aodata import AOData ''' This module implements several functions needed by real-space construction of AO Hamiltonian. This includes reading local potentials, reading nonlocal part of pseudopotentials, and construct...
fd4b9a18494288e5da0ca9be6615cf4673489a2b2c411d52fab3454888f74d55
Python
4,596
121
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ...
0835cc928d959df487c20de14341ab17ad9e4fe07bf469f0f5546f73f0b2dfc3
Python
4,597
97
from ovito.io import import_file, export_file from ovito.modifiers import LoadTrajectoryModifier from ovito.modifiers import ClusterAnalysisModifier from ovito.modifiers import UnwrapTrajectoriesModifier from ovito.modifiers import CalculateDisplacementsModifier from ovito.modifiers import SelectTypeModifier from ovito...
b335fe6a6841220eac8960d9376e12f3e42978eb2927759d7475b6edb057234e
Python
4,597
150
# # 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,...
c9c858a77e5f5c50a1f0b0aff1d208e436acb13646d0e3e93905637105286f9d
Python
4,597
109
# Helper functions for analyzing network gradients and comparing # alignment between networks. import numpy as np import torch from torch.func import vmap, jacrev from torchmetrics.functional import pairwise_cosine_similarity # local imports from .helpers import apply_to_layers def compute_jacobian(net, images: torch....
21bb68f4c34b1176ae7d69ab7a6be6315cea1410559deb8165e2babd2f8ee2ea
Python
4,598
144
import json import sys import os import datetime import numpy as np from shutil import copyfile import SimpleITK as sitk from src.utils import file_utils as futils from src.utils import sitk_utils as sutils def get_paths(dir, extensions=list()): paths = list() files = os.listdir(dir) ...
bba2f99c59037d8c5d374363db930410239bbf7d7dc02fbaadebd7122d274c12
Python
4,598
103
import os.path as op import numpy as np import mne from params import BIDS_ROOT as bids_root from params import SUBJECTS as subjects from utils import load_raw, load_df, laplacian_reference def compute_R2(psd1, psd2): psd = np.concatenate([psd1, psd2], axis=0) n1, n2 = psd1.shape[0], psd2.shape[0] rati...
dc4d75f103580a27d3248dfd42747e63de377ff0db9742d5c6d87a1ab13bb498
Python
4,598
119
# Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
da1f45bd468427317e65bab775c59abfc18931ed13e087ffb70d69d9fdfab662
Python
4,599
108
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 9 07:09:45 2022 @author: heavens """ import os import csv import toml import itertools from tqdm import tqdm import numpy as np class Profiler(object): def __init__(self,data_f, config): self.data_f = data_f print("Loading chu...
eed54cf25ce6ab99280a78594772fc2f06add654c941d25b30035493a949d0bf
Python
4,599
123
# # 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,...
48c9e4118082e019bc563992364aad808ca6bea78fd0e01028621aec6efb8648
Python
4,600
189
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..file_utils import requires_backends class FlaxPreTrainedModel: def __init__(self, *args, **kwargs): requires_backends(self, ["flax"]) @classmethod def from_pretrained(self, *args, **kwargs): requires_backen...
5bd03f1c02be9c1edbd720f817f059e1d5c23d78234f88e4c0bc990942dd90a9
Python
4,600
155
# 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...
cdf7b7b66c09df19c9feb40921b70f314ceb30b0d374a6a4f2e39d0f729e1bd9
Python
4,600
191
#!/usr/bin/env python # coding: utf-8 # ## Analysis of stratified drug response # In[1]: import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import upsetplot as up import pancancer_evaluation.config as cfg import pancancer_evaluation.utilities.analysis...
25750e943cdf840e4d05c28354b6b831fde02bc70f8456fd97aae70a7f3ef141
Python
4,601
131
import logging import tempfile import time from pathlib import Path from zipfile import ZipFile import pooch import requests from rich.progress import Progress, TaskID logger = logging.getLogger(__name__) pooch.get_logger().setLevel(logging.WARNING) # Transient network failures that are worth retrying. # ``urllib.er...
df72588a8a68399de6c679b19910f7ae2de6741439669efba8ad2564fb535a61
Python
4,601
126
import numpy as np import pandas as pd import scipy.sparse from pandas import CategoricalDtype from cirrocumulus.data_processing import handle_data from cirrocumulus.embedding_aggregator import EmbeddingAggregator def create_df(test_data, measures, dimensions, basis): df = pd.DataFrame(test_data[:, measures].X.t...
8a16cde334a8a34dd692689cb45b7a6ae3410aa06d68ee8a941d3d7015ac927f
Python
4,602
113
'''Preprocess events from the presentation logs to the BIDS events file for the nback task. Parameters ---------- path : str path where the raw data is stored savepath : str BIDS folder ''' import os, sys import re import pandas as pd from glob import glob path = '/m/cs/...
0464da490af1990417e97d30e66aca81091881640fb334f752640970f5b310c7
Python
4,603
126
import torch import torchvision.transforms as transforms import numpy as np import cv2 from utils.ddfa import ToTensor, Normalize from model_building import SynergyNet from utils.inference import crop_img, predict_denseVert import argparse import torch.backends.cudnn as cudnn cudnn.benchmark = True import os import os....
f9f933bc8fd87e8a6b31beaafe012677f6c85897f25b576b78172e4983ac6252
Python
4,603
146
#!/usr/bin/env python #****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by #...
8597f825b3fabdad5f1673380db138ef33e26420b4607d2dda80d75781c45096
Python
4,604
131
import glob import os import subprocess from .ghdl_report_parsing import parse_report class SimulationError(Exception): pass class GHDLSimulator: """Run a simulation tool for a given `top_design` and save whatever is written to stdout for subsequent inspection. This runner uses the GHDL tool. ...
4aff9bf49b43e417aa1d223def74e04ee00543438b402bb642786d72ea8562d5
Python
4,605
152
from typing import Dict, List, Union import numpy as np from ..base_transform import LabelTransform class Binary(LabelTransform): r''' Binarize the label according to a certain threshold. Labels larger than the threshold are set to 1, and labels smaller than the threshold are set to 0. .. code-bloc...
4865d1a54e12d71d3f94ec4e2d879ecf48478a8266052fe10064a6e66a9e789f
Python
4,607
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 ...
76d60fb8f8813d52ecd4bf61d6be848bb5fb8bdb5e061bd78e53ade97870e14b
Python
4,607
125
"""Regenerate ICI reference data with R's survival package (no R needed by pytest).""" import json import subprocess from pathlib import Path import numpy as np # RCS is the truncated-power basis from Hmisc::rcspline.eval, with explicit # percentile knots. Supplying knots avoids Hmisc's small-sample/tie heuristics. ...
19b31b4643614397a3b8efb65ee92aa439c1f1af57c285c2f50073515d28d061
Python
4,608
133
# 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...
1dea902a67e6870486e43b8843957566cd64924bce3d6ccb14dbc9de65c83664
Python
4,608
163
import numpy as np import numpy.testing as npt import petsc4py import pytest from mpi4py import MPI from scipy.sparse import coo_matrix from astrovascpy.scipy_petsc_conversions import ( PETScMat2coo, PETScVec2array, array2PETScVec, coomatrix2PETScMat, distribute_array, ) # pip install pytest-mpi #...
2d4f1db2d6b82030b64525e19f90b41db2f48d5646000f85f6769c442ff1224a
Python
4,608
100
from typing import Optional, Union, List from segmentation_models_pytorch.encoders import get_encoder from segmentation_models_pytorch.base import ( SegmentationModel, SegmentationHead, ClassificationHead, ) from .decoder import MAnetDecoder class MAnet(SegmentationModel): """MAnet_ : Multi-scale At...
51e9e63853070178746d9adb8ec0da63b05b1a8b25a8e33da52f2655580a6ea0
Python
4,608
121
# -*- coding: utf-8 -*- """ """ import os from nipype import logging from nipype.interfaces.base import ( TraitedSpec, File, traits, Directory, BaseInterfaceInputSpec, BaseInterface ) __docformat__ = "restructuredtext" iflogger = logging.getLogger("nipype.interface") class ParseScannerDi...
25e9e40e7ca2ec1c8eb49e75394e8180601af88d7ef646580b32cb4cd4e3b5f2
Python
4,609
143
"""Class for creating a tkinter-based progress bar in an external window.""" import tkinter from tkinter import ttk class ProgressBar: """Class for generating a tkinter-based progress bar shown in an external window. PARAMETERS ---------- n_steps : int - The total number of steps in the pr...
8555bd1b4acee8b6289c1ed71ad96452ba3111c101ed0060022fcc89a8aa14f4
Python
4,609
115
import functools from .models import resnet as rn from .models import resnext as rx from .models import senet as sn from .models import densenet as dn from .models import vgg16 as vgg16 from .models import vgg19 as vgg19 from .models import inception_resnet_v2 as irv2 from .models import inception_v3 as iv3 from .mode...
da86e4c57dc63767759c388f91cd4635ee0527a49faba14620c9d936393595d9
Python
4,609
122
# Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux # 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 b...
6a0db5aaf65e3902a04cc0138aba8235e63de185d23d72b256e1bd5e01f93fc7
Python
4,611
115
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port from elasticai.creator.vhdl.code_generation.addressable import calculate...
dc6b790f999d7225e430304c69c94bdc3b1e03cf723f2590f713406b1d73ccb5
Python
4,611
131
import os from argparse import ArgumentParser import yaml from pytorch_lightning import Trainer from ray import tune from ray.tune import CLIReporter from ray.tune import Stopper from ray.tune.integration.pytorch_lightning import TuneReportCheckpointCallback from ray.tune.schedulers import ASHAScheduler from ray.tun...
7410e427bfc9e1119da0d4e5dff0eca7dbed6c52f897bcafe6778cf024757790
Python
4,614
127
import torch import torchvision.transforms as transforms import numpy as np import cv2 from utils.ddfa import ToTensor, Normalize from model_building import SynergyNet from utils.inference import crop_img, predict_denseVert import argparse import torch.backends.cudnn as cudnn cudnn.benchmark = True import os import os....
b031428c98beb5dfbad07f21ad16d97bc55c041c2ed0e9b6d52ac9149da1a9f3
Python
4,614
108
import argparse import copy import os import shutil import os import sys args = argparse.Namespace( inputlen = 2114, outputlen = 1000, ibam="chrombpnet_tutorial/data/downloads/merged.bam", data_type="ATAC", genome="chrombpnet_tutorial/data/downloads/hg38.fa", peaks = "chrombpnet_tutorial/data/p...
ce8b34476c0405ee3f3997afd6cf0c3c368cad11d63e2b1a951f8f4d37c5107e
Python
4,614
138
# Node-group asset "Transform Accumulate" (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_C...
14a5ea6bcb2fe546405b5c8f78303932ed55c960b5dcbb85c9840f50f155a313
Python
4,615
66
"""SHIU_LATERAL_EXCITATION.py 2026-09-24. Pre-registration: 04-NOTES/PREREG-2026-09-24d-SHIU-LATERAL-EXCITATION.md (+ Addendum 1: v783 >= 5-synapse network). Output 06-OUTPUT/shiu_lateral_excitation.txt, shiu_lateral_excitation.csv""" import sys, os, re, time sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)...
330e8b260daef9c29fee9396d9f1027630dc0481df8df5a697f011617d1a6a82
Python
4,615
157
"""Tests for cog.types module.""" import io from dataclasses import is_dataclass from cog import ( AsyncConcatenateIterator, ConcatenateIterator, File, Path, Secret, URLFile, streaming, ) class TestSecret: """Tests for Secret type.""" def test_secret_creation(self) -> None: ...