sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
e40f3e1282a534b273756b12c3706fdc8ead9adec5f97e864aa9b9e167159119 | Python | 12,227 | 325 | # All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
from argparse import Namespace
from dataclasses import dataclass, f... |
be6e4e82e86fd3316f3e8814d691c671611240863b30f9b33f6fa849c5f0cab4 | Python | 12,228 | 353 | """
Utilities for working with the local dataset cache.
This file is adapted from the huggingface transformers library at
https://github.com/huggingface/transformers, which in turn is adapted from the AllenNLP
library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
Note - this file goes to eff... |
4935658b18cb45aad8d94a696bfa94177728da466bd7e17c76447d72f5eeaf52 | Python | 12,232 | 319 | """Configuration for Garfield"""
import os
import seaborn as sns
import matplotlib as mpl
class GarfieldConfig:
"""configuration class for Garfield"""
def __init__(self, workdir="./result_Garfield", n_jobs=1):
self.workdir = workdir
self.n_jobs = n_jobs
self.set_gf_params(... |
6bfe3bdd47198f755340f054c20d2c1039d4568246882b7ee39dfa1b9ea92c45 | Python | 12,239 | 365 | import glob
from dataclasses import dataclass
from typing import Callable, List, Optional, Type
import numpy as np
import open_clip
import torch
import torchvision
import xarray as xr
from pytorchvideo.transforms import ShortSideScale, UniformTemporalSubsample
from skimage import io
from torch.utils.data import Datase... |
4f9908aa39c8ed12b81238fffc4ef68f40f8a8e763dedd6e45b79fba160a8b4e | Python | 12,245 | 256 | import typing
import os
import logging
import argparse
import warnings
import inspect
try:
import apex # noqa: F401
APEX_FOUND = True
except ImportError:
APEX_FOUND = False
from .registry import registry
from . import training
from . import utils
CallbackList = typing.Sequence[typing.Callable]
OutputDi... |
8944aa7aa9a572dcbb4bad112372a96c965fae4c9b387672bc00cd04dcc79f38 | Python | 12,245 | 364 | #!/usr/bin/env python
# ENCODE DCC filter wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_lib_common import (
copy_f_to_dir, log, ls_l, mkdir_p, rm_f, run_shell_cmd, strip_ext,
strip_ext_bam)
from encode_lib_genomic import (
locate_picard, remove_chrs_from_ba... |
689384148980b519c8f274c470d6580bde4f8e11b5da9269a0ced608244900b4 | Python | 12,251 | 364 | from os.path import join
import numpy as np
import pandas as pd
from config_path import REACTOM_PATHWAY_PATH
from model.model_utils import get_coef_importance
def get_data(loader, use_data, dropAR):
x_train, x_test, y_train, y_test, info_train, info_test, columns = loader.get_data()
if use_data == 'All':
... |
1c7c3933e25917371c982d9746351e31e256b5bd0d090ad4dae5419acdfbf66a | Python | 12,252 | 269 | #!/usr/bin/env python3
"""A script to generate PISA scores.
PISA is described :doc:`here<pisa>`
BNF
---
.. highlight:: none
.. literalinclude:: ../../doc/bnf/interpretPisa.bnf
Parameter Notes
---------------
model-file
The name of the saved Keras model to interpret.
head-id
The head number that you'd li... |
06c8446e69bb2986644e23d946c952730a1357e8bdcb9f79975c95945e017bfc | Python | 12,256 | 381 | import argparse
import logging
import socket
from datetime import datetime
from pathlib import Path
import h5py
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from torch.optim.lr_scheduler import MultiStepLR
from vissl.co... |
cc51c57dd795874ef3d85792ee22cdf300c019f4bc2f7c35ce7348935f64dc57 | Python | 12,256 | 328 | """Export orchestration for the photometry-behaviour app."""
from __future__ import annotations
import logging
import re
import numpy as np
import pandas as pd
from PySide6.QtWidgets import QMessageBox
from src.excel_ops.behaviour_exporter import (
build_output_file_name,
create_df_for_behaviours,
expor... |
0601edad311079205debe7609d93938ad13a122a8aa5e9e5bdc672b7af3e33b5 | Python | 12,262 | 269 | #!/usr/bin/env python3
# Florian Bénitière 16/03/2025
# This script processes annotated short variants (SNVs and Indels) data stored in Parquet format
# using PySpark. It performs multiple steps including:
#
# 1. **Chromosome-wise Processing**: Iterates over each chromosome to:
# - Convert SpliceAI scores to doubl... |
6b19c8c352f82432c1aa1f47ba8ba75daf9128d629bdd3a103a1566b56ae0ab8 | Python | 12,265 | 326 | import os
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from .ernie_rna.tasks.ernie_rna import *
from .ernie_rna.models.ernie_rna import *
from .ernie_rna.criterions.ernie_rna import *
def prepare_input_for_ernierna(index, seq_len... |
74fb43614a7f1a10e9a800cc6ec8fcc586281cdd4684865499d0d9ef18129f63 | Python | 12,266 | 360 | # @license
# Copyright 2017 Google Inc.
# 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 applicable law or agreed to in... |
88cb8fae9804afd6a28f9c17844b3d9f3e9b2760189f29486bd7cbe300e2a76f | Python | 12,272 | 383 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import csv
from pathlib import Path
import zipfile
from functools import reduce
from multiprocessing import cpu_count
from typing import Any, ... |
622cf20aa363c67b1b2a7971f394525b92ff5fe664994dbc07be7f750d9d3f24 | Python | 12,274 | 331 | """Splits that hold rare entities, and their surface forms, out of training.
Why the splits are drawn this way is on the splits page of the documentation.
"""
import collections
from collections.abc import Mapping, Sequence
import numpy as np
import numpy.typing as npt
SPLITS = ("training", "validation", "test")
_... |
3a2ba6a415c8be734d0d3366324f2681ee824ff7bba619e5964b23de2c4d603f | Python | 12,275 | 269 | #!/usr/bin/env python3
# Florian Bénitière 16/03/2025
# This script processes annotated short variants (SNVs and Indels) data stored in Parquet format
# using PySpark. It performs multiple steps including:
#
# 1. **Chromosome-wise Processing**: Iterates over each chromosome to:
# - Convert SpliceAI scores to doubl... |
71b283a88a7df27074cf9f4197a9b44136cbee8ac93e3c1626e0dde60d196f17 | Python | 12,277 | 347 | # Slightly modified from original Lucid library
# Copyright 2018 The Lucid Authors. 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/license... |
1ca4490e2f56e2c0961c26b7651fa33d9ffb19e81ac818c31da1744c5b6dff02 | Python | 12,286 | 297 | import numpy as np
import scipy.io as si
import os
import h5py
from sklearn.model_selection import KFold
from sklearn.svm import SVC
import sklearn.pipeline as skp
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
from functools import partial
from joblib import Parallel, delayed
import ... |
3735537882e8279f676e71ca111959b9a1fec4997f4fdd0aafff4e6a523d3448 | Python | 12,288 | 370 | import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
... |
ba7f776ec177d9b65629c64b446bf560a03ff3c17b5dee503900a21a3ba071dd | Python | 12,291 | 372 | import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
... |
27ee49780eab5cbb9b7a4f0dfcc91d093d0a69a3c6b4d03ddeb532e1f2416a05 | Python | 12,295 | 373 | import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
... |
28530e8caf13ebf88c9e2d6e3a6bcc145d374e1e8d1016cced89e6a3fbff1da8 | Python | 12,296 | 379 | import torch
import torch.nn as nn
from torch.optim import AdamW
import pytorch_lightning as pl
from pytorch_lightning.loggers.wandb import WandbLogger
from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint
from pytorch_lightning.callbacks.lr_monitor import LearningRateMonitor
from pytorch_lightning... |
05361d4fd4571bdbc387f9fd4c1fa3ec7486dfee368b2e272c424fdb84578d6b | Python | 12,303 | 328 | """
Functions specific to mappings
"""
from typing import Callable, List, Optional, Tuple
import numpy as np
import scipy.io
from scipy.optimize import linear_sum_assignment
from sklearn.cross_decomposition import PLSRegression
from sklearn.linear_model import Ridge
from sklearn.mixture import GaussianMixture
from sp... |
4aac9cce79c4ffe40ab1562d56c71511c3097f75484a8b6dfbdac150cbe94421 | Python | 12,308 | 314 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
from abc import ABCMeta
from . import ICore
from simulator.parameters.core_parameters impor... |
89dae738e7e2a3d2953e3a5f183dd2062e8d7e9d41c0a243173102d2d2b39b3b | Python | 12,311 | 341 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import warnings
import math
class SteepTanh(nn.Module):
def __init__(self, coeff):
super(SteepTanh, self).__init__()
self.coeff = coeff
def forward(self, x):
activation = nn.Tanh()
ret... |
29b568429e0e965a40c19b5bbe63e73bdb070ca1b1c6b208b24f98234bac59f2 | Python | 12,314 | 354 | #!/usr/bin/env python3
# MIT License
#
# Copyright 2025 Broad Institute
#
# 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... |
23d8e98b9fd0ff59544f3b4f04da83630cdf342d1aa956d3e7c206c391873f18 | Python | 12,329 | 343 | from typing import List, Tuple, Union, Iterator, Sequence, TextIO
from copy import copy
import contextlib
import math
import tempfile
import re
from pathlib import Path
import subprocess
import numpy as np
from scipy.spatial.distance import squareform, pdist, cdist
from Bio import SeqIO
from Bio.Seq import Seq
from uti... |
d6cc4cb5baf1c9c76173c500cf65d24640d97651f13d0a8cab3a5525608c9f65 | Python | 12,335 | 272 | from mdt import LibraryFunctionTemplate
__author__ = 'Robbert Harms'
__date__ = '2018-10-10'
__maintainer__ = 'Robbert Harms'
__email__ = 'robbert@xkls.nl'
__licence__ = 'LGPL v3'
class NODDI_SphericalHarmonicsIntegral(LibraryFunctionTemplate):
"""Approximate the integral of the Watson distribution using spheric... |
4fa7d9627a6a43f95f7af4f876ff9a841f157e5d93144cf1e9128c581438ccb3 | Python | 12,340 | 372 | #!/usr/bin/env python3
"""
Aggregate distillation validation metrics into one CSV.
For each experiment/fold, this script can:
1) Optionally run eval_nsd_hd95 to generate metrics CSV
2) Parse per-sample metrics from nsd_hd95.csv
3) Parse per-sample validation timing from training logs
4) Emit one combined report CSV co... |
0ec49fd4c64765764964408e5d3ace6a9937900ccc81936316e22c0bbb5434ef | Python | 12,341 | 202 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI/HardwareWindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import Qt... |
473b8bca9b03405076b47040dc4e8a8da6b377e9cb42f0e02468ee2d755136a8 | Python | 12,346 | 364 | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
import numpy as np
from celltype_ibl.models.encoders import (
SingleWVFEncoder,
ConvolutionalEncoder,
LinearProjector,
)
class SimclrContractiveLoss(torch.nn.Module):
def __init__(
self, temperature:... |
f26b34692d77aee29c5d14319a3be3b46457a64e50d499f0ef846eb4c3e3ab70 | Python | 12,350 | 293 | # call py.test from <PROJECT_ROOT> folder.
import os, sys, subprocess
sys.path.append(os.getcwd())
import pandas as pd
import numpy as np
import pytest
# features:
# E - extract
# C - complete tag indices
# A - awk a subset of SNPs
tests_overview = '''
test_ld[21,22] - generate --ld-file ... |
f1862a2f6366bc85d595c877bbb9818056bac2b75f7249475823d5ba834003fe | Python | 12,356 | 305 | # utils/dash_utils.py
import ctypes
import dash
import numpy as np
import pandas as pd
import plotly.graph_objs as go
import socket
import string
import threading
import os
import webbrowser
import logging
from dash import dcc, html
from dash.dependencies import Input, Output, State
from flask import Flask
from wsgiref... |
49ae347e9051a87b44b2011ee141e6f88015b25465423ac57baa7116c197877f | Python | 12,357 | 361 | import math
from collections.abc import Iterable, Sequence
import pyro
import pyro.distributions as dist
import torch
import torch.nn.functional as F
from pyro import poutine
from pyro.infer import Trace_ELBO
from pyro.nn import PyroModule
from scvi._constants import REGISTRY_KEYS
from scvi.module.base import PyroBas... |
7e5f5c612d4028fc30a469d3717e0ef82092bd6a49392561afdfad08b66fe898 | Python | 12,365 | 267 | import shutil
import time
from tqdm import tqdm
from dataloadR.augmentations import *
from evalR import voc_eval
from utils.utils_basic import *
from utils.visualize import *
from utils.heatmap import Show_Heatmap
import config.cfg_lodet as cfg
current_milli_time = lambda: int(round(time.time() * 1000))
... |
c008724a8ef9a84e553e3dab651afacf414b55fb1f2567a0bf20ce1075a368ca | Python | 12,366 | 312 | # This is the class for Physics informed neural network for phase field modeling in 3D
import tensorflow as tf
import numpy as np
import time
class CalculateUPhi:
# Initialize the class
def __init__(self, model, NN_param):
# Elasticity parameters
self.E = model['E']
self.nu = ... |
214100aee8beff68014b4a1420fb6fa790ff80041b50851d19660ea3514b63b5 | Python | 12,368 | 334 | """item-DAG tasks."""
__copyright__ = (
"Copyright (C) 2010-present, DV Klopfenstein, H Tang, All rights reserved."
)
__author__ = "DV Klopfenstein"
from ..godag.consts import RELATIONSHIP_SET
def get_go2parents(go2obj, relationships):
"""Get set of parents GO IDs, including parents through user-specfied re... |
0c74e859e23d92c3b2cd82a9a0bdb3ed2d5b669e63f40b179e09e4f4366ec49c | Python | 12,370 | 222 | import os
import argparse
import random
from tqdm.auto import tqdm
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
from importlib.machinery import SourceFileLoader
from pytorch_msssim import ms_ssim
from utils.utils import *
from utils.Dirt import *
from models.DA_loss_functions impo... |
1d3672f65c39d840f381882b24488f2e8efda71fd068d7c41aef5988c7c3242c | Python | 12,380 | 364 | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
import numpy as np
from celltype_ibl.models.encoders import (
SingleWVFEncoder,
ConvolutionalEncoder,
LinearProjector,
)
class SimclrContractiveLoss(torch.nn.Module):
def __init__(
self, temperature:... |
9a133c9a97395fe6dd6196d5b093b647fc5e9f69aa821025fce9531974753272 | Python | 12,391 | 367 | """
This file aims to transform the annotated XML files obtained from
[Whatizit](https://github.com/zbmed-semtec/whatizit-dictionary-ner) to plain
text. The translation converts the tagged concepts by the dictionary to its
corresponding MeSH ID.
Example
-------
To execute the script and generate a single TSV file, you... |
659fa01f9808dc41075b9ec8e2ce4dec2ec4ca943e68e0e95405186860ed7692 | Python | 12,413 | 326 | import os, math
from typing import Tuple
from torch import distributed
from dataclasses import dataclass
from multiprocessing import get_context
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
from model import ModelConfig
from model.blocks import ScaleAt
from confi... |
0e8db5be18c2c91fdd8630a5cb6d672478b5ddfb5285fc1e5ee9cc38f2e21109 | Python | 12,416 | 336 | # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Contains a PyTorch definition for Gated Separable 3D network (S3D-G)
with a text module for computing joint text-video embedding from raw text
and video input. The following code will enable y... |
740ce11c01c957ef46e1b215f96ec04987848675ef1e569c2c9ad008ca47187a | Python | 12,419 | 320 | import logging
from pathlib import Path
from typing import cast
import anndata
import numpy as np
import scanpy as sc
from anndata import AnnData
from fast_array_utils import stats
from fast_array_utils.conv import to_dense
from .. import __version__, settings
from .._constants import Keys, Nums
from . import lower_v... |
92d82b1da123948c21ccd64a3245da1273222844ba2545c48a08bc08b0afe409 | Python | 12,422 | 334 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from fairseq.data import data_utils
class WordNoising(object):
"""Generate a noisy version of a sentence... |
e53bffa2b97d0e6803943786eea0dc6f146c455fd4a492b74783fb0505880cc2 | Python | 12,426 | 325 | import unittest
import numpy as np
import numpy.testing as np_test
from pgmpy.factors.discrete import DiscreteFactor, TabularCPD
from pgmpy.inference import Inference, VariableElimination
from pgmpy.models import DiscreteBayesianNetwork
class TestStateNameInit(unittest.TestCase):
def setUp(self):
self.s... |
68d136265db251c5504c5ae2f6f7110de9d5a2435368eebfb2373a96e3747f08 | Python | 12,427 | 384 | """Utility functions for the DIAGVI model."""
from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING
import anndata as ad
import numpy as np
import scipy.spatial
import torch
import torch.nn.functional as F
from scvi.data._download import _download
from scvi.utils import depend... |
0249cdb8af0f17db903ad49f8edc2d37a6795e9b69f282135ee735757d9c2c6b | Python | 12,441 | 348 | """
This module contains helper functions for the ´models´ subpackage.
"""
import logging
import os
import pickle
import dill
from collections import OrderedDict
from typing import Optional, Tuple, Literal
from collections import defaultdict
import scipy.sparse as sp
from scipy.sparse import isspmatrix_csr
from sklea... |
1dad791ad93417b15e883f216fd8dc3273e77ff9b965b52dc2ca628b77846824 | Python | 12,441 | 305 | """Δ-learning fit on perovskites — combines the manuscript's Wave-1.5 basis
(1F+2F+CT2F+MADCT2F, the 384-feature recommended basis that hits 50.5 meV/atom
on cohesive energy) with the xtb GFN2 Δ-target.
For each of 243 labeled supercells:
cohesive baseline (manuscript): y_coh = (E_SIESTA - Σ refs_SIESTA) [per cell, ... |
c906014b07feac50189ccfd1b71319ab05b75a8240239d89c94ebcdf25b9c30f | Python | 12,442 | 184 | import os
import numpy as np
import collections
import argparse
import common.libbgmg
import logging
GO_EXTEND_BP_DEFAULT = 10000
def parent_parser_add_argument_out_lib_log(parent_parser):
parent_parser.add_argument('--argsfile', type=open, action=common.utils_cli.LoadFromFile, default=None, help="file with addit... |
53b415a458528bf335db199d179283f0cda8560c708a9355cb581122c7d93c43 | Python | 12,445 | 433 | import numpy as np
import random
import pandas as pd
from scipy.stats import linregress
from scipy.signal import resample
def calculate_waveform_metrics(waveforms,
cluster_id,
peak_channel,
channel_map,
... |
a37ac25dc2d3424033ed32fb0590c160173efe050f1d311273c901ec3ab4a427 | Python | 12,445 | 315 | # Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors
"""
From
https://github.com/mdtraj/mdtraj/blob/master/mdtraj/core/element.py
to compute center of mass.
"""
import numpy as np
class Element(tuple):
"""An Element represents a chemical element.
The mdtraj.pdb.element module cont... |
6333ad431d31a918a58c5c6e375386a09dd0b5bfe8dfb9dc5011b1cdc6f72288 | Python | 12,447 | 370 | import logging
import matplotlib
import numpy as np
import copy
from mdt.gui.maps_visualizer.actions import SetZoom, SetAnnotations
matplotlib.use('Qt5Agg')
from PyQt5.QtCore import QTimer
from mdt.visualization.maps.matplotlib_renderer import MapsVisualizer
from matplotlib.figure import Figure
from PyQt5 import QtW... |
9e87715cb6de904d976b798abc0cf2b6d79dce972453fa8823ba8ab54955fc21 | Python | 12,456 | 263 | #
# import sys
# sys.path.append("..")
# import torch.nn as nn
# from modelR.backbones.mobilenetv2 import MobilenetV2
# from modelR.necks.conv_csa_drf_fpn_hbb import Conv_CSA_DRF_FPN,Cat_Conv_CSA_DRF_FPN,L_CSA_DRF_FPN
# from modelR.head.dsc_head_hbb import Ordinary_Head
# from modelR.layers.convolutions import C... |
e193249fccadc306f29335c88c2e498f26d898b033376f6a6c77465644e15367 | Python | 12,457 | 313 | from __future__ import annotations
import logging
import random
from typing import Union
import numpy as np
from .validate import validate_split_durations
def unique_set_from_labels(labels: list[np.array]):
"""Helper function to generate the set of unique labels in a list of label arrays.
Used for compari... |
9c0003938b531a38f3d124d16b097ffd351983d46a59deb0618698fa77db55da | Python | 12,458 | 294 | """
figures/plot_spontaneous.py
===========================
Two figures for the spontaneous regime characterization (paper version).
Figure 1 — spont_characterization.pdf (2 panels)
(a) PR_spont vs N per regime — population dimensionality scaling
(b) Phase diagram at N=5000 — modal regime in the (η, g) pla... |
fb242fe15faaad38f82d2fea16174fd7e4c6f6dfe9da3a2dfa104f099d7718a8 | Python | 12,470 | 307 | from __future__ import annotations
import dynamic_network_architectures
from copy import deepcopy
from functools import lru_cache, partial
from typing import Union, Tuple, List, Type, Callable
import numpy as np
import torch
from nnunetv2.preprocessing.resampling.utils import recursive_find_resampling_fn_by_name
fro... |
0b757fcc42b37a52b0c3f508e876a52356331392ae8aa16a923576265043b78c | Python | 12,471 | 316 | from functools import partial
import huggingface_hub
from huggingface_hub import snapshot_download, constants, hf_hub_download
import os
import pkgutil
import torch
from typing import List, Tuple, Dict, Union
import warnings
import yaml
try:
import transformer_engine
HAS_TE = True
except ImportError:
HAS_T... |
ffaff6e33f81c43dce43d7585fc1c1402011e75659f8f9ff7e0071ba05280fb9 | Python | 12,482 | 254 | from typing import Union, Tuple, List
from batchgeneratorsv2.helpers.scalar_type import RandomScalar
from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform
from batchgeneratorsv2.transforms.intensity.brightness import MultiplicativeBrightnessTransform
from batchgeneratorsv2.transforms.intensity.c... |
56cb13d341ec44e681dcbcde576eee590a01166fafcb0954cfe16f09dcc3faf6 | Python | 12,488 | 230 | import numpy as np
from utilities import logistic_func
from tqdm import tqdm
import h5py
import bottleneck as bn
from joblib import Parallel, delayed
from sklearn.linear_model import LinearRegression
# --- Constants and Parameters ---
RESOLUTION = (1080, 1920)
FOV = (61, 92)
H_PIXELS_PER_DEGREE = RESOLUTION[1] / FOV[1... |
b377f2cdde3979286dd428515351eb3d2038cd43e0c0aac3b863cd8a955d1550 | Python | 12,488 | 274 | """
Plot multi-graphs in 3D.
"""
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from matplotlib.cm import ScalarMappable, get_cmap
from matplotlib import cm
import os
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Line3DCollection
from matplotlib.patches import ... |
14f7c8347794901b60784ea07a9530fb6c7b20c0c29572348d40865ea42bb7bc | Python | 12,489 | 384 | from os.path import join
import numpy as np
import pandas as pd
from lifelines import KaplanMeierFitter
from lifelines.statistics import logrank_test
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from sklearn.linear_model import LinearRegression
from sklearn.metrics impor... |
09c2b6bd3758e3fb4e8f76ee92c58258b6e529c3a8e28c89839adfa16e893a74 | Python | 12,490 | 382 | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.optim import Adam
from torch.optim.lr_scheduler import LinearLR
import lightning.pytorch as pl
from lightning.pytorch.loggers.wandb import WandbLogger
from lightning.pytorch.callbacks.lr_monitor import LearningRateMonitor
from lightning.pyt... |
0f2666d8041873f7ce0079f2cafa95088da1c6813b34e944623e70bff63d47bc | Python | 12,492 | 411 | """Functions for making a dataset of units from sequences,
as used to train dimensionality reduction models."""
from __future__ import annotations
import logging
import os
import pathlib
import attrs
import crowsetta
import dask
import dask.delayed
import numpy as np
import numpy.typing as npt
import pandas as pd
fr... |
fc862ddc19b8c4c7b53dca8a29b99bb70ef60d323a41f86ce7eab696e8e00d57 | Python | 12,493 | 264 | #!/usr/bin/env python3
"""
@file train_baseline.py
@author Simon Yu
@date 12/02/2024
@brief Script for training baseline models.
"""
import argparse
import dataset
import header
import logger
import math
import model
import test_baseline
import torch
import tqdm
import type
import utility
import wandb
def proce... |
7e82b41df70a5f54ce5a74593e0d77d50bf05198bf3ec1f2733b75ac451ed643 | Python | 12,512 | 346 | import os
import zipfile
from functools import lru_cache
from pathlib import Path
from typing import Callable, Dict, Iterable, Literal, Optional
import omegaconf
import pandas as pd
import torch
import wget
from graphein.protein.tensor.data import Protein
#from graphein.protein.tensor.dataloader import ProteinDataLoad... |
94e27491a43d3360f25bbba3a4844d8e12e53ca7d76969f78a88cb31452efee4 | Python | 12,512 | 382 | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.optim import Adam
from torch.optim.lr_scheduler import LinearLR
import lightning.pytorch as pl
from lightning.pytorch.loggers.wandb import WandbLogger
from lightning.pytorch.callbacks.lr_monitor import LearningRateMonitor
from lightning.pyt... |
453259c18e28f7d5b4b921f9782c3824a6e50e1a84744d54ae411cfabdcef752 | Python | 12,515 | 338 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import os
import csv
from collections import defaultdict
from six.moves import zip
import io
import wget
import sys
from su... |
04e0308e0910f662c97042414bb479d42f5849247549153dda44b3ffa687aee9 | Python | 12,517 | 399 | import torch
import torch.nn as nn
from torch.optim import AdamW
from torch.optim.lr_scheduler import LinearLR
import lightning.pytorch as pl
from lightning.pytorch.loggers.wandb import WandbLogger
from lightning.pytorch.callbacks.model_checkpoint import ModelCheckpoint
from lightning.pytorch.callbacks.lr_monitor imp... |
43b7a728c4db4eb23c10a227706c65fbc2300d8c883b57c75e05cb7d730f77c2 | Python | 12,527 | 346 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
from simulator.backend import ComputeBackend
xp = ComputeBackend() # Represents either ... |
c7c909c7db452657593978f6c4ed060fc9a92cd5861eb2f3e78940d933baa834 | Python | 12,531 | 314 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from itertools import combinations
import numpy as np
from pymatgen.analysis.structure_matcher import (
AbstractComparator,
OrderDisorderElementComparator,
StructureMatcher,
)
from pymatgen.core.periodic_table import Element
from pym... |
a5a0a45c7a1a0e43b8f949e1ac3c6cb9d59e35435e6c3d926b24eb5462795872 | Python | 12,536 | 273 | import os
import numpy as np
import matplotlib.pyplot as plt
import functools
import joblib
import PIL
import PIL.ImageEnhance
from PIL import Image
import skimage.feature
import skimage.measure
import skimage.segmentation
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_tes... |
a72ca7a1b79a752e11150c522397c73f73a77e8dc215de51a6426adea130b2a5 | Python | 12,540 | 330 | """Alignment and CIGAR string processing."""
import re
import edlib
import parasail
import pysam
re_split_cigar = re.compile(r"(?P<len>\d+)(?P<op>\D+)")
re_split_cigar_rev = re.compile(r"(?P<op>\D+)(?P<len>\d+)")
def cigar_ops_from_start(cigar):
"""Yield cigar string operations from start of cigar (in order).
... |
a8f4ece5b6b786932ac5e217f8b157dd51fd641713385037af5d806abe708325 | Python | 12,543 | 315 | """Estimate betas with GLMSingle for BIDS-formatted fMRI data preprocessed with fmriprep."""
import os
import click
import nibabel as nib
import numpy as np
import pandas as pd
from glmsingle import GLM_single # type: ignore
from loguru import logger
from compositionality_study.constants import (
BETAS_DIR,
... |
a957f109a9f1c28b43bc9dd0c8001fd5b91563b616a8ee266639dbddca2e7d56 | Python | 12,543 | 316 | from typing import List
import numpy as np
from scipy.ndimage import gaussian_filter
from scipy.interpolate import interp1d
from scipy.signal import find_peaks
def simulate_honeycomb_trajectory(
t_max: float = 1.0,
dt: float = 0.01,
p_move: float = 0.95,
drift_factor: float = 0.0,
speed: ... |
12dd94eb5f30260ba37059fa74658bda57dffa821f3ba6a2a8b52ff14b1ad029 | Python | 12,549 | 325 | #!/usr/bin/env python
#
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... |
b203849e779a07e0dbcbb83155bcfd62e2a89542972f5521cc23ff4abb77c4fa | Python | 12,563 | 377 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
from pathlib import Path
import subprocess
import aicspylibczi
import pandas as pd
import csv
import numpy as np
from io import StringIO
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
get_ipython().run_line_magic('matplotlib', 'inline... |
dc19e42f4acca3d06e879cf145797ef3c812046d00db88b8baf66194a447bf74 | Python | 12,563 | 264 | import multiprocessing
import os
from copy import deepcopy
from multiprocessing import Pool
from typing import Tuple, List, Union, Optional
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import subfiles, join, save_json, load_json, \
isfile
from nnunetv2.configuration import default_n... |
eef40653edf00dfe4601a29c3c65e0df8fbfa75649b6f0a5f77dd23fb650c687 | Python | 12,563 | 336 | """GUI tests for syllable editing functions and GUI utilities."""
import os
from types import SimpleNamespace
import numpy as np
import pytest
from scipy.io import loadmat
from moove.utils.gui_utils import zoom, unzoom, swipe_left, swipe_right
from moove.utils.syllable_utils import valid_move, delete_segment, add_new... |
7fdfb4e9976c4d6a598f976ed613c78bbc701f4162bc6f795351eb353d536126 | Python | 12,579 | 354 | """Regression tests for the vectorised `align_relation_predictions`.
The alignment used to convert `rel_meta` to Python lists and walk the candidate
rows one at a time. These tests pin the two properties the vectorised version
has to keep: it must produce exactly what that loop produced, and it must reach
its answer w... |
1c101bbf9f626058523cf8025f1203e89cc966069b0799a322d3cc2b657ca800 | Python | 12,585 | 307 | import numpy as np
import matplotlib.pyplot as plt
def classify_striatum_cells(ephys_properties, param):
"""
Classify striatal cell types exactly matching MATLAB classifyCells.m
MATLAB Classification rules:
- MSN: waveformDuration_peakTrough_us > templateDuration_CP_threshold & postSpikeSuppressio... |
69bf4d2e29b82c2dd1408abfe5d2e165d70379f6b258f9d9b207380f9b0754a4 | Python | 12,592 | 342 | import numpy as np
import scipy
import pandas as pd
from fractions import Fraction
import matplotlib.pyplot as plt
from matplotlib import cm, colors
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.axes_grid1.inset_locator imp... |
4238ed051435868ec47eb073a0208ccc335213052e3fae412855c81384956f1d | Python | 12,597 | 331 | import numpy as np
import copy
import pandas as pd
def random_segments_from_df(df, n_segment=1, segment_sizes=(10,), reset_index=False):
""" Pull out random segments from data-frame.
n_segment: # of segments to pull out
segment_sizes: tuple of possible segment sizes
reset_index:... |
3bf221e8c092e6602c88adec4d4417d38b797bcca1f2d62c08fdefa514a941d5 | Python | 12,603 | 237 | import os
import h5py
import pandas as pd
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from matplotlib.colors import TwoSlopeNorm
def read_chebyshev_coefficients(coeff_matrix):
"""
Read in the Chebyshev coefficients
:param coeff_matrix: coefficient matrix containing th... |
d4e8980c5f3a25ab3892476b9e5db7391302579143c6b5f175537dcf7dc28646 | Python | 12,611 | 296 | import os
import json
from pathlib import Path
import sys
import tempfile
import unittest
from unittest.mock import patch
import nibabel as nib
import numpy as np
from PIL import Image
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
os.environ.setdefault("SEGREF3D_DISABLE_SAM2", "1")
MODULE_DIR = Path(__file__... |
e7d02e08e99ed6f2931d31b1b48d4ab5f9c7760e3b9e480f68e383b4ed54feac | Python | 12,613 | 369 | import os
import time
import argparse
import re
from tqdm import tqdm
import pandas as pd
import numpy as np
import logging
import xml.etree.ElementTree as ET
from scipy import spatial
from typing import List, Dict, Tuple, Set
if not os.path.exists("./logging"):
os.makedirs("./logging")
logging.basicConfig(filen... |
ecb99d2b8498b209f6b649d65b3cfeeb6ebdb119b97ac4de6755640775a5b954 | Python | 12,621 | 272 | import os
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import torch
import torch.nn.functional as F
from torchvision import datasets, transforms
from torch import nn, optim
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
import h5py
from ambiguous.models.vae import MLP... |
b0e02a1d706fb4f6c9aa6661ea2068ed3d9734bebcff9c37f6342d85e0df960e | Python | 12,623 | 319 | import ast
import logging
import pandas as pd
import pytest
from apiadapters.ncbi.parser import is_scanned
from brenda_references import brenda_references as br
from brenda_references.brenda_references import (
merge_duplicate_documents,
preprocess_labels,
)
from brenda_references.data_paths import split_path
... |
21f16dcd3f9d15896f8235717e1559d9ed797cf42d3e147033a9b346a11ded48 | Python | 12,641 | 269 | import collections
import torch.nn.functional as F
from torch.nn.modules.batchnorm import _BatchNorm
from torch.nn.parallel._functions import ReduceAddCoalesced, Broadcast
from .comm import SyncMaster
__all__ = ['SynchronizedBatchNorm1d', 'SynchronizedBatchNorm2d', 'SynchronizedBatchNorm3d']
def _sum_ft(tensor):
... |
70fd0516b5258f9258d742eafa5b698a73c5d6486ad79be3f61adb0ac28a77d3 | Python | 12,642 | 364 | import itertools
import numpy as np
import torch
#import hydra
from omegaconf import OmegaConf
from scipy.spatial.distance import pdist
from scipy.spatial.distance import cdist
from pathlib import Path
from .model_utils import get_model
from ..models.predict_property import CrystGNN_Supervise
import smact
from smact.s... |
6c6c19c01f03fb8e36e8e399df688d008aded2737ff66f3a456aacf57b28c5d7 | Python | 12,657 | 369 | # Copyright 2020 The Lucent Authors. 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 required by applicable ... |
8dd87bf19f408f029a00e3754c43385e63ed42308f0b7014696a2bf75f19252c | Python | 12,664 | 271 | #!/usr/bin/env python3
"""Read in a tsv file from motif scanning and remove overlapping motifs.
For each position, if there are two motifs that claim it, remove the motif with a lower
value in the specified score.
The ``metric`` and ``filter`` arguments are evaluated by the interpreter.
These expressions are evaluate... |
1e110de880a8d464ad9d51ab48e2cdf3fb774ddd90f80eb70b6ac187f6b018a7 | Python | 12,667 | 310 | import array
import tempfile
import unittest
import parasail
import medaka.align
@unittest.skipIf(parasail.dnafull is None, "Using fake parasail.")
class ParasailAlignment(unittest.TestCase):
"""Check medaka.align.parasail_alignment function."""
ref = 'AGCATGTTAGATAAGATA'
def test_alignment_001(self):... |
4334b4d8f7fe76ed12b6221d12761ad7e38f60e04ca8543f8813b0ded264a78a | Python | 12,667 | 383 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from copy import deepcopy
from itertools import chain, permutations
from typing import List, Tuple
import torch
from pymatgen.core.structure import Structure
from scipy.spatial.transform import Rotation
from torch_geometric.data import Batch, Da... |
29791adabfd4ea4f00353eb0e2982f69ea32f79e27a9bc0891de8db5c013c330 | Python | 12,685 | 329 | import numpy as np
import torch
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
from scipy.stats import pearsonr, spearmanr
def _cosine_similarity(y_true, y_pred, mask=False):
if mask:
mask_nonzero = y_true > 0
y_true = y_true[mask_nonzero]
y_pred = y_pred[mas... |
c7fd08e6b4cee4b0692d963e4680281309795b51f7728860006aa3108f856f03 | Python | 12,686 | 329 | """Controller for telemetry file-loading and setup orchestration."""
from __future__ import annotations
import logging
import re
from datetime import datetime, timedelta
from pathlib import Path
import pandas as pd
from PySide6.QtWidgets import QFileDialog
from src.gui.framework.tk_compat_controls import Observable... |
455c0923863dd6458aaef3d476d2131324d2e3adf717bdc287866fbd9d2c26ea | Python | 12,687 | 302 | """
Integration test: runs DataProcessingSingleInstance end-to-end on the example
photometry + behaviour CSV files and compares the produced Excel against the
known-good golden file sheet by sheet.
Settings that were used when generating the golden file
(confirmed from its time axes and Summary Results bin labels):
... |
855f8f7bdf9496bd2b7f8188fb7ba701a147c8ad4617e8b8210130d60f1c4ab6 | Python | 12,688 | 258 |
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 12:11:41 2020
@author: scaling algorithms by A.Andree, parallelization by K.Butenko
"""
import os
import nibabel as nib
from multiprocessing import sharedctypes,cpu_count,Pool
from functools import partial
import numpy as np
import itertools
import sys
eps = 1e-12... |
a4f0f67ebe59d3a6599035ff9622cb9a71a9a051c20c2bb1974d0f43127064ce | Python | 12,688 | 354 | import os
import json
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import dataclasses
from dataclasses import dataclass
import tqdm
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
from transformers import BertModel, BertTokenizer
from transformers import P... |
fcb52818f7c7bad878d9ccc0f0302ccecb1312356efb0facf724ca34952d7cc5 | Python | 12,694 | 384 | from typing import Literal
import torch
from torch import nn
from torch.distributions import Binomial, Normal
from torch.distributions import kl_divergence as kl
from scvi import REGISTRY_KEYS
from scvi.distributions import NegativeBinomial, Poisson, ZeroInflatedNegativeBinomial
from scvi.module._vae import VAE
from ... |
ce0f2be6fa96410d83acab867b64215824acbebb5209f4680b61f5a9d8e8bef6 | Python | 12,696 | 309 | ## functions for RSA.
#
# written by S-C. Baek
# update: 16.12.2024
#
"""
Collection of functions to implement representational similarity analysis (RSA).
The code below is customized based on 'mne-rsa 0.8dev (https://users.aalto.fi/~vanvlm1/mne-rsa/#development).'
"""
import numpy as np
from scipy.spatial import dist... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.