sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
26ca0e620c1d7b9c874703f03fdb5db9cd83adf73f0c83935141067145e5a42a
Python
6,351
181
from __future__ import annotations from io import StringIO from pathlib import Path from typing import TYPE_CHECKING, cast from ase.io import read from ase.units import Hartree if TYPE_CHECKING: from typing import Any from ase.atoms import Atoms from quacc.types import MRCCEnergyInfo def read_geom_mr...
9dcd47a6da011d8e90619f652e8a178374a15f60abba0ef9808c88e445ae3ea1
Python
6,351
203
import anndata as ad import h5py import numpy as np import pytest import zarr from anndata._core.sparse_dataset import sparse_dataset from anndata.tests.helpers import ( array_bool_subset, array_int_subset, assert_equal, slice_int_subset, subset_func, ) from scipy import sparse subset_func2 = subse...
34a76038a8a7c9e858b75becef124f0baba5d94ee9d7d468b0a80507fc96f4bb
Python
6,352
145
#----Figure_03_G,H_preparation-------------------------------------------------- #------------------------------------------------------------------------------- # This is the code which has to be run in preparation for Figure 03 Panel G and H # for the connectivity analysis for Reinhard and Fukuda et al. 2024 # ru...
5d42200581e1b15397f2b5aed47752d4894d81ee9754733da97c811f8051869d
Python
6,353
194
from __future__ import print_function, division import numpy as np class ScaledGaussianMixture: def __init__(self, ncomponents=2, scale_prior=0.5, tol=1e-6): self.ncomponents = ncomponents self.weights = np.ones(ncomponents)/ncomponents self.means = np.zeros(ncomponents) self.vari...
7c3d35408fc3fbd276127e6eb3001fca3e198eadda394ae121c4bc2cf1901068
Python
6,353
154
# Loops calling adapted from: # https://github.com/XiaoTaoWang/HiCPeaks import lightning.pytorch as pl from hicdiffusion_model import HiCDiffusion import matplotlib.pyplot as plt import matplotlib import lightning.pytorch as pl from hicdiffusion_model import HiCDiffusion import datasets import numpy as np import math ...
825e05b378ffc1bc5814bb748c222258aab46af872f12a0f318471a2a0da14f9
Python
6,356
149
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : predict_types.py # Author : Yufeng Liu # Date : 2023-02-05 # Description : # #=================...
c72676dac34f86ed9b44eef68f37cd004954d5a0fe2a057d8c74323e6f99f63c
Python
6,357
180
import tensorflow as tf from tensorflow import keras import tensorflow.keras.backend as K from tensorflow.keras.models import Model import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import numpy as np import pandas as pd import kl_tools from adv_model import train_adv from loss import adv_loss from utils import oneho...
128ffab403cb674d23d20263f477df371bcd8d414720bffdfb24f70d506dbb0d
Python
6,358
176
"""Common modules for FastGlioma training, evaluation, and inference. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ import os import math import logging import argparse from shutil import copy2 from datetime import datetime fro...
2e99dd16200e39f02e03346b8f0b2f6aef22938ff8b8e4e56416b8093276234f
Python
6,358
218
# -*- coding: utf-8 -*- import csv import logging import os from pathlib import Path from subprocess import check_output class DEFAULT(object): """ Default values of the package""" doc = "Documentation at https://unfmontreal.github.io/Dcm2Bids/" link_bids_validator = "https://github.com/bids-standard/...
abda71f88852eb2212559dc16d01974f56257f93e1e1dc90357930ab57cc9209
Python
6,358
219
# 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...
b42b6ab5b0570d45af4aca0e8c8b51ecb0560206211a7c2879f2adc90d4b4dc4
Python
6,358
195
import os import torch import torch.nn as nn import torch.nn.functional as F import matplotlib.pyplot as plt import pandas as pd from tqdm import tqdm import argparse import torch_geometric from SpiderUtils.dataset import SpiderDataset from SpiderUtils.models import Spider from SpiderUtils.Cosine_warm import CosineWar...
f804d8356137c4fa778878e174331efabaa9658d19f862beee563b891f58e7ed
Python
6,358
172
# Script to save smoothed population rates obtained during TVAT search from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() nhost = comm.Get_size() import sys sys.path.append("..") import h5py import numpy as np import pso_comp from SensitivityAnalysis import SensitivityAnalysis import time as cookie f...
8a7f52ae8dd89269bcfaa82f54c2a04e6ff5f2524fa1976c6e99e1a6f6dc2059
Python
6,359
204
import sys; import os sys.path.insert(0, os.path.abspath('../eyewire')) from shove import Shove import numpy as np from matplotlib import pyplot import pickle import mesh import scipy.stats dataset = Shove("lite://tmp/dataset_b","lite://:memory:") def histagram_average_displacements(): bins = np.linspace(0.0, 1.0...
a8420940ef17f74dcd768489e8816fc9391f4e3cb45d816b1fa6782a83e54ab0
Python
6,360
165
"""The input pane's edge letters, per input type. A section-shaped input gets CONSTANT L/R/S/I - the convention the run assumes after the user's orientation settings. The labels deliberately do not follow a flip: a label that moves with the image always agrees with it, so a mirrored section would never look wrong...
6cfe8ef625220421b50f97337d7568a90601d50ed294de9e57878a124ed0c658
Python
6,361
154
"""Public damage/tear detection for the Laplacian ``exterior_damage_aware`` mode. The silhouette comes from the project's current masker -- the seeded Multi-Otsu-4 GrabCut in :mod:`regtools.tissue_masking.core.grabcut` (``compute_entropy_grabcut``) -- NOT from the vendored engine's old canny/gaussian/``threshold_...
72e2db9ec6e48f0fe54e156971ac8921bc97ec299f5719258494fa497b9434ac
Python
6,361
139
import sys import os class Deconvolutions: def __init__(self, RNA_file = None, RNA_h5ad = None, RNA_h5Seurat = None, Spatial_file = None, Spatial_h5ad = None, Spatial_h5Seurat = None, celltype_key = None, celltype_file = None, python_path = None, output_path = None): """ @author: wen zhang ...
9ea4eaa6b4a9b6103ed0fa47337dfa642cd453de58732d904cf81e5e2cc179fa
Python
6,362
151
""" KNOWN_NT_MATCHED.py - written 2026-09-17, immediately after KNOWN_NT_VALIDATION.py. WHY THIS FILE EXISTS. KNOWN_NT_VALIDATION.py reported AUC 0.720 for class C (a transmitter on the menu plus one off it) against class A (single in-vocabulary), cell types as the unit. Then the composition was inspected and th...
6d82331d2f50a4b57224bdf9efaf78c72934cf2a1ef4a0f31c225b17dc47231d
Python
6,363
161
'''Preprocess nback scores. Reads all available logs from the nback task and computes the scores (median RT, number of correct, wrong, and missing answers) The input should be done in the following order: - folder path where the files are - savefile where the proprocessed data will be s...
85a6b1fbcd774873917373e4ae60af5f9c415ddbbf140362ad1368a15c2fe295
Python
6,363
132
from collections.abc import Sequence import torch from torch import nn from torch_scatter import scatter_add from torchdrug import core, layers from torchdrug.core import Registry as R @R.register("models.GearNet") class GeometryAwareRelationalGraphNeuralNetwork(nn.Module, core.Configurable): """ Geometry A...
ab4097c016ab03231c945977372def94a78c637845612b8492630f34f6e8a4f3
Python
6,363
177
import os import re from typing import List, Tuple from glob import glob import math import numpy as np import h5py as h5 from tqdm import tqdm import click from torch.utils.data import DataLoader import torch from cl_3d.datamodules.components.data import SectionDataset from cl_3d.models.contrastive_module import Co...
f3e8ccaa9e51d1fc71c96561c0d6f918f93a014806bfee4046bd20844551140b
Python
6,363
127
# 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...
9a37764320a6ebb86ee5d022ea1110c3abc7f7df257b80a95b4fdb1b6c2249dd
Python
6,365
160
# 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...
d3ce678a4ee29b347cc4436a4d7447f0ce024eb7e5495f211b5a709af1ddf1e9
Python
6,365
210
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
c8917e8dae99cc6137e1ec2755b315d3f915b2ebf56de0f58325fc91f0fea8cd
Python
6,367
232
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from sklearn.decomposition import PCA from tqdm.auto import tqdm import torch from umap import UMAP import pancancer_evaluation.config as cfg from csd_simulations import simula...
c83bcc841c8fd9eb2ca9fc3795418172b93b5c0799ea0372b79f00b0c87d83c0
Python
6,368
126
from typing import List import torch import torch.nn as nn from .mmd_like import _MMDLikeTrainer def guassian_kernel(x_source, x_target, mul_kernel=2.0, num_kernels=5, sigma=None): n_samples = int(x_source.shape[0]) + int(x_target.s...
1f2cf080b229023daebf545c4162cbeda3669eb31e6858706d18d9f884d40855
Python
6,369
200
""" Structured perceptron algorithm for learning CCG weights. """ from collections import Counter import logging import numpy as np from pyccg import chart from pyccg.util import softmax, NoParsesError L = logging.getLogger(__name__) def update_perceptron_batch(lexicon, data, learning_rate=0.1, parser=None): """...
abacbc1a8cd54ba34fb2d727b424e40f42813d0b307e07c28097eeb580c392d5
Python
6,369
183
# 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...
4960575357800b230ceecc6d18db11827c8db2af404117ce6adf1f1f39208636
Python
6,370
187
# Node-group asset "Color Rainbow" (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. import math from typing import T...
c87d3d8660ed971066b408ed82d45f18a844e5ee9aa763d6c97ea82f070389f3
Python
6,370
164
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors, Allegro.pl, Facebook Inc. and the HuggingFace Inc. team. # # 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://ww...
b95a287245ae0f2f7be2e5edfe297237acac57b175df7a835d4d9c2f2260629a
Python
6,371
165
# -*- coding: utf-8 -*- r"""This file implements the atomic charge dipole model. Atomic property predictions from the network are interpreted as atomic charges. A charge neutrality constraint is applied to enfore a charge of zero on the charge neutral entity by equivalently spreading the excess charge out over the at...
15350c847ef35eacd33cd35cdf06bb63cf98f25370dd92736627a5082bff4a63
Python
6,372
208
import torch import torch.nn as nn import numpy as np import math from torch import nn, Tensor class PositionalEncoder(nn.Module): def __init__(self, dropout=0.1, max_seq_len: int=5000, d_model: int=512, batch_first: bool=True): super().__init__() self.d_model = d_model self.dropo...
61a00592c214ab6b4dc23af77ec3e4afaa514d1ff9e3ffb0713ce0d7a184beb6
Python
6,372
135
# 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...
7c8aa7d02a667e57fe49258228ed1e0536c3c9354a57dbbabfa0e4b3cf59e6d5
Python
6,373
152
from typing import Any, Optional, Dict import numpy as np from models.kan_layers import FastKANConvLayer, KAN from models.model import Model import torch import torch.optim as optim import torch.nn as nn from torch.nn import init import torch.nn.functional as F class Luo3DCNN_KAN_Net(nn.Module): """ HSI-CNN...
c90092b21a6985a7fb48b1b7e382575d523e8f15e4f54cdc7af5ecfc57d62348
Python
6,373
160
from __future__ import print_function import argparse import os import numpy as np from skimage.morphology import skeletonize_3d from scipy import ndimage as ndi from lib.dvn.utils import get_itk_array, make_itk_image, write_itk_image, get_itk_image def parse_args(): parser = argparse.ArgumentParser(description='E...
1f0af98b7e94417a21ada764df4222d5003c78019eeead09089c62e1d66b1500
Python
6,374
147
"""End-to-end test for ccf_boundary_editor.apply_slice_edits. Exercises the full pipeline: SliceEditState -> get_backend -> fit_pull_field -> applyDeformationField The unit tests in test_ccf_boundary_contour_edit.py cover build_components and correspondences_from_state at a finer grain; this file confirms t...
2c9cb8fd378c12e771c2ab36e220dad1edaabd07c7e5e055d401326d926b6781
Python
6,374
223
#!/usr/bin/env python import os import sys import time import boto import boto.ec2 # Environment variables you MUST set (either here or by passing them in). # ----------------------------------------------------------------------- # os.environ['AWS_ACCESS_KEY_ID'] = '' os.environ['AWS_SECRET_ACCESS_KEY'] = '' os.env...
4c963cc594c3be2ff0f48a85c0705b50d9f647e43651036255b82333d608054c
Python
6,375
241
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np import analysis_params ####################################### ### PLOTTING ### ####################################### def add_gdf_to_dot_display(ax, gdf, color='0.', alpha=1.): plt.sca(ax) ...
aa1abee1dbe520df4c8899adf3f6e416bae446edaeda4dda9a94bca6790b1c08
Python
6,375
170
"""Utilities used in HED validation/loading using a HED schema.""" from hed.errors.error_reporter import ErrorHandler from hed.errors.error_types import SchemaWarnings from hed.schema import hed_schema_constants as constants from hed.schema.hed_schema_constants import character_types def validate_schema_tag(hed_entr...
7799e59b648a373b75e0ca6f2e4ce71f729384468e3aa17cc9a7d7dfbdb91903
Python
6,376
200
import torch import torch.nn as nn import torch.nn.functional as F import argparse import os #import wandb import tqdm import numpy as np import pandas as pd import data import util import net as networks from torch.utils.data import DataLoader """ Optimized Hyperparameter conv_out_dim=512 lstm_hidden_size=320 kern...
ee2d69c271255168a4b7b02df7477e9aa6284d2be4e7a69c655bf7d760b9c4ad
Python
6,376
152
"""Regression tests for the DRY-ed TissueCyte orientation. The orientation (clamp>=0, transpose spatial axes, flip both) used to be hand-rolled inline in four places: three TIFF read paths in ``regtools/utils/io/tiff_io.py`` (`_load_image_2d`, and twice in `_load_image_multipage`) plus the 2D registration loader'...
707251ffa2a7d57ea167a139a4d7d001a0761c64ec42151a5d8b56393d89c10e
Python
6,377
164
from typing import Any, List import torch from pytorch_lightning import LightningModule from torchmetrics import MinMetric, MeanMetric from torchmetrics.classification.accuracy import Accuracy from torchmetrics import MeanAbsoluteError, MeanSquaredError class MREBrainLitModule(LightningModule): """Example of Ligh...
a0871ffb7a58188dea724d504a7f34d09bac738a716fbfc7fd7ecfb21c26d94e
Python
6,377
192
import subprocess import tomllib from pathlib import Path import pytest import serial import torch from elasticai.usbprotocol import UserRemoteControl, get_env5_port from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.file_generation.on_disk_path import OnDiskPath fro...
a584a45968d8cf3f2406a07913d7918f86f557d7d753c2d533babbb9a16d90b0
Python
6,377
136
import os import sys import torch import pandas as pd import numpy as np import torch.nn.functional as F import scanpy as sc import anndata as ad from .TOSICA_model import scTrans_model as create_model #model_weight_path = "./weights20220429/model-5.pth" #mask_path = os.getcwd()+'/mask.npy' def todense(adata): i...
e4b635f422891d649dc97f031cd61e4d51542d8cc6abe928ae6a537a854006cf
Python
6,377
180
from collections.abc import Callable from typing import Any, cast from torch.fx import Node as FxNode from torch.fx import Tracer from torch.nn import Module import elasticai.creator.function_dispatch as FD import elasticai.creator.ir as ir from elasticai.creator.ir2torch import DataGraph as DataGraph from elasticai....
de2c89d582014a8fd1510d857b97d21b7e2d75ded85dd8bff555f708134a1cb1
Python
6,380
125
""" This script summarizes the significant results for global efficiency, participation coefficients, and selected links, organizing them and matching the results with the node coordinates for H1 """ import os import pandas as pd ############################################################################### # Change...
8d3e1776c5f352491221f4d3631d5c6127faa689ec9128fd4f36c8498ebf6cdd
Python
6,381
199
# 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...
ee4e2f2a58080713e3a0087c4c56d49b1653b6bc759254c8387defc822072644
Python
6,381
153
# 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...
103c5ff5571cf21431c89cd73d3d1c6f01463b04ae37759d7bc97aae9a646712
Python
6,382
226
from numpy.fft import fftfreq from scipy.fftpack import fft import unittest import numpy as np from matplotlib import cm import matplotlib.pyplot as plt from soundsig.signal import bandpass_filter,lowpass_filter,highpass_filter, mt_power_spectrum, power_spectrum,match_power_spectrum from soundsig.coherence import cr...
3842e150488dea4522ecf7654dea056a32107f58c77f8d17072c96646f57ce65
Python
6,382
149
from collections import namedtuple, deque from pddlstream.language.constants import is_plan from pddlstream.language.external import Result from pddlstream.language.stream import StreamResult from pddlstream.utils import INF, implies, neighbors_from_orders, topological_sort, get_connected_components import gc # TODO...
99208cfeb61325bd5f354ff81941f019d02a50c976011865e0b5c3a24e91e0cd
Python
6,382
125
""" This script summarizes the significant results for global efficiency, participation coefficients, and selected links, organizing them and matching the results with the node coordinates for H2 """ import os import pandas as pd ############################################################################### # Change...
441c72e00ae3caa246fa1d4fe96afab2653389b64e37265bd2a0ef401087074e
Python
6,385
223
# 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...
8a0a7409634b7fe2242724524f6fe7b5d869d7a2bbe0560729fbe54a6deb9d8b
Python
6,385
139
import sys import os class Deconvolutions: def __init__(self, RNA_file = None, RNA_h5ad = None, RNA_h5Seurat = None, Spatial_file = None, Spatial_h5ad = None, Spatial_h5Seurat = None, celltype_key = None, celltype_file = None, my_python_path = None, output_path = None): """ @author: wen zhang ...
aaaaf32566f0e58359ee053fdc5e1f5a28b63a9989aa6090ef212a7719dbb2b3
Python
6,386
178
"""GUI wiring for the tilt-slice launch button in the registration tab.""" import os import sys import time PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")...
4b3847474751d6438339397146d7c3ee48e64f797f6640a154289ef8312842ca
Python
6,389
151
""" toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation...
b386a76040a8e39911b035c3407b492f080d639b47a95a68a4683930abc5a3fa
Python
6,390
219
"""Computes the extraction efficiency of a cleaved stack using a 3D sim.""" import argparse from typing import Tuple import meep as mp import matplotlib.pyplot as plt import numpy as np RESOLUTION_UM = 25 WAVELENGTH_UM = 1.0 CLADDING_UM = 0.5 ACTIVE_UM = 0.3 SUBSTRATE_UM = 1.0 PML_UM = 0.5 AIR_UM = 1.0 SIDE_UM = 3....
5b43aeeab43cf372d546850c4c06917755ac8b47cd4be9b45ad7a3b274cc7a23
Python
6,391
167
"""Launcher for the CCF boundary editor. Builds the Qt application, embeds :class:`CCFContourViewer` in an ``AppScaffold`` window, optionally preloads volumes given on the command line, and starts the event loop. pyqtgraph is PyQt5-native, so napari's subprocess rule does not apply here. Usage ----- pyth...
680000c2dfb8b0e9c297fc85e0a7189daf6745dd95a060b7b0ea9bb7d53a5575
Python
6,391
171
import numpy as np import jax.numpy as jnp import scipy.signal.windows from itertools import product import jax.scipy as jsc from jax import jit from functools import partial from scipy.optimize import minimize import matplotlib.pyplot as plt @jit def conv(x, filter): """filter... Args: x ([type]): [...
8b3dbee2a5ac753344eab8c8667b607930c90655760740d90b94bd13c6b396f6
Python
6,391
160
import torch import torch.nn as nn import torch.nn.functional as F class GraphConvolution(nn.Module): def __init__(self, in_channels: int, out_channels: int, bias: bool=False): super(GraphConvolution, self).__init__() self.in_channels = in_channels self.out_channels = out_channels ...
befb0dea35c7900fb2e3875c3765582e5ae903a817b6bc402a9f15caab5b1147
Python
6,393
161
"""Aalen–Johansen estimation from aggregated multi-state transition counts.""" import numpy as np from numpy.typing import ArrayLike from SurvivalEVAL.nonparametric_estimator.util import _predict_step class AalenJohansenMultiState: """ Estimate transition matrices for states numbered 0 through n_states - 1....
198ebafb4350f685e8a7a4035a2398c2013ff40ca7c8be4ca3dcc35b04d3a418
Python
6,394
189
"""Radiation pattern of a dipole antenna above a ground plane. Tutorial reference: https://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/#antenna-above-a-perfect-electric-conductor-ground-plane """ import math import matplotlib.pyplot as plt import meep as mp import numpy as np RESOLUTI...
682218d866892fcda81d632ae1bfc067151d3d82d572bed8d87895d2578c9e4b
Python
6,394
119
import numpy as np import pandas as pd import os import matplotlib.pyplot as plt plt.switch_backend('agg') import seaborn as sns def save_logos(motif_dict, folder='.', input_file='maggie_output_mergedSignificant.tsv'): if not os.path.exists(folder+'/logos'): os.mkdir(folder+'/logos') read_df = p...
6ae9501c82b2e5e701669228a050d35fc55d10ff63fe5801394127561541d969
Python
6,395
103
import numpy as np from batchgenerators.utilities.file_and_folder_operations import * from nnunet.dataset_conversion.utils import generate_dataset_json from nnunet.paths import nnUNet_raw_data, preprocessing_output_dir from nnunet.utilities.file_conversions import convert_2d_image_to_nifti if __name__ == '__main...
3c9b98d132df29623c0fd302d54306652c6a9794bccdb46acfd477fcf49c686c
Python
6,396
221
""" version 1.0 author: Felix Plasser description: Procedures for reading and writing files. """ import os class dict_plus(dict): """ Extension of a dictionary where data can be read from an input file. """ def __init__(self, file_name='', revert=False): if not file_name == '': if ...
514cac807ac4c29137cdbaba3318c36dee3e03b959f8b5c6c62cc3172442688d
Python
6,396
125
from pddlstream.algorithms.downward import make_axiom from pddlstream.algorithms.disabled import get_free_objects from pddlstream.algorithms.reorder import get_partial_orders, get_stream_plan_components from pddlstream.algorithms.scheduling.utils import partition_external_plan from pddlstream.language.optimizer import ...
761845106406dd6a4f46150ad4b8f98ee14a57b2971499d428ef334cbd79aa3a
Python
6,396
160
import pandas as pd import numpy as np import seaborn as sns from matplotlib import pyplot as plt import matplotlib import os from one.api import ONE one = ONE(silent=True) one = ONE() ROOT = one.cache_dir.joinpath('wittenlab/Subjects/fip_').as_posix()# Set folder where data was downloaded def alf_loader(alfpath): ...
daf52362ba5f7d73fd84e70cc18278af4d268c65c5893b65c89c0468aff0548c
Python
6,398
133
# regtools/ccf_boundary_editor/canvas_lock_ui.py """Floating annotation-lock control overlaid on the editor canvas. Replaces the side-panel "Lock annotation" checkbox with a checkable lock button anchored top-right of the GraphicsLayoutWidget canvas (self._glw), plus read-only cues shown only when locked: an ambe...
1aeeab2d9b7a5cfd04a03689c4592575fcd6f0f2334c1e6b5e47b72f3dd33e8c
Python
6,399
168
from pathlib import Path import numpy as np import mne_bids import shutil import platform import os import requests from zipfile import ZipFile import hmp from hmp import io from hmp import simulations from hmp import utils from hmp.patterndata import PatternData from hmp.models import EventModel DATA_DIR = Path("...
a3262270a824cd9539e961f56c9fedf94a0780d0b6f8095228e09dec82b11500
Python
6,399
188
# 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...
8a324b61b806bd5d9bf8826f84557642cf4cdd1db5a68e05db1d8e4889dd2360
Python
6,400
166
# 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...
8a5650b788662db07fda0e82566697b0aa1b81a1e6ff7a53448f138d00c40975
Python
6,400
187
import math import torch import torch.nn as nn import torch.nn.functional as F def initialize_weights(m): if isinstance(m, nn.Conv1d): n = m.kernel_size[0] * m.out_channels m.weight.data.normal_(0, math.sqrt(2 / n)) if m.bias is not None: nn.init.constant_(m.bias.data, 0) ...
fa777717dd22ec6a572e37a12d51ea5411342a55b31af4143c44cb04d9f8a3a5
Python
6,400
162
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
4f40e0095b8161c957cb94cb709cc824b04bf5ab57fa5ca139756058f343cb16
Python
6,401
115
# ****************************************** # # 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 # the Free Software ...
5030ba2ce562fdbc7d94393ac243909e2d917299c086a92cc74817d4dfbd7674
Python
6,401
211
import numpy as np import matplotlib.pyplot as plt # ----- # # Variables. savepath = "/home/sotpapad/Codes/dreyer_2023/" savefigs = True # True, False classification_mode = "incremental" # "incremental", "sliding" if classification_mode == "incremental": clm_str = "_tr" elif classification_mode == "sliding":...
86d6628cbe80068a5013b6b2c64324714286d4bd9e8705324d573b7e49dd81f2
Python
6,401
194
# Node-group asset "Color Attribute Map" (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...
bfba09f05deb0b953b10fb21890ae7116a58371f66344bce93480ea0f97e87f4
Python
6,401
144
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # 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 r...
d2602fba4db31225042d59448a0bd9aad091d17dfdd273ae327e9cddf9c63605
Python
6,401
65
"""PREDICTION_CALIBRATION.py 2026-10-02. How good were my own predictions? Every probability written in a pre-registration from 24 Sept (the first with numeric predictions) to 2 Oct, against what happened (04-NOTES/PREDICTIONS.csv: one row per stated outcome; the options of one question are separate rows). Descriptive....
c244f14a734fd9cdd9ae0eb316fdbca2f85b390cc388ccee405f63798182fabf
Python
6,405
204
from brian2 import * from math import exp, floor, sqrt from matplotlib.pyplot import * from setup import izzy, pos_3D, STDP1, reg_synapse, write_video, vectormap, wave_propagation def Wave(seednum,batch, RATE): seed(seednum) vidName = str(batch) + '/' + str(batch) + str(seednum) + '.avi' fileName1...
475646619d2a15bd4925141fc9f9ab27269b9e58f0ff2526161bd852091a2c7b
Python
6,409
165
from __future__ import division from __future__ import print_function # coding: utf-8 # In[13]: #!/usr/bin/python from builtins import range from past.utils import old_div import os import re import glob import sys import argparse from subprocess import call def main(argv): parser = argparse.ArgumentParse...
38822678531da331a51a720103548801e7ff166844f1a6ced591a96dd041b370
Python
6,411
201
import os import shutil import gzip import pytest from click.testing import CliRunner from pandas import read_csv from scbs.cli import cli def scan_gzip_contents(path_gz): contents = [] with gzip.open(path_gz, "rt") as infile: for line in infile: contents.append(line.strip()) return ...
5ef6920ce027672d80ec52426f041cb6a25bb8182573b026347bf0763e3aa2f3
Python
6,412
178
import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp from scipy.sparse.linalg.eigen.arpack import eigsh import sys def parse_index_file(filename): """Parse index file.""" index = [] for line in open(filename): index.append(int(line.strip())) #strip() 方法用于移除字符串头尾指...
8ab927f915741dbb60f81cd4970ee0ea3ef0591ddd08cf5cd556ab938a6cc3d3
Python
6,414
200
# 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...
cd3510911bc5ce39c8880a083337712e30e74687994175b802a56c16f8f33556
Python
6,417
162
"""MNE epoch data format reading. This module provides functions for reading MNE epoched data format (.fif only) """ from copy import deepcopy from pathlib import Path from typing import Callable, Optional import numpy as np from mne import read_epochs, set_log_level from mne.channels import DigMontage from numpy.ty...
63d84f0945da00e5e1b34ac25cd3e65b3b4ec5a2429635694ed249052732ecb3
Python
6,418
180
""" Curates an output STAR file from Relion to work as input for pyseg.pyorg scripts for microtubules Input: - STAR file with the particles to curate - STAR file to pair tomograms used for reconstruction with the one segmented used to pick the particles Output: - A curated output STAR file ...
67d4803cb47601011464b5f93663efead68f5d3669ea6d3a3fcfa230875349f1
Python
6,418
144
import os import unittest from hed import schema from hed.errors import ErrorContext, ErrorHandler, error_reporter from hed.models.hed_string import HedString from hed.validator.hed_validator import HedValidator # todo: update these tests(TagValidator no longer exists) class TestHedBase(unittest.TestCase): schem...
b798e26b8cdc609449672e14fd5a27ef3325d378499a67287e3ea80cd4e78fb6
Python
6,419
189
import logging from optparse import Values from typing import Generator, Iterable, Iterator, List, NamedTuple, Optional from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.metadata imp...
06eb3e21cffce834f482afef448f500cbaa13db2c57840e54a568aaffd2b75c4
Python
6,420
126
""" Set of classes for dealing with a XML files for loading cellular objects (e.g. filaments) # Author: Antonio Martinez-Sanchez (University of Goettingen Medical Center) # Date: 1.02.20 """ __author__ = 'Antonio Martinez-Sanchez' import xml.etree.ElementTree as ET import numpy as np ###############################...
6580cc1976c8d4ebcdf4b1f26a1da806d3698d7bd28f2ffdc34ee3bb1249e180
Python
6,420
165
# -*- coding: utf-8 -*- """ Updated on 08.10.2024 @author: Pablo Maceira Elvira Logistic regression is used for binary classification. However, predictions can be interpreted as a probability, as the sigmoid (i.e., the logistic function) is bounded between 0 and 1. Ultimately, what I want is to be able to det...
05586b7152ae3f451c0d822e1e9ac84074654bcb4196f965556a64ecb5a0cc4c
Python
6,423
115
# 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...
cc7063316d53fa020178507ba3a58bfab17cad104b89c8b6debc5be90a0f1fe3
Python
6,425
140
rest_api_version = 99 supervised_learning = False def class_extensions(): def init_for_pipeline(self): """ Returns H2OSVD object which implements fit and transform method to be used in sklearn.Pipeline properly. All parameters defined in self.__params, should be input parameters in H2OSVD....
7911d680330e8ac3b2f1d8d1c4c97601f181df11cde7fcea0d8dd5002e77a17b
Python
6,428
141
import math import random from itertools import cycle, count import numpy as np from control_tools.execution import ArmTrajectory from plan_tools.common import Control, Conf, lookup_orientation, STIR_QUATS, get_urdf_from_base from plan_tools.samplers.generators import get_pairwise_arm_links, set_gripper_position, \ ...
88c1a97a5fbf069f797d5360b8b8ff57e93f32bc602a2886e0cf2f34f6d21164
Python
6,428
128
# 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...
ae1032cba9d28e19162eada2db964b51bf2013482b12ed0a2f33bd977f170af7
Python
6,429
165
""" Created on Wed May 11 02:05:35 2022 @author: Haotian Teng """ import os import time import toml import torch import itertools import numpy as np from matplotlib import pyplot as plt from xron.nrhmm.hmm import GaussianEmissions, RHMM from xron.nrhmm.hmm_input import Kmer2Transition, Kmer_Dataset from torchvision im...
4a1da6d969e362d836528db7497ae7ac5e9939d64920c1b9d07202b2b06a032d
Python
6,430
181
# pylint: disable=invalid-name, missing-function-docstring, missing-class-docstring, unused-argument, too-few-public-methods, no-member, too-many-arguments, line-too-long, too-many-instance-attributes """ BNT model module from https://github.com/Wayfear/BrainNetworkTransformer""" import numpy as np from torch import...
ac0def1cb031feee5c6079b04a0e64c61b32deafff667b4595dbe8f2377ee63a
Python
6,430
174
import torch import torch.nn as nn from elasticai.creator.nn.integer.addition.design import Addition as AdditionDesign from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.math_operations import MathOperations from elasticai.creator.nn.integer.quant_utils...
02af5d9fbfa12e36c5600aafd25ddaf5d6b77f4ee57522e9c819ec6b4fd1ba89
Python
6,431
371
from functools import partial import pytest import autograd.numpy as np import autograd.numpy.random as npr from autograd.test_util import check_grads npr.seed(1) ### fwd mode not yet implemented check_grads = partial(check_grads, modes=["rev"]) def test_fft(): def fun(x): return np.fft.fft(x) D ...
0fb11f2e7ad51e6b4046c939a2ad32c0f75c554588cc1e735b01c50fc12189fc
Python
6,431
141
import os import re from typing import Iterator, Dict, List, Tuple, Union import pandas as pd from sklearn import model_selection from torcheeg.datasets.module.base_dataset import BaseDataset from .base_model_selection import BaseModelSelection from .utils import create_subset, read_indices, write_indices class KFo...
49a7a965024986d4bcd613146da091f15db28beaddf944c2bc6580b1cc158b92
Python
6,431
161
import os import numpy as np import pytest pytest.importorskip("pyqtgraph.opengl") os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") @pytest.fixture(scope="module") def qapp(): from PySide6.QtWidgets import QApplication app = QApplication.instance() or QApplication([]) yield app de...
8a0917c2f8975349f3f7ab0a34a271918be9b0b118a669c4b696c09759fb2637
Python
6,431
132
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 23 18:43:14 2023 @author: daltonm """ import dill import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import itertools import os from scipy.stats import binomtest, ttest_rel marmscode = 'both' if marmscode...
aa91e3f55226594bbec2673dd9ceaca8dd5778ba0fd07d6ea2626fbee1732b53
Python
6,432
188
import torch import torch.nn as nn import torch.nn.functional as F from segmentation_models_pytorch.base import modules as md class PAB(nn.Module): def __init__(self, in_channels, out_channels, pab_channels=64): super(PAB, self).__init__() # Series of 1x1 conv to generate attention feature maps ...
10e7b2255705b0293b810a4bc9a762549232d52b96a5cc1780acdf9a51ace259
Python
6,438
203
"""Module to plot all the elements in 3d space. """ from numpy import (linspace, nanmax, mean, tile, array, abs, ) from vispy.color import get_colormap, ColorArray from vispy.geometry import MeshData from v...