sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
9ecce18368e30fa73b024c746bfa7d399beed5029db8fcfbf23c3da6e568f77a | Python | 12,368 | 364 | import torch
import torch.nn as nn
from torchvision.models import resnet34 as resnet
from nnunet_mednext.network_architecture.custom_modules.custom_networks.TransFuse.DeiT import deit_small_patch16_224 as deit
from torch.nn import CrossEntropyLoss, Dropout, Softmax, Linear, Conv2d, LayerNorm
import torch.nn.functional ... |
ac637d4615dbf026d34ac5eb2eff7ba6ea3e773b40bde02264f97c32a6ebf688 | Python | 12,372 | 318 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GINEConv, GATConv, GINConv
from pyhealth.models import RETAINLayer
from torch_geometric.nn.inits import reset
from typing import Callable, Optional, Union
import torch
import random
from torch import Tensor
from torch_g... |
996e742d0f65131219a81b867f18d95145047d3786fddc0d1f0e378d40b7c0ad | Python | 12,377 | 367 | import os
import pickle
import sys
import types
import pandas as pd
import pytest
from masscube.params import Params, PROJECT_CONTEXT_FIELDS
from masscube import project as project_module
from masscube.project import ProjectContext, ProjectMetadata
from masscube import workflows
from masscube.workflows import (
U... |
5ee3f141e47f676239e240b82d83face33a526335d9c647489655980bd53299c | Python | 12,380 | 280 | """Tests for reporting what one DANDI NWB asset holds.
These read HDF5, so they run against the real mock NWB files in ``stubbed_testing_data/nwb/`` --
one per supported ndx-fiber-photometry / events combination -- with no network access. The same
contract runs against a streamed archive asset in ``test_dandi_preview_... |
11cda236750f412d9a14d1328c220971dbc8c2b43be20a286965951046048c72 | Python | 12,384 | 291 | import os
import urllib.request
from pathlib import Path
from typing import Union
import torch
from ase import units
from ase.calculators.mixing import SumCalculator
from .mace import MACECalculator
module_dir = os.path.dirname(__file__)
local_model_path = os.path.join(
module_dir, "foundations_models/2023-12-03... |
59812ad9c7c0ae1277fb53c23715f80c90be5c0801ac986796aa2320345d67a8 | Python | 12,386 | 286 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from collections import OrderedDict
from typing import Dict, List, Optional, Sequence
import numpy as np
import torch
from mmengine.dist import is_main_process
from mmengine.evaluator import BaseMetric
from mmengine.logging import MMLogger, print_lo... |
43c4ea8a11d28cb851146adcab39b45885da9b5d7244151d2c24bc043ad16fc0 | Python | 12,390 | 277 |
from bisect import bisect_right
from collections import Counter
from parse_gene_anno import parse_gff_tree
import os
# https://stackoverflow.com/questions/5389507/iterating-over-every-two-elements-in-a-list
def pairwise(iterable):
"s -> (s0, s1), (s2, s3), (s4, s5), ..."
a = iter(iterable)
return zip(a,... |
ea3c6afbd530c76881ecb83f0a804407df6302cfbd2e8ee8422cbb4947d6a3f4 | Python | 12,401 | 295 | """
Permutation importance for the graph-level regression MLP.
Author: Hanna Tolle
Date: 2024-12-30
License: BSD 3-Clause
"""
import sys
sys.path.append('graphTRIP/')
from sacred import Experiment
from experiments.ingredients.data_ingredient import *
from experiments.ingredients.vgae_ingredient import *
from exper... |
f46a23ea7fd9667509599ca25dfe4ac1b2e82a03b6c149c76a9b677ba9ad01e1 | Python | 12,402 | 305 | #!/usr/bin/env python
# -*- coding: utf-8
#
# For usage, type: python average_images.py -h
# Example
# python get_rootlets_coverage.py -path-data /Volumes/temp/sebeda/rootlet_reg/results_spine-generic_sub-amu01_rootlets_2024-10-18/data_processed -path-out ~/processed_data/results_spine_generic_average -exclude processi... |
f8a17d47eea632fb4728c06dfc3579f4745e9fc85800a52794be4030e0f8cfd5 | Python | 12,404 | 352 | """Summarize the contents of the stubbed testing data directory.
Run from the project root:
python scripts/summarize_stubbed_testing_data.py
For each stubbed session, reports:
- Total folder size (bytes)
- Stub duration (seconds)
- TTL channel name
- Number of TTL events
"""
import shutil
import tempfile... |
b0856d4d7516c2fd677dfce4d2973d5b29104a06e118b4a7109148d943810b78 | Python | 12,417 | 255 | # Copyright (c) OpenMMLab. All rights reserved.
import logging
from typing import List, Optional, Union
import torch
import torch.nn as nn
from mmengine.logging import print_log
from mmengine.optim import DefaultOptimWrapperConstructor
from mmengine.utils.dl_utils import mmcv_full_available
from mmengine.utils.dl_util... |
8e4f4571da8ada666e42faa8a65ae772f20da01dc6d1dbaad3998c33fdacf4eb | Python | 12,431 | 262 | # 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
#
# http://w... |
9b246ba3a399c74a064e5481ef9d63172792a4378bd282a5a1ee6669410663c5 | Python | 12,434 | 264 | import numpy as np
from collections import Counter, defaultdict
from time import time
import re
from glob import glob
from sklearn.base import clone as CLONE
import warnings
from sklearn.exceptions import ConvergenceWarning
import sklearn.metrics as metrics
# Imputation
from sklearn.experimental import enable_iterativ... |
011ea6a2cbcf67c75207c1007d9aaa4d0b76a21596e5fd8c18beab1ff506322b | Python | 12,442 | 373 | # #############################
#
# Copyright (C) 2018
# Jennifer Dreiling (dreiling@gfz-potsdam.de)
#
#
# #############################
import logging
import numpy as np
import matplotlib.pyplot as plt
logger = logging.getLogger()
class ObservedData(object):
"""
The observed data object only consists of ... |
206876b74e218fcc36864787e6221b37c9edd51c0f52cf17b8760e54a9ea7201 | Python | 12,443 | 361 | from typing import Optional
import pytorch_lightning as pl
from torch.utils.data import Dataset, DataLoader
import numpy as np
from datasets.utils.pad_tensors import PadTensors
import torch
import matplotlib.pyplot as plt
class BurstSequenceDetection(Dataset):
dataset_name = "BurstSequenceDetection"
def __in... |
71844e1ff09b192d7efc7d35669bf5ac85d035702d0e90928689135c7c063ca0 | Python | 12,451 | 366 | #!/usr/bin/env python
"""
MetaWIBELE: mspminer_msp_taxonomy_annotation module
Taxonomy annotation for MSPs
Copyright (c) 2019 Harvard School of Public Health
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 ... |
479618b5ef4905aa29bd2d0dc7d2881e54720e6651c50152f52a030c77b7fe8a | Python | 12,459 | 364 | # pylint: disable=protected-access
"""Utilities for processing spark partitions."""
from collections import defaultdict, namedtuple
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Tuple, Union
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
from .._typing import ... |
3a8a803bfab74dd384593ba20a232bf14e3d70eacfc75f8034e2422380124476 | Python | 12,461 | 456 | import argparse
import inspect
from . import gaussian_diffusion as gd
from .respace import SpacedDiffusion, space_timesteps
from .unet import SuperResModel, EncoderUNetModel
NUM_CLASSES = 1000
def diffusion_defaults():
"""
Defaults for image and classifier training.
"""
return dict(
learn_si... |
fc40b275cda4f106cbf572ee2533353f844f1b7eeef5ee2792e05293fc144d5e | Python | 12,462 | 261 | #!/usr/bin/env python
"""
save_seperate_run.py
-- Separates .acq files into runs and saves as bids format
Parameters
----------
topdir:
top directory of physio data
metadata_fname:
.csv file with subject/session/run information
Check file in ./demo/spacetop_task-social_run-metadata.csv
slurm_id: int
if... |
e4b8c8770a2daf8fc2b997eead683b859e24d43446f63fe66bbde8c967f10d58 | Python | 12,467 | 333 | '''
Date: 2022-11-23 11:29:36
LastEditors: yuhhong
LastEditTime: 2022-12-12 12:57:28
'''
import os
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
import yaml
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import DataLoa... |
6a0ea63f3eb5dff3e165e00270b13d6b2843648d188fb44ab618db8f1cb36317 | Python | 12,469 | 273 | import numpy as np
from collections import Counter, defaultdict
from time import time
import re
from glob import glob
from sklearn.base import clone as CLONE
import sklearn.metrics as metrics
# Imputation
from sklearn.impute import IterativeImputer
# Models
from sklearn.ensemble import RandomForestClassifier, Bagging... |
ccd25bb4da90467155f138ebf83be71f57385607963618cc6478452c6ce70d18 | Python | 12,474 | 210 | #! /bin/python3
import subprocess
import os
from .jobHandler import *
import pysam
from .bcolors import Bcolors
class Cluster:
def __init__(self, cluster_name, tsv, logfile):
self.cluster_name = cluster_name
self.tsv = tsv
self.outdirs = {"tsv_to_bam" : None, "filter_UMIs" : None, "bam_to_f... |
8a9b366f44aa67d41659a939fd932268ccfad561e2b7439ba4a6d6453a2457d3 | Python | 12,475 | 298 | """
Author : Alexis Lebrun (PhD student)
School : Université Laval (Qc, Canada)
This module provides supervised learning models for vibrational spectra classification.
"""
from sklearn.ensemble import RandomForestClassifier as RandF
from sklearn.svm import SVC
from sklearn.metrics import classification_report, confus... |
d8dab79a636cfa6fee6b556ea3f9bc4f8cb15c56c6de567509a32165e53adf9d | Python | 12,481 | 386 | import numpy as np
import pickle
import pandas as pd
import seaborn as sns
import time
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from ev2gym.models.ev2gym_env import EV2Gym
class AnalysisReplayBuffer(object):
... |
bc4a331c0c282b14e077c518ada87a4eec46e3f39abbcb430b6b5c1c4c6c6f3c | Python | 12,488 | 365 | import functools
import re
import dateutil.parser
import logging
from django.db import connection
from django.db.transaction import TransactionManagementError
from catmaid import locks
from catmaid.util import ask_to_continue
transaction_label_pattern = re.compile(r'^\w+\.\w+$')
logger = logging.getLogger(__name__)... |
b01eab167ec459d356b8d3545b33ee17c19a9179edd55f7148c470a0cee3398d | Python | 12,494 | 361 | #!/usr/bin/env python
"""
MetaWIBELE: interproscan_protein_family module
Summary the results of annotation from InterProScan
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softwa... |
dd1598571abcb2cf490be0f6927a4e1fee206c947541d8c670f451ecab278d7c | Python | 12,497 | 333 | # rescreener.rescreen
import multiprocessing
import os
import shutil
from subprocess import PIPE, Popen
from typing import List, Optional, Tuple
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from ._constants import FULL_DIR, FULL_NAME_PREFIX, SUBSET_DIR, SUBSET_NAME_PREFIX
class Rescreener:
... |
2d2d024b5ef3a433f784a97cc282ec4b485549fbe4ade93701ac96a2a365ac7a | Python | 12,510 | 311 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmseg.registry import MODELS
from .utils import get_class_weight, weight_reduce_loss
def cross_entropy(pred,
label,
weight=None,
... |
7bf54de485131592b2db005c98d54c48d86e749fbf2219bcb40d994f49421099 | Python | 12,520 | 349 | from pyrates.frontend import OperatorTemplate,NodeTemplate,CircuitTemplate,EdgeTemplate
import numpy as np
from copy import deepcopy
def create_exc_neurons(num_mt = 32, ang_coh = -90, ang_plaid1 = -45, ang_plaid2 = 180+45,
bandwidth = 180, num_stim_dirs = 3, div_adap = 2.0, sub_adap = 0.0, base_rate = 0.1, sat = 0.5... |
8616f27b22e349dbb07039ea62303a8f5fc198b31dc8d591f2c973f55b49319c | Python | 12,527 | 327 | import warnings
from functools import partial
from typing import ClassVar
import ase
import einops
import numpy as np
import torch
from ase.calculators.calculator import Calculator, all_changes
from mace.data.atomic_data import AtomicData, get_data_loader
from mace.modules.models import MACE
from mace.tools import Ato... |
415fb3c4113cd6e9338fd4c8709ca7bc5604e51785fe1963d1cd6cd9528316ab | Python | 12,528 | 345 | """Project-level context, metadata, and workflow state models."""
from dataclasses import dataclass, field
import os
from typing import Any, Dict, List, Optional, Sequence
import numpy as np
import pandas as pd
from .raw_data_utils import find_raw_data_info, get_raw_data_format
from .utils_functions import label_bat... |
9a92a3ebdf34a77589fc4792ff44e0aef4c3ba1b5b3e9288e13c7ed84e5656b3 | Python | 12,531 | 217 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from matplotlib.lines import Line2D
from glob import glob
import scienceplots
import matplotlib.gridspec as gridspec
import scipy.stats as st
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.colors as col... |
62e378195d728d57f32220260ae7f5f78bab459b9a2d5efb7eeed637f0b038a8 | Python | 12,541 | 393 | import os
import h5py
import torch
import numpy as np
import multiprocessing as mp
from .. import config, printit
__all__ = [
"Dataset",
"data_augment",
"readdata",
]
# Flip by batch with 5 dimensions (batch, channel, x, y, z)
FLIP_DICT_BATCH_LEVEL_TORCH = {
0: [],
1: [2], # Flip along the X-axis,... |
05b4b61eb0278c6c26dc5edb1690cee2adf38d06f5480e54a377b154fef655f7 | Python | 12,544 | 387 | """Test the prototype cwltool:Loop extension."""
import json
from collections.abc import MutableMapping, MutableSequence
from io import StringIO
from cwltool.main import main
from .util import get_data
def test_validate_loop() -> None:
"""Affirm that a loop workflow validates with --enable-ext."""
params =... |
7284bc4dd75fca61cf03c5505ccc9bd8a753d014c401ff7d43c1b0042146931e | Python | 12,544 | 320 | """
Data-loading utils and dataset class for nanopore data
"""
import numpy as np
import torch
from torch.utils.data import Dataset
from tqdm import tqdm
import pyarrow.parquet as pq
import random
from bisect import bisect_left, bisect_right
def tune_signal(sigList, min_val=-50, max_val=150):
new_sigList = [max(mi... |
6f7b28b7f8fb0867a6e63e79869da3b7951be931e9e062702ee88212db9cbeab | Python | 12,548 | 299 | from scipy.stats import entropy
from scipy.signal import find_peaks
import numpy as np
negctrlfile = '/gicephfs/brookslab/bsaintjo/220516_ang_conc_unique_nanopolish/unique.0.eventalign.tsv'
posctrlfile = '/gicephfs/brookslab/bsaintjo/220516_ang_conc_unique_nanopolish/unique.500.eventalign.tsv'
chromatinfile = '/privat... |
5790aecc0f2f1e747182b46baa006cc73b04d99efc65f1c913d6d64c5dd63f93 | Python | 12,554 | 334 | """Module to select valid pairs of morphologies and electrical models."""
# Copyright (c) 2022 EPFL-BBP, All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS... |
7223d9704621568c15b655ff14f7e2105e83cc26faa3750d282c9095d660d145 | Python | 12,555 | 300 | """
Proximal Policy Optimization (PPO)
==================================
This file defines the distributed Trainer class for proximal policy
optimization.
See `ppo_[tf|torch]_policy.py` for the definition of the policy loss.
Detailed documentation: https://docs.ray.io/en/master/rllib-algorithms.html#ppo
"""
import ... |
d2194ae90a973ceb708b69020730284b5359bb7832a011834b04aae59f666458 | Python | 12,569 | 325 | # This function is to count reads supporting each read category
import os
import sys
import time
import pysam
import numpy as np
import multiprocessing
from optparse import OptionParser, OptionGroup
from ..version import __version__
from ..utils.count import get_smartseq_matrix, SE_effLen
from ..utils.count_droplet i... |
0c1a98f79dfe8a51f45ae72c0bd833e5e92fa4200560c13900c2bf1f7b920cad | Python | 12,575 | 378 | import os
import subprocess
import tempfile
import time
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn, optim
# from nearl.static import cos_sim
from torch.utils.data import DataLoader, TensorDataset
class PointNet(nn.Module):
def __init__(se... |
285605214d4251678a379db15834b4fd7c941eb775d346cee1081215bbe8e7de | Python | 12,595 | 319 | #!/usr/bin/env python3
"""Build the eggNOG-mapper v3 self-test dataset.
Produces a small, self-consistent ``test_datasets/data/`` directory (a mini
eggNOG DB + DIAMOND db + taxonomy + OBO) together with per-``itype`` query
fixtures (proteins / CDS / genome / metagenome). Running emapper against this
data reproduces fi... |
13464a4b7ae7f2ca34de6ce9447caae64e1be64494769060e7bb9e62828af11c | Python | 12,596 | 382 | from rest_framework import status
from medperf.tests import MedPerfTest
from parameterized import parameterized, parameterized_class
class DatasetTest(MedPerfTest):
def generic_setup(self):
# setup users
data_owner = "data_owner"
prep_mlcube_owner = "prep_mlcube_owner"
other_user... |
561321612779679a3e33ea3b269c18bb8228391a7ef6b330001de6a4c10d2963 | Python | 12,608 | 313 | import torch
import torch.nn.functional as F
from torch.utils.data._utils.collate import default_collate
from dataclasses import dataclass
from typing import Dict, List, Union
from fengshen.models.tagging_models.bert_for_tagging import BertLinear,BertCrf,BertSpan,BertBiaffine
from fengshen.data.sequence_tagging_datalo... |
4f834bf8fe24da3094aa73a616e7e5a4d42a0e5a3bbe905671468aec8310d1c4 | Python | 12,609 | 320 | ##################################################################
# Extracting the gene matrix of the assigned motifs
# Reproducibility for Figure.4EFGH,IJK
##################################################################
import pandas as pd
from scipy.spatial import Delaunay
from scipy.sparse import csr_matrix
imp... |
96e4b4b4771d636825e60c86dd2f10a540b1b48ba466694d39177a57e7f740b2 | Python | 12,621 | 347 | import torch
import torch.nn as nn
import numpy as np
import time
import pandas as pd
import os
import sys
from scipy.sparse import issparse
from .utils import *
from .models import GraphGrangerModule
def run_gridnet(X,Y,X_feature_names,Y_feature_names,candidate_XY_pairs,dag_adjacency_matrix,
n_layers=10,device=0,... |
becd7d2a1851e6a00feba7fd29f5d31c8fe1998fe1ec061631a126bb3288cf73 | Python | 12,623 | 333 | import argparse
import random
import time
import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from sklearn.metrics import roc_auc_score, average_prec... |
7f276a6f94b7e1763f55bc02fe08ff0061ead45145caafda0613e986e933fc4e | Python | 12,627 | 412 | """Unit tests for FilesystemRead provider."""
import time
from pathlib import Path
from unittest.mock import MagicMock
from urllib.parse import urlencode
import fsspec
import pytest
from zndraw import ZnDraw
from zndraw.providers.filesystem import FileItem, FilesystemRead, _from_info
from zndraw_joblib.schemas impor... |
80bab04c0ae8af78d81f80c46b32f0409ea9975531e3468061b2cd7c2c82a46a | Python | 12,627 | 304 | from PyQt5 import QtGui, QtWidgets, QtCore
import pyqtgraph as pg
import numpy as np
from copy import copy
from util.conf import bl_moving_average_params, bl_asymmetric_ls_params, bl_polynomial_fitting_params, bl_top_hat_params
from util import colors
from util.functions import fitting, getGradient, topHat, als, movin... |
d720f84004fa9ee3e3969ff9a4fc0455531c799eb32c007c75fe58507a7adbd0 | Python | 12,627 | 330 |
# all cusomt functions used in analyses for the manuscript:
# "Model mimicry prohibits limit conclusions about neural tuning and can mistakenly imply unlikely priors"
# by: Michael J. Wolff & Rosanne L. Rademaker, 2024
import numpy as np
from scipy.ndimage.filters import uniform_filter1d
from sklearn.model_selection... |
d97b1f64cd8e5625b2d2c40e00bd18be17dd8bfe9b4eace14237326cf8103695 | Python | 12,629 | 291 | import numpy as np
import pandas as pd
from sklearn.metrics import recall_score # type: ignore
from imblearn.metrics import specificity_score # type: ignore
from sklearn.metrics import precision_score # type: ignore
from sklearn.metrics import f1_score # type: ignore
def calc_strat_stats(y_true, y_proba, resolution=0... |
4ecfea10e127e6cb287af8798d85dc25e4f90ab22c2cab0078caf5d0d578407b | Python | 12,631 | 333 | from unittest.mock import patch
import pytest
from src.datahandlers import complexportal
from src.datahandlers.complexportal import COMPLEXTAB_COLUMNS, COMPLEXTAB_HEADER
from src.predicates import HAS_EXACT_SYNONYM
from src.prefixes import COMPLEXPORTAL
from tests.conftest import (
assert_descriptions_file_valid,... |
11a85961e8f88effa30a0f999569bef174af9d682d520462a742a6a1e1f8a1cf | Python | 12,635 | 259 | from generateHTML import *
from weightAnalysis import *
from getActivity import *
def writeAccSection(reportFile, dataSet, trialRange):
# accuracy and loss section
writeHTMLSectionHeader(reportFile, 'Accuracy and Loss', note='Accuracy and Loss curves can be combined onto single plots for easy comparison')
... |
6407597cbf2e1d75b1b4bffb8eb82c2391afd7819b199a020c8a4d0987fc9280 | Python | 12,635 | 259 | from generateHTML import *
from weightAnalysis import *
from getActivity import *
def writeAccSection(reportFile, dataSet, trialRange):
# accuracy and loss section
writeHTMLSectionHeader(reportFile, 'Accuracy and Loss', note='Accuracy and Loss curves can be combined onto single plots for easy comparison')
... |
93a35df9f3f1f1f16e0521d231df0b626105fdb23db9cc3ffd4300e418321f20 | Python | 12,635 | 259 | from generateHTML import *
from weightAnalysis import *
from getActivity import *
def writeAccSection(reportFile, dataSet, trialRange):
# accuracy and loss section
writeHTMLSectionHeader(reportFile, 'Accuracy and Loss', note='Accuracy and Loss curves can be combined onto single plots for easy comparison')
... |
d3647ae07fb4a038038a8932b27c5aa34b75f48696f47b34741812bbc8642faf | Python | 12,635 | 259 | from generateHTML import *
from weightAnalysis import *
from getActivity import *
def writeAccSection(reportFile, dataSet, trialRange):
# accuracy and loss section
writeHTMLSectionHeader(reportFile, 'Accuracy and Loss', note='Accuracy and Loss curves can be combined onto single plots for easy comparison')
... |
67d6b295a085590b50b992e78e41bae55bc36202495e8c27283df66f9e674867 | Python | 12,647 | 308 | import numpy as np
import pytest
from guppy.orchestration.preprocess import (
execute_artifact_removal,
execute_combine_data,
execute_zscore,
extractTsAndSignal,
removeArtifactsFromSignal,
)
# ── error paths ───────────────────────────────────────────────────────────────
def test_execute_zscore_... |
25585a7b4aff6515b6f0cc6078430220278d071e05f9598e114de777f8880463 | Python | 12,648 | 354 | #!/usr/bin/env python
'''
# Author: ChangXu
# Create Time : 2021.4
# File Name :utils_func.py
'''
import os
import sys
import numpy as np
import anndata
import scanpy as sc
import pandas as pd
import torch
from torch.utils.data import DataLoader
from torch.utils.data import TensorDataset
from sci... |
ca3523c58365574faddf1bfb54f374e4b4beba05127185ea2b17d22b916e099a | Python | 12,657 | 295 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Optional, Tuple, Type
import torch
from torch import nn
from sam2.modeling.sam2_utils import La... |
6070d9e25ae4887940418a881454ca93d7994564838ab95a1804a6cb3f32a85a | Python | 12,661 | 367 | import yaml
import numpy as np
import pandas as pd
import pathlib as pl
from myphdlib.interface.session import SessionBase
class GonogoSession(SessionBase):
"""
"""
def __init__(self, sessionFolder):
"""
"""
super().__init__(sessionFolder)
return
@property
def fp... |
51cdaebf8c2270329a4479c0d498dbad06c7baa17ba498a2101004cb8bab45bd | Python | 12,663 | 101 | import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import (
LoraConfig,
PeftModel,
TaskType,
get_peft_config,
get_peft_model,
prepare_model_for_kbit_training
)
import time
import sys
LISA = True if sys.argv[3] == "1" else False
LORA = True if sys.argv[4] == "1" ... |
fbcfc50363d42c030896f5235be29d90eb37d7cd49826c5c3fa787d2e26aa0f6 | Python | 12,666 | 283 | import logging
import shutil
from pathlib import Path
from typing import Any
import numpy as np
from neuroconv.datainterfaces.fiber_photometry.pyphotometry._file_reader import (
_get_layout,
_PPDAnalogSignal,
_PPDDigitalSignal,
_PPDRecording,
_read_header,
_read_ppd,
)
from guppy.extractors im... |
cd53ac2c84fa2af5faf1a1e09b2e9cda196ff8ec4ab6b70a888c20d1bc0a7cfa | Python | 12,667 | 304 | """Unit tests for the previous-release prefix comparison (``src/reports/prefix_comparison.py``).
Covered here (see the section headers below):
- RELEASE DATE PARSING — ``YYYYmonDD`` names sort by real date, not lexically.
- PIN CONSISTENCY — ``config.yaml``'s ``previous_release`` must be the newest committed baseline... |
c9a2551f3c5bee209d8f58ca39c9b3f20d0fd43cdb047c541118e5da2ab16042 | Python | 12,673 | 313 | """
This module contains functionality to read metadata files for
'ucdavis' dataset, which includes TIMIT and mVocs experiments.
By organization this dataset has two files for metadata:
- recanzone_timit_details.mat: Metadata for TIMIT experiment
- MSL.mat: Metadata for mVocs experiment
Notes about Metadata files:
- ... |
07b7d8584cfa615274e6c50ee5da4053d1524ecd0202ff540cf3f57fafc1818c | Python | 12,679 | 355 | """Parallel helper."""
import logging
import multiprocessing
import os
from abc import abstractmethod
from collections.abc import Iterator
from functools import partial
from multiprocessing.pool import Pool
import numpy as np
try:
import dask.distributed
import dask_mpi
dask_available = True
except Impor... |
23abd857944b7b557596a30b7e69a4ac0267e682d70da86a9221861ea814c128 | Python | 12,683 | 325 | import glob
import torch
from os import path as osp
from torch.utils import data as data
from basicsr.data.data_util import (duf_downsample, generate_frame_indices,
read_img_seq)
from basicsr.utils import get_root_logger, scandir
class VideoTestDataset(data.Dataset):
"""Video ... |
71d9a51b98194b55ebffd65c5ad9ad8e896e098405f34e0c4b96eb6fa58c1aad | Python | 12,693 | 215 | # 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
#
# http://w... |
2c5d9ee1c709e1b9a7139397da39773cb3a97c2c12c66103a1f6a86969bb9045 | Python | 12,697 | 384 | import cupy as cp
from .conv import *
from .core import iSeq
from .sig import *
from .single import iSeqSingle
from .wtx import *
def solve(V, k, l, z_th=0.001, tolerance=1e-7, n_iter=[30, 30, 10, 30], comp_rate=0.3, Wlim=0.1, Hlim=1.0, corr_max=0.95, random_seed=None):
_, t = V.shape
V1 = cp.array([V[:,... |
abfd9c19b32d4bc159ab143f3d65cd532080b864f1eae5023f3485d93b73cd77 | Python | 12,700 | 380 | import os
import dgl
import csv
import torch
import numpy as np
import pandas as pd
from rdkit import Chem
from rdkit import RDConfig
from rdkit import RDLogger
from rdkit.Chem import MACCSkeys
from rdkit.Chem import ChemicalFeatures
from rdkit.Chem.BRICS import FindBRICSBonds
from const import *
from dataset import *... |
b0195606837c3ae85faeffef4c179b69024c00fdf0c14b286521768f9d1d143b | Python | 12,700 | 321 | import numpy as np
import cv2
import sys
import os
import pickle
import torch
import torch.nn as nn
import SimpleITK as sitk
from torch import optim
from torch.utils.data import DataLoader, Subset, Dataset
from PIL import Image
import random
from albumentations import (
GridDistortion,
ElasticTransform,
Com... |
fc678f441d5c11c268c6331529557dd20bf63ded9f6ea1218c6b3ef0bf61666c | Python | 12,705 | 287 |
import bpy
import subprocess, os, sys, argparse, glob, time, random, shutil
from pathlib import Path
"""
#############################################################################################
Script Name : obj2mov.py
Description : Use Blender to render image from .obj, must be ca... |
71dd7e5bbbbf310b809dbda02af0565dbe530bcfad2a1dc47023fbfd4b3b15c7 | Python | 12,706 | 329 | import time
import numpy as np
from nearl import commands
np.random.seed(0)
# For dummp data generation
atom_nr = 300
frame_nr = 50
# For the settings of the grid
dims = np.array([32, 32, 32], dtype=np.int32)
spacing = 1.0
cutoff = 2.5
sigma = 1.0
def test_benchmark_frame_voxelize(benchmark):
tmp_coords = np.r... |
1e208c5e0b074bd8ab9228c2a261b4fd299eb5c716ddd1555f5676c9fa74dc3b | Python | 12,712 | 343 | '''
Date: 2022-11-23 11:29:36
LastEditors: yuhhong
LastEditTime: 2022-12-12 12:57:28
'''
import os
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
import yaml
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import DataLo... |
1885b44a208459cf27e553c048da8ff157e596292b7f834e1e39b54d2442ec57 | Python | 12,716 | 305 | import logging
import multiprocessing as mp
from pathlib import Path
import numpy as np
from .save_parameters import read_artifact_provenance
from ..analysis.binned_metrics import compute_binned_metrics
from ..analysis.covariates import (
bin_edges_from_binned_metrics,
compute_binned_covariates,
compute_c... |
7593809a887bf3ba9d5f9a6901198b2233340b127242e08d54d3534de02244e6 | Python | 12,717 | 291 | """
Provid access to neural data and DNN features.
'dataloader' module provides an interface to access neural spikes
and features from DNN models. Hence, this can be used to compare
these two spaces of high dimensional representation using
Regression Analysis, Representation Similarity Analysis etc.
"""
import gc
... |
a65e28bcb8cd56de18b132bc0bcd615e166205588da903d197d3d9a48841f117 | Python | 12,724 | 388 | from __future__ import annotations
from hashlib import md5
from typing import Any, Optional, Type
import cv2
import numpy as np
import pandas as pd
from pathlib import Path
from soccertrack.utils import make_video
from ..logging import logger
from ..utils import MovieIterator, get_fps
from .base import SoccerTrackM... |
38f81c3cba6e2007ad426e5263ed22aae569f53041a8ca2c494e252a517cdd6f | Python | 12,725 | 426 | import pytest
from unittest.mock import Mock
import tsgm
import numpy as np
import keras
from keras import ops
import os
from tsgm.backend import get_backend
# Skip TimeGAN tests on PyTorch with MPS due to device compatibility issues
try:
import torch
_pytorch_skip = pytest.mark.skipif(
os.environ.ge... |
f7b77d40a0aa381455862261642246151f8e91e3fcfcf78a24a47ec23aebb684 | Python | 12,730 | 351 | import xtal
import numpy as np
import sys
import random
import argparse
import os
from scipy.ndimage import gaussian_filter
import matplotlib.pyplot as plt
from PIL import Image
import copy
from multiprocessing import Pool
from functools import partial
# Parse input arguments
parser = argparse.ArgumentParser(descripti... |
70036ca463feb251ba2cea75768738de74bdc2788d7c386d12c3624d3c11500e | Python | 12,745 | 293 | # Copyright (c) OpenMMLab. All rights reserved.
import json
import os
from typing import List
import torch
import torch.nn.functional as F
from huggingface_hub.utils._errors import LocalEntryNotFoundError
from mmengine.model import BaseModule
from mmseg.registry import MODELS
from mmseg.utils import ConfigType
from .... |
c12851bf52e11c7b9f483103d2efb9b3723be7d69da00c457b158c8efe88c257 | Python | 12,755 | 374 | """CLI commands for GIF animation export.
Two composable axes:
- **Trajectory**: iterate over frame indices (``--traj-start/stop/step``)
- **Camera curve**: sweep camera along a curve (``--orbit`` or ``--curve KEY``)
If an axis is omitted it stays fixed at its current value throughout.
"""
from __future__ import ann... |
20ae828e63a240e9590c8e86c61393eb406e234f0b71259f6fae6e2d382e808f | Python | 12,762 | 421 | """Helpers for interfacing array like objects."""
import copy
import ctypes
import functools
import json
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Literal,
Optional,
Protocol,
Tuple,
Type,
TypedDict,
TypeGuard,
Union,
cast,
overload,
)
import numpy as... |
926ebb807252e0f4cae062a24f00d34f8aa5f40940bd664fa3e0216f1835deb5 | Python | 12,763 | 262 | import ast
import re
import jellyfish
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from sklearn.metrics import confusion_matrix, roc_curve, auc, accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef, balanced_accuracy_score
import matplotlib.pypl... |
8a7fc6cbc603c662db7cb5ea92974f346f967b1511a3482f833cb022f6c5a2de | Python | 12,765 | 326 | '''
The aim of this experiment is to check if the biomarkers identified by GRAIL
are really predictive of treatment outcome.
Computes all the candidate biomarkers (features) as in grad_align.py,
but on the original brain graphs (not the reconstructed graphs).
Then, computes the correlation of each biomarker with trea... |
a2f6c0e8f0b538cf3e2b4904199947bd7737fe815043fb049305b7691da79d16 | Python | 12,768 | 353 | from jaxkineticmodel.kinetic_mechanisms.JaxKineticMechanisms import Mechanism
class HOR2_Func_TEMP(Mechanism):
"""Temporary function until I have figured how to deal with simple activator constructs
and Mechanism object"""
@staticmethod
def compute(substrate, vmax, km_substrate, inhibitor, k_I):
... |
69cccddb4e7ca9541a613d40439a389324541e91c55a0e171c8bd166121c4091 | Python | 12,770 | 320 | import logging
import numpy as np
from .io_utils import (
get_control_and_signal_channel_names,
recording_site_from_channel_label,
)
logger = logging.getLogger(__name__)
def correct_timestamps(
timeForLightsTurnOn: float,
store_array: np.ndarray,
store_label_to_timestamps: dict[str, np.ndarray]... |
5c836a4de31d4ac423db9eff43dec29e53a013d7fb2d725eeb8f860614acde38 | Python | 12,774 | 352 | import torch
import ipywidgets
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display
from itertools import chain, islice
from ipywidgets import interactive, widgets
def _create_label(text:str)->ipywidgets.widgets.Label:
"Create label widget"
label = widgets.Label(
... |
1e4c179cc60cdb05e71b0aa23044cc5f3c3fc6a5bb9d93a21f105ef3f44710cd | Python | 12,781 | 366 | import os
import pytest
from kgx.cli import transform
from kgx.source import ObographSource, TsvSource
from kgx.transformer import Transformer
from tests import RESOURCE_DIR, TARGET_DIR
def test_read_obograph1():
"""
Read from an Obograph JSON using ObographSource.
"""
t = Transformer()
s = Obog... |
d2842f0a39d99981ff5a8f1a352b064d5f75a4a74c797d9181adea1edfc6934e | Python | 12,781 | 480 | import os
import numpy as np
from ase import build, db
from ase.calculators.singlepoint import SinglePointCalculator
from ase.io import Trajectory, write
from ocpmodels.datasets import (
AseDBDataset,
AseReadDataset,
AseReadMultiStructureDataset,
)
from ocpmodels.datasets.lmdb_database import LMDBDatabase... |
12091d2811b33ee5040a90a63c1f59446d58057606e7ab97d486b42f067bc29b | Python | 12,782 | 412 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
from statsmodels.formula.api import ols
from sklearn.linear_model import LinearRegression
from . import util
import re
from draw_rna.ipynb_draw import draw_struct
def find_mm_parent(seq, struct, a... |
5c21d341bbf0eceb1592f124ed0ac26bdf459dcf79fd43be45944520432c721a | Python | 12,786 | 362 | # pytest unit tests for spinalcordtoolbox.utils.profiling
import atexit
import logging
import time
from collections import namedtuple
from typing import Callable
import pytest
from spinalcordtoolbox.utils import profiling
from spinalcordtoolbox.utils.shell import SCTArgumentParser
from spinalcordtoolbox.utils.sys im... |
744fd8fa9077ced667d7c171b077f7cd435ec04f6a030564ddebbbb0ea044a1d | Python | 12,795 | 282 | import os
import tqdm
import torch
import torch.nn as nn
import torch.optim as optim
import argparse
import json
import math
import sys
import wandb
import shutil
from utils import fix_random_seeds
from torch.utils.data import DataLoader
from data.transforms import ISOSTransform
from data.datasets import AOOCTConeSeg
f... |
1b74a018d437b10252df9d6034f100c26d7946375dcc48ad0370429e7f388088 | Python | 12,796 | 350 | # -*- coding: utf-8 -*-
import datetime
import json
import logging
import os
from typing import Any, Dict
import requests
from django.conf import settings
from django.http import HttpRequest, JsonResponse
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from ..model... |
744dabe7f29df09add96ff261c0f442812d979d1ac8ef76b9f3bf57153b8d362 | Python | 12,799 | 293 | # ROI exporter for MagellanMapper
# Author: David Young, 2017, 2023
"""ROI exporter for MagellanMapper.
Convert images and corresponding database entries into formats for
machine learning algorithms or other applications.
"""
import os
import glob
from typing import List, Optional, TYPE_CHECKING
import numpy as np
... |
f182714dbee4e50fffa6f4cb4f033c1021cffcc98c73605bdcb5b4a019ea7072 | Python | 12,800 | 327 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
# Kalman filter implementation to smooth noisy data
def kalman_filter(data, R=1e-5, Q=1e-5):
length = len(data)
x = np.zeros(length) # Initialize state vector
P = np.zeros(length) # Ini... |
38fe69695f4a086564f74aaee041570673a7c9d7e13f9c316b67c4066356c7f2 | Python | 12,804 | 358 | import pytest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import tsgm
try:
import tensorflow_privacy as tf_privacy
__tf_privacy_available = True
except ModuleNotFoundError:
__tf_privacy_available = False
import numpy as np
import keras
from tsgm... |
12a595e5c8463288d8817bc2b2be93790b9a9d8d3ebfd19d9558e335256ea387 | Python | 12,810 | 394 | """Sphinx configuration.
See `doc/contrib/docs.rst <https://xgboost.readthedocs.io/en/stable/contrib/docs.html>`__
for more info.
"""
import os
import shutil
import subprocess
import sys
import tarfile
import urllib.request
import warnings
from urllib.error import HTTPError
CURR_PATH = os.path.dirname(os.path.abspat... |
94514e62ed14fd35528387b0b93f5aed5fbf7cb515316da6f3915efa8aae4dc7 | Python | 12,818 | 359 | #!/usr/bin/env python
"""
MetaWIBELE: interproscan_phobius_protein_family module
Summary the results of Phobius from InterProScan
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "S... |
89acde83a0b386382cd6ef4e7b293d1b1badbdadc0ef8ffb6fa202813fd4fa10 | Python | 12,820 | 321 | '''
This one-in-all script has been used to convert DICOM files to npz files for the GDP-HMM challenge.
Note: Since we have provided the npz files for the challenge, you do not need to run this script.
But this script can help you understand how npz files are saved, and you can adjust the functions for your research... |
2c510046e1b980bad81fc71a3919fdcd1379594f1eff3c6691d325fb091f2acd | Python | 12,823 | 372 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 9 09:24:11 2023
@author: schwab
"""
from pathlib import Path
from typing import Optional
import mrcfile
import numpy as np
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from scipy.spatial import KDTree
from dy... |
8801dbf2caae05b54044995393357e13064fb31b9bdbc7e2119a0d6a62ac892a | Python | 12,823 | 339 | import argparse
import random
import time
import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from sklearn.metrics import roc_auc_score, average_prec... |
a75d044ece56b80389a4d58f301678d40b7073d9da841426ebf3f93f96b71d42 | Python | 12,823 | 296 | """Characterize the quoting/punctuation used in the two NCBIGene free-text synonym columns.
NCBI's ``gene_info.gz`` packs multiple values into two pipe-delimited free-text columns:
- ``Synonyms`` (column index 4) -- the NCBI "otheraliases" field
- ``Other_designations`` (column index 13) -- the NCBI "other... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.