sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cae19fbc4e2ed662aa6280ee991be80ba563a01ff60df249a13e3576249c57fb
Python
15,565
425
from __future__ import annotations from dataclasses import InitVar, dataclass, field import numpy as np from lifelines import KaplanMeierFitter from SurvivalEVAL.nonparametric_estimator.util import ( infer_survival_probabilities, ) def create_support_intervals(tau: np.ndarray, exact_times: np.ndarray) -> np.nd...
b27bc743656df53bf0de890ea34c88a9a844de91f08bd14d8882d2910306b13e
Python
15,566
342
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 h5 import matplotlib # matplotlib.use('TkAgg') import matplotlib.pyplot as plt # from torchsummary import summary from auto...
f59a0e596b9c15fade7122bc336d0260ee1a26f2979c3a72d5d7711fc63ea118
Python
15,566
378
# multio - a multi input/output multi file multi channel multi format module import os from multiprocessing import Process try: import tkFileDialog except: pass import numpy as np import pyclamp.gui.lbwgui as lbw from pyclamp.dsp.abf import ABF from pyclamp.dsp.tdf import TDF from pyclamp.dsp.ses import SES from p...
75e7f9f62897ba40026bba7223160e8d4f2d800bc7a73fb965c98d1625c16f85
Python
15,569
400
# -*- coding: utf-8 -*- """ Created on Sat Dec 10 10:20:49 2022 @author: Dustin Garner """ import os import collections import itertools from enum import Enum import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import bokeh import holoviews as hv import hvplot.pandas import b...
83e6b47cde532351a13c5ab99014d8f4ecbe1a46a95171eb3dbc2e20fa155321
Python
15,574
283
import random import copy import numpy as np import string import matplotlib.pyplot as plt import bz2 import _pickle as cPickle import os random.seed(1) def wordlist_to_orth(wordlist): # takes in list of K words, outputs a 104 x K "spelling" array alphabet = string.ascii_lowercase word...
723c601896996b5c7c8a97a66e5589c894741c102bd1359a295eeaa1c64a79b6
Python
15,577
475
# -------------------------------------------------------- # Based on BEiT, timm, DINO and DeiT code bases # https://github.com/microsoft/unilm/tree/master/beit # https://github.com/rwightman/pytorch-image-models/tree/master/timm # https://github.com/facebookresearch/deit # https://github.com/facebookresearch/dino # --...
b31d5672f5e0c61b3c7f9ba51b80edc1ceb4e6d38e61ec306acfd4ea4af4c94a
Python
15,585
418
# -*- coding: utf-8 -*- import tensorflow as tf from pinn.layers import ( CellListNL, CutoffFunc, PolynomialBasis, GaussianBasis, AtomicOnehot, ANNOutput, ) class FFLayer(tf.keras.layers.Layer): R"""`FFLayer` is a shortcut to create a multi-layer perceptron (MLP) or a feed-forward net...
e0088751d0b1902892634f9f48e6e3c384a30b35c467230b063e4e76ff9c6bf2
Python
15,585
378
"""The built-in functions to validate known attributes. Template for the functions: All attribute validation functions should follow this signature: ``attribute_checker_template(hed_schema, tag_entry, attribute_name)`` Parameters: - ``hed_schema (HedSchema)``: The schema to use for validation. - ``tag_entry (H...
031779597c5206b8c088e35baef01d7dea933c499b92a6cdf07648290f86983b
Python
15,590
397
# Copyright (c) OpenBII # Copyright (c) Lynxi Technologies Co., Ltd. All rights reserved. # Copyright (c) OpenMMLab. All rights reserved. import argparse import os,time import warnings import mmcv import numpy as np import torch from mmcv import DictAction from mmcv.parallel import MMDataParallel, MMDistributedDataPa...
d2d5b32266004382ac5b29c9f8c589f5d26501d0a0e3f5f71fe42aaa64b18a5d
Python
15,591
325
#!/usr/bin/env python # Copyright (c) 2018-2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Follow leading vehicle scenario: The scenario realizes a common driving behavior, in which the user-controlled ego vehicle follo...
efd0c79eb2a2bd31160af3c774997586dfb958512d14c6015923e0add87ffdaa
Python
15,591
449
import os import collections from keras_applications import imagenet_utils from classification_models import get_submodules_from_kwargs from ._common_blocks import GroupConv2D, ChannelSE from ..weights import load_model_weights backend = None layers = None models = None keras_utils = None ModelParams = collections....
b3e88349eee6805e67d7c177466609ee157e070f232aba555f2dbd491577c87e
Python
15,597
462
''' ### 코드 로직 1. .npz 파일에서 geometry, gradient 값 read 1. iter = 1 이라면 geometry 생성 2. geometry, gradient 값을 array 저장 3. geometry 값에 gradient * n 만큼 + 4. f0, djdu = opt() 5. f0 값 저장 1. fom.txt 파일 읽어와서 맨 마지막 줄에 값 저장 6. 업데이트 된 geometry, 업데이트 된 구조의 adjoint gradient를 .npz로 저장 → 모델에 넣고 값 출력해서 1번부터 반복 ''' """ 0...
4f6954fb977c44da6e4630343eae23c284c0798a28ec95c21da818dfb3119aec
Python
15,599
357
"""Save / load / autosave behaviours for the viewer, packaged as a mixin so the persistence surface lives in its own file. The consuming class declares these attributes in ``__init__`` before any mixin method runs: * ``annotation``, ``brain``, ``current_slice``, ``n_slices`` * ``slice_states``, ``_history``, `...
1d83b74d71e6e642c64ac21d7fdcad54b602cd4a5d2d032de0977634deddbb34
Python
15,601
400
"""distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library...
9baaa30500c9fb734c779d728a1c8a73eea334c455fe47c344627abeab1bf262
Python
15,610
360
"""Tests for query_util module, particularly SearchResult class. SearchResult represents a query match result consisting of: - group: The containing HedGroup where matches were found - children: The specific matched elements (tags/groups) within that group (NOT all children - only the ones that satisfied ...
a53dfcc9f507af466097228f058578f4016d8b89636f0a8ea57bfd09d3f42d8d
Python
15,615
692
from __future__ import annotations from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.lines import Line2D from mpl_toolkits.axes_grid1 import make_axes_locatable # ====================================================================== # INTERNAL STYLE HEL...
fb00cbfcc32af6f2ee0db9c92faf81291f198728f061c234937eb06c212c0fca
Python
15,625
390
import numpy as np from ..constants import hartree2ev from ..utils.math import kgrid_with_tr, make_kkmap, kGsphere from ..utils.misc import set_range, mytqdm, VKBGData, atom_number2name from ..utils.mpi import is_master from ..io.aodata import AOData, calc_FT_kg_orb_spcs from ..io.bgwio import bgw_vsc, bgw_vkb from .....
e6c743ceb9276ac103460177a3d10849d98891e050ae81dcdf5078e45edcc079
Python
15,630
317
import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim from RNNs import recurrent_networks import sys, os #################################################################################### #Used to initialize weights for policy and value output layers def normalized_columns_initializer(std...
3d523c203e144a3ab3273e97323eb4237d37661630550b9561b63ea3c978c91f
Python
15,632
503
#!/usr/bin/env python3 """ MPRAGEise_yan.py Compatibility version of MPRAGEise for environments where only AFNI's `3dUnifize` is available. This variant adds safer defaults for United Imaging 5T eT1W/UNI data by: 1. Optionally applying the vendor-recommended UNI rescaling internally (equivalent to: fslmaths UNI -a...
35e40b6438c243fffa8d8b5369023ecf834098628071b9d5a22359c446a5e46f
Python
15,638
465
"""Tests for HDL generator abstraction layer. This module tests the unified interface for VHDL and Verilog code generation, ensuring that both implementations work correctly and produce valid HDL code. """ import pytest from elasticai.creator.hdl_generator import HDLLanguage, create_generator from elasticai.creator....
6251176d68420c1e3d6bbebb84b9675f787b16b2debbbef5a7ebce96645a5782
Python
15,644
445
# 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...
6c53a9346d172fbd73e7d5208e89a4b8302aa07a98b783b2b17fde84e1e80fcf
Python
15,653
540
#@File (label = "Image to analyze") filename #@float (label = "Minimum branch length") minBranchLength #@float (label = "Maximum branch width") maxBranchWidth #@boolean (label = "Define a region of interest") setRoi #@boolean (label = "Manually update soma mask") updateSomaMask #@boolean (label = "Use ...
8d908e84764239c8ebec20dac631ec1ebc3181b31f83b7b4b7f3cced90f8638f
Python
15,654
446
import pickle import numpy as np import argparse import math def area2d_voc(b): """Compute the areas for a set of 2D boxes""" return (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1]) def overlap2d_voc(b1, b2): """Compute the overlaps between a set of boxes b1 and one box b2""" xmin = np.maximum(b1[:, 0], b2[:...
f9caa43b0d312bb4f9abd92c82ed3219e2899657aa3e5c51b6e2e8857f4bc0b9
Python
15,656
357
import pandas as pd import numpy as np from scipy.stats import kstwobign, pearsonr from numpy import random import statsmodels.api as sm import matplotlib import matplotlib.pyplot as plt import pingouin as pg from scipy.stats import f import sys from IPython.display import display, HTML #"""""""""""""""""""""""""""""...
de401077db109cab89faf63d152095c8b5a2004a1a10e9e7d28598f6531d7075
Python
15,659
441
import math import numpy as np import torch atom_name_vocab = { "C": 0, "CA": 1, "CB": 2, "CD": 3, "CD1": 4, "CD2": 5, "CE": 6, "CE1": 7, "CE2": 8, "CE3": 9, "CG": 10, "CG1": 11, "CG2": 12, "CH2": 13, "CZ": 14, "CZ2": 15, "CZ3": 16, "N": 17, "ND1": 18, "ND2": 19, "NE": 20, "NE1": 21, "NE2": 22, "NH1": 23...
17beae7901e7cd00f6da669ca5ab85f999e34485eea2f05912a383f115108b00
Python
15,666
330
"""Qt side of the plugin system: event hub, panel context, parameter forms and the dock workspace. Panels are ComponentSpecs of category "ui_panel" (plugin_api.PluginRegistrar.panel). Their factory(context) runs on the GUI thread and returns a QWidget. Panels receive events through context.subscribe(); delivery is alw...
49fdba2db1938ed6876a0411ea54e300e20f573184230af5c031ac9b63727b85
Python
15,670
408
#!/usr/bin/env python #================================================================ # Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : morphology_pdist.py # Author : Yufeng Liu # Date : 2021-07-22 # Description : # #==============...
b8fef608d400931050e0f6f61d32aad35d54957a89c93e5b71beb0080d6619eb
Python
15,671
397
""" Script for reconstructing particles RELION compatible from full reconstructed tomograms Modification for re-reconstructing the synaptic particles Input: - STAR file with next columns: '_rlnMicrographName': tomogram that will be used for reconstruction '_rlnImageName': ...
2284a18c203040a263fcf452081e32e8d5cf3665f23ef1df87d8fe295fefa9eb
Python
15,674
398
"""A HED string with its schema and definitions.""" from __future__ import annotations import copy from hed.models.hed_group import HedGroup from hed.models.hed_tag import HedTag from hed.models.model_constants import DefTagNames, TopTagReturnType class HedString(HedGroup): """A HED string with its schema and ...
2758ac620ec18f4c819636df3f69b4de415972c57faeac50a41f7359863fa2ed
Python
15,674
446
#!/usr/bin/env python3 # ****************************************** # # 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...
53f91986b56fefb9f64388840a5d002dd88423ea56e4156469e121c884322da0
Python
15,685
442
# # 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,...
98c57494e1b9a438cf267204e69c2d89a321a3128c238b7081d9b35aeeac0ea7
Python
15,691
323
import os, argparse import random import numpy as np import torch from tqdm import tqdm import wandb from dataset import Edinb_SE_TestDataset #, collate_batch_coherence_net from model.coherence_net.model import CoherenceNet from model.coherence_net.loss import CoherenceNetLoss from utils.checkpoint_saver import Checkp...
966b2718d889f02e03fcf7fd3db334aa06d9bc3f64981f65a590505196b747f6
Python
15,699
487
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import logging import platform import sys import sysconfig from importlib.machinery import EXTENSION_SUFFIXES from typing import ( Dict...
da41bf23ad90ee6ccf7de3255b72eb36992c72d8805dabdfafe8be3e98691029
Python
15,700
491
#!/usr/bin/env python # coding: utf-8 # # LIT-PCBA # this dataset is a proposed "more difficult" test than DUD-E. I used a 75/25 (sklearn default) stratified split. The dataset is heavily imbalanced, like DUD-E. # # - UPDATE: I'm using the AVE split now # In[1]: import pickle from sklearn.metrics import roc_auc_s...
216ba9f0ff275b293f8efbeb9f0fb3898b099a373f1b6ae601e46e9a9f3dc630
Python
15,702
335
def update_param(name, param): if name == 'distribution': param['values'].remove('custom') return param return None # param untouched extensions = dict( validate_params=""" # if (!is.null(beta_constraints)) { # if (!inherits(beta_constraints, 'data.frame') && !is.H2OFrame(beta_constra...
98776b130d48eb9b550f2a21cfe7a9ebb0841ed0f806ab828a98da2ed247809b
Python
15,702
378
"""Unit tests for the tissue_masking tool. Covers: - compute_tissue_mask (synthetic blob, hole preservation, degenerate) - process_group (shared mask across channels) - background spec drop (the user-identified property) - discover_channels (folder discovery + grouping) - round-trip writes ...
6cce2bfff3b5e59ab21d31213fa360cff5163a051cad3cf1ef8583ad6dce7b78
Python
15,703
323
import numpy as np import pandas as pd import math import os import pickle as pkl import re import traceback from copy import deepcopy from src.utils import parse_config, logger, contain_substr def preprocess_appear(appear_csv): appear_df = pd.read_csv(appear_csv, index_col='frame') for c in appear_df.columns...
2954a6473cffbea582bb21138cc24197512a41cca3fb0d7aaa782f1171d54ede
Python
15,705
318
import os import unittest from hed import schema # from hed import from hed.errors import ErrorContext, ErrorSeverity from hed.models import HedString, Sidecar, SpreadsheetInput, TabularInput from hed.validator import HedValidator # todo: redo all this so we class Test(unittest.TestCase): @classmethod def s...
a0697838d09f3c6e55b0a59fa72bad2043a096e42552744461ef4c89dc6eedb6
Python
15,705
306
import numpy as np import os from shutil import copy,rmtree import pickle from webbrowser import open_new import tkinter as tk from tkinter import filedialog,messagebox from PIL import Image,ImageTk import run,excel,settings # pupillometry code class App(tk.Tk): # main window def __init__(self): # set ...
cdc1e2936d81561964643655c894b2424634864b85b331f683d3bcd6509d7faf
Python
15,705
493
import sys import os import warnings CWDIR = os.getcwd() GENDIR = CWDIR + '/../gen/' sys.path.append(GENDIR) import numpy as np import scipy.stats as stats from pyclamp.dsp.wffunc import * from pyclamp.dsp.wfprot import * from pyclamp.dsp.fpfunc import * from pyclamp.dsp.fpanal import * if SHOWFITS: import matplotlib....
23231c34b2f04df63c4e25d284cc1cf46d31aae018f7e4dbdb0aa94bc22185bf
Python
15,710
480
# 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...
b5ad2d693eea2bcbbf7eb152cb878a3b625b4a24c36a56615c5f5037cf573efe
Python
15,710
397
""" m6A_calling.py Author: Anupama Jha <anupamaj@uw.edu> Training and data generator code adapted from bpnet-lite (https://github.com/jmschrei/bpnet-lite) This module contains a reference implementation of a CNN model for m6A calling. GS hackathon participants: you can start with this code to develop your own models f...
2861566894015e39bab4443448bab64df97e102b343c83e807b2e17b6799f3b7
Python
15,711
345
#!/usr/bin/env python # ============================================================================= # GLOBAL IMPORTS # ============================================================================= import os import numpy as np import pandas as pd from logP_analysis import mae, rmse, barplot_with_CI_errorbars from log...
5567e05fd6d8cd2f7ad8ead23aac5e5446e7ab0252ecb6ebf02f9c8858a4251e
Python
15,713
456
"""Widget with general information about the dataset.""" from datetime import timedelta from functools import partial from logging import getLogger from os.path import basename, dirname, splitext from PyQt5.QtCore import QSettings, Qt from PyQt5.QtGui import QIcon, QKeySequence from PyQt5.QtWidgets import (QAbstractIt...
fec7615d3c90c9bb2665be400ad3649566504a87accbcab5bbb81996177a18a3
Python
15,717
384
# 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...
2167956312ad20d8dd98e654e7c89df567748cb2437251e5d3bead72e55f4d3b
Python
15,737
416
#!/usr/bin/env python import gzip import io import os from collections import defaultdict import requests from pysam import AlignmentFile, idxstats, index from irescue.misc import getlen, run_shell_cmd, testGz, unGzip, writerr def checkIndex(bamFile, verbose): """Check if BAM file is indexed. If not, attempt t...
3d22fb9e11bd59593f0091a14ddfdcd622e98a6bf7c3134f910949b0926f9fea
Python
15,746
444
#!/usr/bin/env python #================================================================ # Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : morphology.py # Author : Yufeng Liu # Date : 2021-07-16 # Description : The script is responsibl...
4b8ac9112dc9e50fa5a349131833a0b955df5618fddcf446bbe9f2f81a4ab933
Python
15,749
443
# # 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,...
5ef06a5364b4906f637b74f8b1deda1301014362962e18f07800fcbf1797e5d0
Python
15,749
418
from __future__ import annotations import warnings from dataclasses import InitVar, dataclass, field from typing import Literal import numpy as np from scipy.integrate import trapezoid from SurvivalEVAL.nonparametric_estimator.util import ( _compute_event_counts, _predict_step, infer_survival_probabiliti...
89bd8784ed6aae355c8dc604cecfa46dffda2dfd420228b8fa32907a51fbddd6
Python
15,751
403
# 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...
48559c8c54c2d5e2acd41db740fb9c1bcf6fbd4a273400d7f470a3485b901f25
Python
15,759
382
"""Pipeline-side analysis figures for the registration report (matplotlib, Agg, colorblind-safe). Every generator is best-effort and NEVER raises: on any error it returns [] / writes nothing, so a plotting failure can never fail a registration run. The report embeds whatever PNGs land.""" import os def _agg()...
943d0998b4a38de6321323c149a743eb740635584bd1e152db4dfad3c48b0550
Python
15,759
442
import numpy as np import pandas as pd import rdkit import rdkit.Chem as Chem import networkx as nx import torch import os from tqdm import tqdm from torch_geometric.loader import DataLoader from build_vocab import WordVocab from utils import * from dataset import DTADataset from sklearn.model_selection import KFold ...
0aa554f0fb4310d280f49a6c101e3b8110f9bea00ddc18ede61606bea67c2309
Python
15,762
410
"""Axis alignment utilities for brain volume orientation. Provides functions for detecting the longitudinal fissure, fitting rotation/flip transforms via SVD, and aligning brain volumes to the Allen CCF orientation. """ import math import os import numpy as np import cv2 from scipy.spatial.transform import...
7ea6678a1868352ab2356d51d918c57f9fe79858be4bb4ddd233a2fc7d8242f6
Python
15,762
400
''' Edited utils file with helper functions for diffdock docking. ''' import os import torch from Bio.PDB import PDBParser from esm import FastaBatchedDataset, pretrained from rdkit import Chem # Extra import from rdkit.Geometry import Point3D # Extra import from rdkit.Chem import AddHs, MolFromSmiles from torch_geome...
b6bbdfe9fdca70bb65993674b5e47a11365440ae6aabd66c6f70aebf57614adf
Python
15,764
392
import numpy as np import torch from torch import nn from typing import Any, Optional, Union from lightning.pytorch import LightningModule from torchinfo import summary from .components import \ activation_from_str, \ GUNet, \ get_unet_input_size, \ TemporalDenoiser from .denoising_model import Deno...
b9b0ef204f96d4311150d1e583a6fb146022499148c5532417057dbaddb3a991
Python
15,764
495
import torch from torch import nn import numpy as np from collections import OrderedDict import math import ConditionalNeuralField.cnf.initialization as init ######################## # define all activation functions that are not in pytorch library. ######################## class Swish(nn.Module): def __init__(self...
3fe04ace8b1dd28d8d69051f2205d839ec355e6305301a3ebb4c27b825beac69
Python
15,766
371
""" Generates a ListTomoParticle object from a input STAR file Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import numpy as np import scipy as sp import ...
5f10662a6917710d9999df1eb12945413843a154f9fc5293b8497b66de2b3fcf
Python
15,770
381
#!/usr/bin/env python # Copyright (c) 2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides the key configuration parameters for a scenario based on OpenSCENARIO """ import logging import os import xml.et...
d7f708cc273bb84de8e5c25ae8ae0aad986bf50dd05a5db73e0e5fa04d9e04dd
Python
15,772
364
""" 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 Loader structure adapted from DeeperCut by Eldar Insafutdi...
368fe643c96fc9b44a2dd3241c79dd508ff36a812ea6148a1f910913b62b35fe
Python
15,774
436
#%% import tensorly as tl import numpy as np import warnings from scipy.optimize import brentq from collections.abc import Iterable from tensorly.tenalg import svd_interface, multi_mode_dot from tensorly import unfold from tensorly.tenalg.proximal import hals_nnls from tensorly.tucker_tensor import tucker_to_tensor, Tu...
8691d909ffd17bca3e169e949a24e9da04c1ffe7404f3d5b241723d81279638b
Python
15,779
418
''' Description: Utility functions for extrapolating multiple timepoints. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import numpy as np import scanpy import pandas as pd import natsort import torch import torch.distributions as dist from optim.evaluation import _ot # -------------------------------- de...
e05f57c0647731083126fe4df071911da5e13af090f19ea0ceb1855418f23e73
Python
15,780
397
import math, torch from torch.nn.parameter import Parameter import torch.nn.functional as F from torch.nn.modules.module import Module import torch.nn as nn from opt import * opt = OptInit().initialize() device = opt.device class general_GCN_layer(Module): def __init__(self): super(general_GCN...
f90d666db2b98ce57ffa8d51472fc1e3f08691e3dc2c7a7c54532851da0265bb
Python
15,781
422
# 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...
9baf81cc953b91a8d4741b307492144907de7a61ccd3d164d901a1a0ad2f4194
Python
15,783
348
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """md_to_pdf.py —— 把 game/docs/TECH-NOTE.md 渲染为学术风格 PDF(stdlib + reportlab)。 用法:python game/tools/md_to_pdf.py game/docs/TECH-NOTE.md game/docs/TECH-NOTE.pdf 支持的 Markdown 子集(按该文件实际用到的语法): #/##/### 标题、段落、管道表格(含对齐行)、``` 代码围栏、**粗体**、*斜体*、 ~~删除线~~、行内 `code`、- 无序列表、1. 有序列...
c5a43a290004510fafc79d414a6cd0746059c79ef439d6d5a2b4700c814fd760
Python
15,786
352
# -*- coding: utf-8 -*- """ Created on Fri Dec 18 20:13:02 2020 @author: asohr """ # -*- coding: utf-8 -*- # # # TheVirtualBrain-Scientific Package. This package holds all simulators, and # analysers necessary to run brain-simulations. You can use it stand alone or # in conjunction with TheVirtualBrain-Framework Pac...
5965111313b6e26f5096082efe5d1b894261bec00bbc4762c898bd3d8bc48777
Python
15,787
415
from __future__ import print_function import sys import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import random import os import sys import argparse import numpy as np from InceptionResNetV2 import * from sklearn.mixture import GaussianM...
082f3a4623c2f1a0589b90cf473178c42b0815c68bc67b6201d30d1a91467176
Python
15,788
320
import os import re from typing import Any, Callable, Dict, Tuple, Union import scipy.io as scio from torcheeg.io import EEGSignalIO, MetaInfoIO from ...constants.emotion_recognition.seed_iv import ( SEED_IV_ADJACENCY_MATRIX, SEED_IV_CHANNEL_LOCATION_DICT) from ..base_dataset import BaseDataset class SEEDIVDat...
0bdc2fbc38d2a507a252aa3280bb1631c0c560ca752b83d376c798e8ced0e3e4
Python
15,791
315
r"""Functional interface""" import warnings import math import torch from torch import _VF from torch._jit_internal import Optional, Tuple from torch.overrides import has_torch_function, handle_torch_function from torch.nn.functional import pad, linear, softmax, dropout Tensor = torch.Tensor def mult...
1e3a1cc6c777eb3827322ebf9c9505743acab37270be1c6c8a4e95e7f302b121
Python
15,801
371
""" Generates a ListTomoParticle object from a input STAR file Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import numpy as np import scipy as sp import ...
73f764644b309bd3d1ee796694f41ea73a37aeb4ed37c4a6c0e9fa20ae4b928b
Python
15,801
379
#!/usr/bin/python # -*- coding:utf-8 -*- # -*-mode:python ; tab-width:4 -*- ex:set tabstop=4 shiftwidth=4 expandtab: -*- # from ctypes import * import sys import os if sys.platform == 'linux2' or sys.platform == 'linux': if os.path.exists('/usr/lib/libdximageproc.so') : filepath = '/usr/lib/li...
15785146d3b1338eb842cf76723937a02e1e43ae8105f2f40bada98568333359
Python
15,802
414
import os import csv import numpy as np import scipy.io as sio import torch.nn.functional as F from sklearn.linear_model import RidgeClassifier from sklearn.feature_selection import RFE from nilearn import connectome from scipy.spatial import distance import SimpleITK as sitk # Reading and computing the i...
be801d3efe7bc0a8d8052741bb5b97252e23c2ddfc42350c79132a61b71c19e3
Python
15,803
338
# 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...
d69884636f12d9519ef9cfd511c27fa3089aea7fdf6db18343c8f12ab1b526e0
Python
15,803
338
import xlrd # version 1.2.0 import numpy as np import networkx as nx import numpy.random as nr import matplotlib.pyplot as plt import seaborn import matplotlib.patches as ptc import json import os import struct import math from eworm.network.detailed_circuit import DetailedCircuit from eworm.network.point_circuit impo...
2a57e2946e94e1a5beb99b48faf63c21cdba31548f1646ed8a28126597e0156d
Python
15,804
355
"""Shared mixin for GUI tabs that launch work in an external terminal. Usage ----- Inherit from ``_TerminalJobMixin`` alongside ``QWidget`` (or any other Qt widget base). The hosting class **must** provide: * ``_toggle_ui(enabled: bool)`` - disable/re-enable all interactive controls while a job is running....
ff0abcffe674d877a4ad2994e76a3ef2426f4891f9a1b5c108b2abe5f45aa7e2
Python
15,806
413
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 13 10:52:47 2023 @author: emma """ import ants import numpy as np import SimpleITK as sitk import os import random import pandas as pd import pickle random.seed(6) def load_image(fpath): # load image in both itk image type and ants image type ...
56c800764bf81e47db07ed6ca17e8d736d56e63bb5c9fb8ac4517fccbe3b9a39
Python
15,814
353
"""Baseclass for MEDIAWIKI/XML/JSON/TSV writers""" from hed.errors.exceptions import HedExceptions, HedFileError from hed.schema.hed_schema_constants import HedKey, HedSectionKey from hed.schema.schema_io import df_constants, df_util class Schema2Base: """Template base class for all HED schema serializers (media...
36239a9b49158c16a08e8bd1098de35373387bf4c3d0eb8e4a44fa14bb0628c6
Python
15,816
453
from pathlib import Path from typing import Annotated, List, Optional import pytest from cog import BaseModel, Opaque from cog import _adt as adt from cog._inspector import _create_predictor_info, create_predictor def test_inspector_uses_run_method_for_classes( tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) ...
7382b6dcceca847054b7f93a40baa6b5394028209503edef7bfafec289501fb6
Python
15,822
446
import gzip import io import os import tempfile import time from pathlib import Path from unittest.mock import Mock, patch import biotite.database.rcsb as rcsb import pytest import requests from biotite.structure.io import load_structure import molecularnodes as mn from molecularnodes.download import ( CACHE_DIR, ...
97c5c55661e8cf2fc3edfc1e19e7dbbecf495c537d1966f2414bb2f211c3d424
Python
15,824
247
# 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 * import pandas as pd import numpy as np import time import cv2 from control._def import * import control.utils as utils def multipoint_...
a84c11b8ddb1917e561e325bbd0fcd20284f4acb37313e399e8393b994b18a14
Python
15,826
248
# 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 * import pandas as pd import numpy as np import time import cv2 from control._def import * import control.utils as utils def multipoint_...
6adf98c0161fc4ffca3d2525ed9855a3fac473f345f8381e1fdc68db6bf1bb6e
Python
15,829
394
# -*- coding: utf-8 -*- # File : batchnorm.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import collections import contextlib import...
2d440f2f4c015d5a606bc8adcec0e1a0d4fb7f04d96f2cc97f601875db5aa06a
Python
15,834
362
""" Script for extracting an analyzing a SynGraphMCF from an oriented pairs of membranes (like a synapse) Input: - A STAR file with a list of (sub-)tomograms to process: + Density map tomogram + Segmentation tomogram - Graph input parameters Output: - A STAR file with th...
09d52148804bfc57e5427e7ac26c281b9f64d7c140c139114cd08b92042116ea
Python
15,843
291
##### MODEL AND DATA LOADING import time start = time.time() import torch import torch.utils.data import torchvision.transforms as transforms import torchvision.datasets as datasets from torch.autograd import Variable import numpy as np import matplotlib.pyplot as plt import cv2 from PIL import Image import re impor...
1d43d01badf45ac9d7aaef161bc741efa9b5b5e88cb7bf14fbaf0f29060d45c8
Python
15,846
496
from collections import namedtuple import numpy as np import string import random GROUND_NAME = 'grey' BLOCK_WIDTH = 2 BLOCK_HEIGHT = BLOCK_WIDTH GROUND_Y = 0. SUCTION_HEIGHT = 1. GRASP = -np.array([0, BLOCK_HEIGHT + SUCTION_HEIGHT/2]) # TODO: side grasps CARRY_Y = 2*BLOCK_WIDTH+SUCTION_HEIGHT APPROACH = -np.array([...
7a21d825fb5e27ccc625a898345271c68c2601740157ad9ab26da3177a74ef62
Python
15,846
307
import torch import torch.nn as nn from torch.utils.data import Dataset from typing import Callable, Optional, Union, List import numpy as np from tqdm import tqdm from mnp.utils.scripting import (train_model, choose_criterion_from_model, effective_epochs_to_epochs, get_subset_metadatas...
a5d65847d7789cf6714b578da73900930cacdecff4d57b70cfe4a72847da8703
Python
15,854
391
"""Symmetric-annotation variant + per-hemisphere counting. Covers the deterministic parts without the (already-installed) Allen data: * build_symmetric_annotation: ML-axis detection + provable mirror symmetry * registry / config-menu wiring of the allen_ccf_symmetric variant * the both-files install gate th...
149e78f5059ad7e54693ee42e6b1ff71d500bf684c466eff9230cd5fb2600708
Python
15,855
381
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
391bba8fc48f92600e3727de6f087ea6fab10ab8a6e63c46ff0baafb32829e40
Python
15,855
392
"""Acquisition Control Class.""" import copy import functools import logging import logging.config import time from collections.abc import Callable from datetime import datetime from pathlib import Path from typing import cast import matplotlib as mpl import numpy as np from pypulseq import Opts from console.interfa...
8edc45af315461e6f551514f2f19e8c23decdacb9e66966abbff8bd168f4818e
Python
15,855
517
import os import pandas as pd from tqdm import tqdm import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns from language import load_input_language from measures import production_similarity, generalization_score from learning_experiment import scenes from tqdm import tqdm from stats import c...
99231a7b9b816dab2e0bcb78a3ba2a79ebbcdb6ad6f8449230161a3168768216
Python
15,859
359
#!/usr/bin/env python # -*- encoding: utf-8 -*- from collections import OrderedDict as odict from copy import deepcopy from functools import partial import bindings as bi from custom import get_customizations_for, reformat_block str_type = str get_customizations_for = partial(get_customizations_for, 'R') def get_cu...
c483a560a7ad3b2a9df4de49f1c667a585250841d4add701bc303483f7a1e52c
Python
15,861
552
from collections.abc import Sequence from json import load from typing import Literal from warnings import catch_warnings, simplefilter import numpy as np import pandas as pd from MDAnalysis import Universe from MDAnalysis.analysis import distances from numpy.typing import NDArray from openmm import app, unit from sci...
9524d0905c88b4cfa9965aeb2a055c285f0c811972ce6bc6b5b0122098d6731a
Python
15,865
532
import torch import torch.nn as nn import torch.optim as optim import numpy as np import matplotlib import shutil import os import glob from scripts.convert_to_gpu import gpu from scripts.convert_to_gpu_and_tensor import gpu_t from scripts.convert_to_gpu_scalar import gpu_ts from scripts.convert_to_cpu import cpu impor...
8c9e1cd952fcb701e5f5a77954f65f75eef5d8f71802af239796a9669fa0b92e
Python
15,884
342
#!/usr/bin/env python import sys, os, subprocess, platform, argparse from argparse import RawTextHelpFormatter from glob import glob from utils import execute from os.path import expanduser, join class BuildPython: """ Base class to set paths to pybioshell compilation Use BuildPythonXY.py to complile PyBioShe...
43147a54f472286f868ddca767d4f9a1daa36fa507bd4befa4b91639b6fb7833
Python
15,885
369
import os import sys import json import h5py import pickle import tensorflow as tf import numpy as np import google.protobuf.json_format import util_signal import util def _bytes_feature(value): """ Returns a bytes_list from a string / byte. """ if isinstance(value, type(tf.constant(0))): val...
27075868c935cfc516ab3d5b573b186d2d906e7877ef36a105b6aeb5e905aaa1
Python
15,886
343
import argparse import schnetpack as spk import torch from torch.utils.data.sampler import RandomSampler from torch.optim import Adam import os import shutil from schnarc.schnarc import get_energy, get_gradient, get_dipoles, get_nacs, get_schnarc from schnarc.model import MultiEnergy,MultiDipole,MultiNac,CombinePropert...
c8bb4d13de4dc8d202953a6856c4672dd8610277a8de32f7d224b8225161d489
Python
15,901
518
import pickle import cv2 import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image import os, sys from tensorflow.keras.applications.vgg19 import preprocess_input from numpy.random import randint from random import randrange def load_dataset(filename): """ load image and l...
9116276cb05974a66d1df33885e7759d78d02cbf74d31e6f335f7613c7f8a6d7
Python
15,907
338
# Identify best unified model and save data from larger unified model search from os.path import join from get_paths import * import pickle import matplotlib.pyplot as plt import numpy as np from os.path import join import objective ## Load data # Load simulation results fname = "data_unified_model_sear...
346f9b6935a6a55e75a86c91540d4d6ad146fca6f8df072c68b0a7813a16f5df
Python
15,915
399
import torch import torch.nn as nn from elasticai.creator.nn.integer.addition import Addition from elasticai.creator.nn.integer.concatenate import Concatenate from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.hadamardproduct import HadamardProduct from...
84761281f0d820f2a2862b97f9aaf4fe94873c5b318c6beb50093a01210aaf64
Python
15,917
405
''' Description: Utility functions for benchmarking. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import numpy as np import scanpy import pandas as pd import natsort import torch import torch.distributions as dist from optim.evaluation import _ot # -------------------------------- # Load scRNA-seq dataset...
b287c34bb384ece02f1760ed3db43371160e4f6af24daee4aa0f67451c86df4e
Python
15,917
357
# 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...