sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4fbebf68189b9bf5320c062e1265c5d17018d738e2248cf2b6197dcad915f94f | Python | 13,101 | 321 | from pathlib import Path
from typing import Iterable, Tuple
import h5py
import numpy as np
import pandas as pd
import torch
import yaml
from torch.utils.data import Dataset
"""
dataset class (MILDataset) and helper functions (get_cohort_df, transform_clini_info, get_multi_cohort_df)
"""
def get_cohort_df(
clini... |
34221414744690e70c42adf31d220d3db68efb154deae1542129c7219c012fc6 | Python | 13,102 | 165 | """
Loads sessions with tracking data/spikes.
The method data_loader allows one to extract any combination of cluster activity
and variables possible; the special method __str__ returns the type and description
of each queried variable, respectively.
@author: bartulem
"""
import os
import sys
import pickle
class Ses... |
778cf025bbc11b1891795c3f5ac5ac575bf47162b0dea291ac65d9ab280e1f5d | Python | 13,106 | 311 | from typing import Optional, Union
import os
from pathlib import Path
import numpy as np
import pandas
import torch
import torchio
from torchio.transforms import Pad
import SimpleITK as sitk
from tqdm import tqdm
from GANDLF.utils import (
perform_sanity_check_on_subject,
resize_image,
get_filename_extens... |
d97cce7da4d0e06ec0eb5470a77e1e931e5790c75a4d74312a9609cbad93ecfb | Python | 13,118 | 388 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils import data
from torch.utils.data import SequentialSampler
from torch import nn
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from time import time
from sklearn.metrics impo... |
a76c437473135bcb490019e31e066c561647d3504344fcfb7f3c7543face63c3 | Python | 13,128 | 403 | import errno
import json
import logging
import os
import queue
import sys
import threading
import uuid
import numpy
import zmq
import cellprofiler_core.utilities.grid
from cellprofiler_core.utilities.zmq._boundary import Boundary
from cellprofiler_core.utilities.zmq.communicable.reply import LockStatusReply, Reply
fr... |
9c21b4116a748ed314394e0c3ecc33d1e1686854e846a548a0da38815eedc715 | Python | 13,136 | 304 | import contextlib
import unittest
import torch
import torchdiffeq
from problems import (DTYPES, DEVICES, ADAPTIVE_METHODS)
@contextlib.contextmanager
def random_seed_torch(seed):
cpu_rng_state = torch.get_rng_state()
torch.manual_seed(seed)
try:
yield
finally:
torch.set_rng_state(cp... |
c5372989c8706437885b9497b8f0a0ba5b60d7b87e27a907596518f6911bb17c | Python | 13,171 | 249 | import os
import time
import yaml
import torch
import shutil
import numpy as np
import argparse
from e2vid.options.inference_options import set_inference_options
class Settings:
def __init__(self, settings_yaml, generate_log=True):
assert os.path.isfile(settings_yaml), settings_yaml
with open(set... |
4db05bf4674047d8f1287525e52728388339863ce52a26b704d63e0e7d52c3f9 | Python | 13,190 | 417 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
413c5eb2aa5a3e0958afcf3c7574eef442d0b70acf754caa54ee1fc39e03af2a | Python | 13,198 | 294 | import argparse
import os
from pathlib import Path
from typing import Dict
import yaml
import numpy as np
from tabulate import tabulate
import pandas as pd
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, Subset
import pytorch_lightning as pl
from pytorch_lightning.callbacks import... |
9935c5dd55b93123188f2e55009f33860fa0d8c5d8004f889bbcd47ad3877f09 | Python | 13,198 | 280 | import os
import numpy as np
import cv2
from torchmetrics.functional.classification.confusion_matrix import confusion_matrix
from tqdm import tqdm
from tabulate import tabulate
import matplotlib
import matplotlib.pyplot as plt
import torch
from torch.utils.data import Subset
import albumentations as A
import pydicom
im... |
a3c6f889d65d26629daabe23d62e0d55ff5251154ea9354a7831bc3027ec7c0a | Python | 13,198 | 357 | import copy
from pydantic import BaseModel, Field, ConfigDict
import numpy
from typing import Any, Dict, List
from numpy.typing import NDArray
from cellprofiler_library.opts.measurement import (
R_FIRST_OBJECT_NUMBER,
R_SECOND_OBJECT_NUMBER,
)
class RelationshipBase:
"""Key for identifying relationship ... |
be8c964e48926b5275a53bc6fb869b0b7d24c1401d637d1e654bec1aee13ae0f | Python | 13,203 | 359 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import fftconvolve
from .signals import diag_indices
from .utils.time import get_dt, searchsorted
class Kernel:
def __init__(self, prior=None, prior_pars=None):
self.prior = prior
self.prior_pars = np.array(prior_pars)
... |
3d94c2019af4dcde8163ac3fd2abd54c2c072e9f48feb40dc29051bad30a8e22 | Python | 13,220 | 315 | """ Adafactor (Big Vision variant) for PyTorch
Adapted from the implementation in big vision: https://github.com/google-research/big_vision
Described in 'Scaling Vision Transformers': https://arxiv.org/abs/2106.04560
References for added functionality:
Cautious Optimizers: https://arxiv.org/abs/2411.16085
Wh... |
9c11bd413416ef4d69f9f52388059b04c0fd98da1947723bde50eba9eed3f858 | Python | 13,235 | 426 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2022 Pawan Goyal
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 th... |
49baf62f6d95aca09794716396bb5eccd0417d61a149bff8b04f3a9cd3946587 | Python | 13,251 | 356 | import os.path as op
import numpy as np
import nibabel as nib
import time
from src.utils import utils
LINKS_DIR = utils.get_links_dir()
SUBJECTS_DIR = utils.get_link_dir(LINKS_DIR, 'subjects', 'SUBJECTS_DIR')
FREESURFER_HOME = utils.get_link_dir(LINKS_DIR, 'freesurfer', 'FREESURFER_HOME')
# Check this out:
# https:/... |
bbbe05eea137a9d4fdf3a6007cadbccd3bc2f560bfc8ba06c8306c364990de96 | Python | 13,255 | 302 | import logging
import textwrap
import wx
import wx.lib.scrolledpanel
from wx.lib.agw.infobar import AutoWrapStaticText
from cellprofiler_core.preferences import config_write_typed, config_read_typed
from cellprofiler_core.reader import activate_readers
from cellprofiler_core.constants.reader import ALL_READERS, BAD... |
d6b8278e2ead8992cf86a9370c74185ffa4c8709bd99584af1a361af7690ec55 | Python | 13,255 | 392 | from enum import Enum
import math
import numpy as np
import torch
import warnings
from .event_handling import combine_event_functions
_all_callback_names = ['callback_step', 'callback_accept_step', 'callback_reject_step']
_all_adjoint_callback_names = [name + '_adjoint' for name in _all_callback_names]
_null_callback... |
706fb348cf1b8009930f1ea0b22c0f7ae5c6d07ef047b760c03babba4bbdae0e | Python | 13,263 | 455 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 24 13:27:45 2020
@author: joshs
"""
# %%%
import os
import numpy as np
import xarray as xr
import pandas as pd
import matplotlib.pyplot as plt
from scipy.ndimage.filters import gaussian_filter1d
from scipy.ndimage.filters import gaussian_filter... |
aeb0fb1918ec84446cfe31d404ab36f7a18021b6da8646e615578affa61182dd | Python | 13,286 | 293 | # Care starting grid!!
"""
Author: "Keitaro Yamashita, Garib N. Murshudov"
MRC Laboratory of Molecular Biology
This software is released under the
Mozilla Public License, version 2.0; see LICENSE.
"""
from __future__ import absolute_import, division, print_function, generators
import os
import gemmi
import numpy
i... |
9bc30d9592b25e8d9f6a4668336e49b5f28b054059b97a705cae5de605ad37e2 | Python | 13,293 | 348 | """Numerical-correctness tests for the Morlet wavelet kernel.
These are *hand-coded ground-truth* tests, not regression tests
against a frozen baseline. They assert mathematical properties the
wavelet output must satisfy regardless of the underlying numpy /
scipy / FFTW version: a pure sinusoid at frequency ``f0`` sho... |
4a90f224ac0fec287aee33797ef06e6bdc7a9c36bc6d550886b3049bbff85839 | Python | 13,294 | 327 | import pyprind
from pathlib import Path
import numpy as np
import time
import sys
import torch
import torch.nn as nn
from torch.utils.data import TensorDataset, DataLoader
from torch.utils.data.dataset import random_split
from torch.utils.tensorboard import SummaryWriter
from torch.optim.lr_scheduler import MultiStepL... |
d5b2727b8f46cc872362a3889bd9bcae7d625792438a0737186336bb0fccab07 | Python | 13,297 | 345 | """
Author: "Keitaro Yamashita, Garib N. Murshudov"
MRC Laboratory of Molecular Biology
This software is released under the
Mozilla Public License, version 2.0; see LICENSE.
"""
from __future__ import absolute_import, division, print_function, generators
import gemmi
import numpy
import copy
import scipy.optimize
... |
cc405b125ae468c146dec50ce327921aea8a5ec1c15e0b5b36bffde04fc7a2d8 | Python | 13,304 | 430 | # coding: utf-8
"""
Test the convergence of the optical flow methods available in
pySTEPS using idealized motion fields.
To test the convergence, using an example precipitation field we will:
- Read precipitation field from a file
- Morph the precipitation field using a given motion field (linear or rotor) to
gene... |
a4c65bde1ae7811adfeda67852588b9d80f64625ff0fba6ca0ff15f84fbade56 | Python | 13,342 | 472 | #!/usr/bin/env python3
import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from baycomp import two_on_single
from etspredict.prediction.scoring_utils import compare_propabilites
# ------------------------------------------------------------------... |
7e3186118fe4005b9a6ff739836edba2279ed2dda35f95369bfcbd5af4d1fac5 | Python | 13,344 | 330 | from matplotlib.animation import ImageMagickBase
import torch
from torch import nn
from torchvision.models import inception_v3
import cv2
import multiprocessing
import numpy as np
import glob
import os
from scipy import linalg
import warnings
from torch.optim import Adam
from torch.utils.data import DataLoader
from tor... |
35ea2488b300f2601487ffc34635abd97814c732be4ea9825ab5a82126b2ad27 | Python | 13,346 | 260 | """
Author: zheng zhang
Email: musevr.ae@gmail.com
"""
import torch
from torch import nn
class WTFTP_AttnRemoved(nn.Module):
def __init__(self, n_inp, n_oup, n_embding=128, n_encoderLayers=4, n_decoderLayers=4, proj='linear', activation='relu', maxlevel=1, en_dropout=0,
de_dropout=0, steps=None):
... |
91094ccb54a743b7e70f38431c7e330e750ce4f575d49ba34153b16829bb5622 | Python | 13,347 | 311 | from typing import Final, Optional, Type
import torch
from torch import nn as nn
from torch.nn import functional as F
from ._fx import register_notrace_function
from .config import use_fused_attn
from .pos_embed_sincos import apply_rot_embed_cat
__all__ = ['Attention', 'AttentionRope', 'maybe_add_mask', 'resolve_se... |
ca66e4adbfa6d3c251a5e1310aea6fe9a247715e4f3687fdc6e3e7b66fc809aa | Python | 13,354 | 241 | from . GenomeTrack import GenomeTrack
import numpy as np
from .. utilities import get_length_w
from matplotlib import font_manager
from matplotlib.lines import Line2D
DEFAULT_SCALEBAR_COLOR = 'black'
class ScaleBarTrack(GenomeTrack):
SUPPORTED_ENDINGS = []
TRACK_TYPE = 'scalebar'
OPTIONS_TXT = GenomeTrac... |
08d7e7ce6a9b32d882a5b853886257eab3b32a4fa61f5b65460f93232cecc4f7 | Python | 13,360 | 333 | import logging
import threading
import wx
from cellprofiler_core.utilities.appose import (
environment_exists,
get_environment,
rebuild_environment,
)
from cellprofiler_core.utilities.core.plugins import (
classify_plugin_directory,
get_official_plugins_directory,
official_plugins_repo_exists,... |
9052d4e5b37a82d5dc522302978ef1498fd939bca52b2704ea938b6113c75cea | Python | 13,377 | 326 | import importlib
from pathlib import Path
import pytest
from click import BaseCommand
from click.testing import CliRunner
from typing import Callable, Iterable, Any, Mapping, Optional, List, Union
import inspect
from dataclasses import dataclass
import sys
import shlex
import os
import shutil
from unittest.... |
f07dedbab91e6668d52a98c72f594ad823ee714e1aa508de6be8706f4081bff5 | Python | 13,386 | 344 | """
MeasureObjectOverlap
====================
**MeasureObjectOverlap** calculates how much overlap occurs between
objects.
This module calculates object overlap by determining a set of statistics
that measure the closeness of an object to its true value. One
object is considered the “ground truth” (possibly the resul... |
127a4a410bd1fc5445dd8783d154d4be47131ffdc1ac79a7cf3e8d32f7042107 | Python | 13,388 | 349 | """ PyTorch impl of LaProp optimizer
Code simplified from https://github.com/Z-T-WANG/LaProp-Optimizer, MIT License
Paper: LaProp: Separating Momentum and Adaptivity in Adam, https://arxiv.org/abs/2002.04839
@article{ziyin2020laprop,
title={LaProp: a Better Way to Combine Momentum with Adaptive Gradient},
author... |
6a7576c4b802184f6d6ff2059fee52bb9038c2de7185fdb2aa6cec315616fd06 | Python | 13,400 | 372 | import numpy as np
from cellprofiler_library.functions.segmentation import convert_dense_to_label_set
from cellprofiler_library.functions.segmentation import convert_sparse_to_ijv
from cellprofiler_library.functions.segmentation import indices_from_ijv
from cellprofiler_library.functions.segmentation import count_from... |
9adef7347383d21686eb9ba74714030f81e8ffaf8f7c8a81f202c83efd6efda8 | Python | 13,407 | 241 | import os
import numpy as np
import pandas as pd
import nibabel as nib
from sklearn.linear_model import Ridge
from os.path import join as pjoin
from nilearn.glm.first_level import make_first_level_design_matrix
from nod_utils import save2cifti, add_poly_drift, add_motion_var
# define path
dataset_path = '/nfs/z1/userh... |
32cd87f50f69b5197fb63428c079d515745533cf822cf2738d33d0b5fa9a8595 | Python | 13,419 | 335 | from ._setting import Setting
from ._validation_error import ValidationError
class Measurement(Setting):
"""A measurement done on a class of objects (or Experiment or Image)
A measurement represents a fully-qualified name of a measurement taken
on an object. Measurements have categories and feature names... |
00e1c169a9ebaef10c14275df4dcc847b7256f297c4dd43e21a53b341ef26770 | Python | 13,464 | 374 | import numpy
import six.moves
import os
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler.modules.graytocolor
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
import tests.frontend.modules
from cellprofiler_library.opts.graytoc... |
5d7dadf0a5b8ac765e8657a97dd4a8a318ac101acfa8c2ba724c2b51abf3a8b1 | Python | 13,466 | 338 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
2cb410c53d5ba0d5ce4d08f37d71a70cce05d9f4b051ea1d180fccbe4d150140 | Python | 13,475 | 332 | # -*- coding: utf-8 -*-
"""
pysteps.visualization.animations
================================
Functions to produce animations for pysteps.
.. autosummary::
:toctree: ../generated/
animate
"""
import os
import warnings
import matplotlib.pylab as plt
import pysteps as st
PRECIP_VALID_TYPE... |
923751ce20f44b02d50a2b51b3476bd1c6d0e83c67607f1c9f64c67b726d9433 | Python | 13,479 | 525 | # -*- coding: utf-8 -*-
import matplotlib as mpl
from matplotlib.testing.compare import compare_images
from tempfile import NamedTemporaryFile
import os.path
import pygenometracks.plotTracks
from pygenometracks.utilities import InputError
mpl.use('agg')
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)),
... |
79d978fc3916f23db7740aa9fda59823ac73bae367b3803eff9da15484dad031 | Python | 13,482 | 466 | #!/usr/bin/env python3
import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from baycomp import two_on_single
from etspredict.prediction.scoring_utils import compare_propabilites
####################################################################... |
4ab4234ec03e2eac70c10777b5fe69328f8152fb7c36d8d40ac4212c5cec6d90 | Python | 13,490 | 331 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# 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 l... |
cfff5c5f3889c649891d208320a4918c9a974fed1a8bcda2cc005df1940bbe5c | Python | 13,490 | 362 | import numpy as np
import torch
import os
import torch.nn.functional as F
import torch.distributed as dist
from utils.parallel import get_dist_info
from utils.display import display_metrics_dict
from utils.evaluation import AverageMeter, accuracy, fuzziness
class NCSSLRunner:
"""The runner for Checking Neural C... |
7c1c59b2407923c6cdf24dc467d3bf413966fb5005423d37e4ae004b40b1d93a | Python | 13,503 | 330 | import logging
from copy import deepcopy
from os import makedirs
from os.path import join, exists
from posixpath import abspath
import numpy as np
import pandas as pd
import scipy.sparse
import yaml
from matplotlib import pyplot as plt
###solve RuntimeError: Invalid DISPLAY variable###
plt.switch_backend('agg')
from s... |
c1c13c242a8eecffbc07efa7133c1c745302162999e859866938891fe2b3cbc4 | Python | 13,504 | 272 | """
ClinicalASL - Clinical Arterial Spin Labeling processing pipeline
Main pipeline script for processing ASL MRI data.
Repository: https://github.com/JSIERO/ClinicalASL
Author: Jeroen Siero
Institution: UMCU (University Medical Center Utrecht), The Netherlands
Contact: j.c.w.siero@umcutrecht.nl
Description:
Thi... |
ba7fdf5f71ba160e39f55e8f82be1aa5a01c5d5b1943fc5c5bcac8aa457d1c1c | Python | 13,508 | 453 | from __future__ import absolute_import
from __future__ import print_function
import warnings
import numpy as np
from numpy import linspace
from scipy.ndimage import affine_transform
"""Automatically determine whether background is darker than foreground"""
MODE_AUTO = "auto"
"""Background is darker than foreground""... |
a258743b4c8094bef8ec0d75ae2378e1908e52d62a3d14760cf7ba3269adfea0 | Python | 13,509 | 222 | """
Select appropriate clusters.
@author: bartulem
"""
import os
import re
import sys
import pickle
import json
import pandas as pd
class ClusterFinder:
probe_site_areas = {'bruno': {'distal': {'CaPu': [(0, 20)],
'WhMa': [(20, 49)],
... |
d76e75bd4a0b23651fbc182c8a3fc7faf1c19d4cc9f307fd3cb226a47ba88570 | Python | 13,513 | 460 | ## TODO SEP 08 VERSION
"""This module implements an abstract base class (ABC) 'BaseDataset' for datasets.
It also includes common transformation functions (e.g., get_transform, __scale_width), which can be later used in subclasses.
"""
import random
import numpy as np
import torch.utils.data as data
from scipy.ndimag... |
f53dba46e3b5abb7af5a46df200973bb6613e6ed90a405cbaa60cd8cae8b04c6 | Python | 13,536 | 382 | # JHK
# Python script for generating Figure 2.
from netCDF4 import Dataset
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from mpl_toolkits.basemap import Basemap, cm
from pylab import *
from scipy import stats
import os, pathlib
#==========================================================... |
1409f41925dd5578ed96b97846e0f9d87b3d381e91f43d232547128547a663b4 | Python | 13,544 | 382 | # JHK
# Python script for generating Figure 2.
from netCDF4 import Dataset
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from mpl_toolkits.basemap import Basemap, cm
from pylab import *
from scipy import stats
import os, pathlib
#==========================================================... |
76680a5fac81d50a31186822343a867219bbf9212a8cddbc066a58d4443c6b9a | Python | 13,545 | 330 | # Copyright (c) OpenMMLab. All rights reserved.
from numbers import Number
import copy
import numpy as np
import torch
from torch.nn.functional import one_hot
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
with torch.no_grad():
maxk = max(topk)
... |
03ab2a6bb7e994557e5779be3fac362872650eba7da4ce1ad704efb043605dd7 | Python | 13,556 | 284 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data
import models
from tqdm import tqdm
from torch.autograd import Variable
from tensorboardX import SummaryWriter
import os
import sys
from torch import set_default_t... |
55eab5df630acf7fd834111d9ad84298553508a3463b83476eaf2e80279960d9 | Python | 13,556 | 255 | import torch
from matplotlib import pyplot as plt
from torch import nn
from lib.datasets.gendostroke import GENDOSTROKE
from lib.models import GFCN, GFCNA, GFCNB, GFCNC, GFCND, GFCNE, GFCNF, GFCNG, PointNet, UNet, FCN
from lib.process import Trainer, Evaluator, KTrainer, KEvaluator, DCS, TrainingDir
from lib.process.l... |
4d245e838c47f8e78ce293b864dad908e35cd7c9db3151f7e2b105fb9da56a32 | Python | 13,557 | 317 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
3ed1b89b06ea9c32b66425549e0bebe3c32e553cc8d0d47dcaa6a41c5ad00eef | Python | 13,565 | 425 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2022 Pawan Goyal
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 th... |
b56aa839f5f2633d8eaa54f0f21fc7fd17302d8518e360193927ebb28fe667bf | Python | 13,565 | 402 | import pandas as pd
import sys
import numpy as np
from lib.thermodynamic_constants import *
import os
sys.path.append(os.path.join(os.getcwd(), 'Modules'))
import lib.util
from scipy.stats import scoreatpercentile
import matplotlib.pyplot as plt
import random
#global variable
#ATP_ADP_GFE = 208.44 #kcal/mol
#NAD_NADH... |
47a80208801af103c4fc05bb8f1e4ec4df3082b01dc790c3c175f6408ec72206 | Python | 13,584 | 368 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
923c4d37c43664a92c0d68ca5482237d16780a2849db17392680ab6e47ef2bf7 | Python | 13,611 | 370 | import centriole.cpmorphology
import numpy
import cellprofiler_core.image
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
import cellprofiler.modules.flipandrotate
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspa... |
f58e5ec5b97e1b993998b0150669a608100848e5f249c280fe1ace3354badf60 | Python | 13,618 | 414 | from __future__ import annotations
import copy
import gzip
import hashlib
import importlib.util
import json
import sys
import threading
from dataclasses import dataclass, field
from http import HTTPStatus
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from typing import An... |
83b0056be4906993d527d977d4ea4b577243b6cd1b4e49a2c9dacf56a1aac212 | Python | 13,631 | 372 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
03eff567ee206ee2a1920a18eac35fac159a4405d0391b6cae54d3a0625f708e | Python | 13,638 | 425 | """Tests for the CPU implementation of multi-target."""
# pylint: disable=too-many-arguments,too-many-positional-arguments
# pylint: disable=missing-function-docstring
import json
from typing import Any, Callable, Dict
import numpy as np
import pytest
from hypothesis import given, note, settings, strategies
import x... |
17381fb6a017412f3f88cc3d93a3878e2754a9fa3dc645cbb268eb7ce8556824 | Python | 13,678 | 400 | import numpy
import six.moves
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
import tests.frontend.modules
from cellprofiler.modules.makeprojection import MakeProjection
from cellprofiler_librar... |
332b1ea18560c581c957a148341cb1652eaefa652b06424f3086c00cff51a113 | Python | 13,683 | 361 | import glob
import importlib
import importlib.util
import inspect
import logging
import os
import re
import shutil
import sys
import tempfile
import traceback
import zipfile
import requests
from cellprofiler_core.constants.modules import all_modules
from cellprofiler_core.constants.modules import pymodules
from cellp... |
34903c756cf8d92a7fce529646de8620d1f5bac374dc47cba2666e7738225033 | Python | 13,725 | 442 | import os
from datetime import timedelta
import numpy as np
import pytest
from pysteps import io, motion, nowcasts, utils, verification
from pysteps.tests.helpers import get_precipitation_fields
steps_arg_names = (
"n_ens_members",
"n_cascade_levels",
"ar_order",
"mask_method",
"probmatching_meth... |
a5e78942d037efc1f6e1913b99d71a0dc9c45bb19dc98934515e3fa85bcd30ea | Python | 13,730 | 466 | import os
from . import Library
from . import Database as db
from . import FASTQ_File
from . import Alignment
from pepars.fileio import csv_wrapper
from pepars.utils import FASTQ_File as FASTQ_File_Reader
from pepars.utils import FASTQ_File_Set
from pepars.alignment import Aligner
from pepars.alignment.Perfect_Match_A... |
eea95e2f73f1500719dfb2d023d5968bc5ae919fd08ed43c53e5f69158b78c5e | Python | 13,730 | 380 | from typing import List, Optional, Type, Union
import torch
from torch import nn as nn
from torch.nn import functional as F
from .config import use_fused_attn
from .create_conv2d import create_conv2d
from .helpers import to_2tuple
from .pool2d_same import create_pool2d
class MultiQueryAttentionV2(nn.Module):
""... |
b18475baad75ffd43c89ea0a50206646e460c41f032c5767d631fc883bb1b8a1 | Python | 13,737 | 233 | """This script estimates TRFs for several models and saves them"""
from pathlib import Path
import re
import os
import eelbrain
import mne
import trftools
from utils_TRF_time_lagged import make_source_space
import numpy as np
DATA_ROOT = Path('/project/3027007.02/Scripts_for_publication').expanduser()
language = 'Dut... |
716922c7548178e70c38bfd5ec36a632042664ad8e2b6a2d6ee6265341ba0c64 | Python | 13,741 | 359 | """
MakeProjection
==============
**MakeProjection** combines two or more two-dimensional images of the same
field of view into a single two-dimensional image.
This module combines a set of images by performing a mathematical
operation of your choice at each pixel position; please refer to the
settings help for more i... |
263ef4682dcbd39ad6f081f975f08c54102306d27c09f5070e60a48649962a56 | Python | 13,746 | 308 | import os
import pkg_resources
from tempfile import mkdtemp, mkstemp
import shutil
import logging
import numpy
import h5py
from nose.tools import ok_, eq_
import pdb2sql
from deeprank.operate import hdf5data
from deeprank.generate.GridTools import GridTools
from deeprank.generate.DataGenerator import DataGenerator
fr... |
ba52d035bd2e08315259e6526df7f81c772c695ccb85c0e489ab3a49ded5e826 | Python | 13,751 | 474 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
24df9b35e9dd71c1b845426e8f97b534157073c5463525fb22fd0ab4079815cd | Python | 13,767 | 411 | from typing import List, Tuple, Union
import numpy as np
import pytest
import xgboost as xgb
from xgboost import testing as tm
from xgboost.testing.metrics import (
check_expectile_error,
check_precision_score,
check_quantile_error,
run_pr_auc_binary,
run_pr_auc_ltr,
run_pr_auc_multi,
run_... |
6255de726ec4ba5a32ff26fd4491846e8eb4dd2dcbad613665ff448e5e15e3f7 | Python | 13,767 | 449 | # -*- coding: utf-8 -*-
import os
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal
import pysteps
from pysteps.blending.utils import (
blend_cascades,
blend_optical_flows,
compute_smooth_dilated_mask,
compute_store_nwp_motion,
decompose_NWP,
load_NWP,
r... |
a200c741d08355b7e4c88d95e6d1017052d082fa79250aeed519d9dd89721f20 | Python | 13,812 | 321 | """
Author: "Keitaro Yamashita, Garib N. Murshudov"
MRC Laboratory of Molecular Biology
This software is released under the
Mozilla Public License, version 2.0; see LICENSE.
"""
from __future__ import absolute_import, division, print_function, generators
import argparse
import gemmi
import numpy
import pandas
impo... |
e72e0e0acfd5f38eb5c7a88c27e44691c73eeb5662912275041f1b5ac02d2a9d | Python | 13,817 | 486 | #!/usr/bin/env python3
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from baycomp import two_on_single
from etspredict.prediction.scoring_utils import compare_propabilites
#############################################################... |
1ad1d581392aa3cf020b23e75c4b9f55ebdb782483dfc4ba0cb0da66319328b9 | Python | 13,832 | 338 | """
INPUT FOR DAMASK 3 from here on!
"""
import damask
import numpy as np
import pandas as pd
import pyvista as pv
import os
import yaml
from dragen.postprocessing import visualization as viz
from dragen.utilities.InputInfo import RveInfo
def write_material(store_path: str, grains: list, angles: pd.DataFrame) -> Non... |
55d03870702d9d0a1d3f68750a7f250d86b2eb5f3845cb133e91798a60e01e8b | Python | 13,835 | 314 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 18:23:18 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
import random
from sklearn.manifold import TSNE
# from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns... |
3c0d34b8206b145fe5ee5f5857306a1752521b9eddc6032f230c2aac577b8c9a | Python | 13,836 | 354 | # -*- coding: utf-8 -*-
"""
pysteps.nowcasts.linear_blending
================================
Linear blending method to blend (ensemble) nowcasts and (ensemble) Numerical
Weather Prediction (NWP) forecasts. The method uses a predefined start and end
time for the blending. Before this start time, the resulting blended ... |
7dc557a99f0acd924e961cfdaf926f9b89cd35bcb105e7c9b38b2d30f5e3b8d7 | Python | 13,853 | 361 | """Provisional registry fetching, parsing, and resolution."""
from __future__ import annotations
import hashlib
import http.client
import json
import re
import urllib.error
import urllib.request
from collections.abc import Mapping, Sequence
from importlib.resources import files
from pathlib import Path
from typing im... |
bad965c6acdc7a8b4b1d32b5738b851233cf82159d72e28f463b8c8b4c2fa34e | Python | 13,856 | 374 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
16b20977f3e0c636fb06872223eb5c50c7e3c2c214a3b26f4261657155e02c69 | Python | 13,864 | 426 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
c130b1b0631a76d0a26f24b2a0c26d3a669609b08994ce7528a2888c239128a6 | Python | 13,894 | 418 | # -*- coding: utf-8 -*-
import numpy
import pytest
import pysteps
def _generic_interface_test(method_getter, valid_names_func_pair, invalid_names):
for name, expected_function in valid_names_func_pair:
error_message = "Error getting '{}' function.".format(name)
assert method_getter(name) == expe... |
f98e56a1e0a8b6262ee55ff23ad1f4c1b7a033efed8e2e48773894c1346b06a3 | Python | 13,910 | 362 | from cellprofiler_core.module import Module
from cellprofiler_core.setting import Binary
from cellprofiler_core.setting.choice import Choice
from cellprofiler_core.setting.subscriber import LabelSubscriber
from cellprofiler_core.setting.text import LabelName, Integer
from cellprofiler_core.setting import Measurement
fr... |
8f2b48d7c54a58cb276f521fde27a0cd8b91c703c2e5cfba1d65e8bf7d43de1b | Python | 13,923 | 363 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
eea9b0a7ae774a1b6ae5350e2d854eb70c43c726e87e86a349d477bab33a11c8 | Python | 13,929 | 341 | import numpy
import cellprofiler_core.image
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import GROUP_INDEX, GROUP_NUMBER, COLTYPE_INTEGER
import cellprofiler.modules.crop
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
from ce... |
ca2288520cffb7d1b1be7ee9dc5ea3864c892f923ab597233de6889962a3ac6a | Python | 13,936 | 478 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
bfe4b9fdade908389f305766ab6c4a349754d34bb16e63108e8e46ee9d915de6 | Python | 13,949 | 315 | #!/usr/bin/env python3
# Copyright 2021 Maria Cervera
#
# 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 o... |
88e990715f73322e9d9ed76906e0dd6e8cd30c6e4469885c3a6733ffed513dc6 | Python | 13,955 | 313 | # -*- coding: utf-8 -*-
''' --------- Imports ----------- '''
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import scipy as sp
from scipy.io import loadmat
import copy
import matplotlib.lines as mlines
from matplotlib.patches import Rectangle
''' --------- Fig. 2 ----... |
9a746b5b356fd881db1c4322fb7d54ac0e57abd37525095514a3d82ed2a39400 | Python | 13,959 | 339 | """ Attention Pool 2D
Implementations of 2D spatial feature pooling using multi-head attention instead of average pool.
Based on idea in CLIP by OpenAI, licensed Apache 2.0
https://github.com/openai/CLIP/blob/3b473b0e682c091a9e53623eebc1ca1657385717/clip/model.py
Hacked together by / Copyright 2021 Ross Wightman
"""... |
5d6e4deb987ffe22fc4630cfa494aaf9c4ca837cf797b0191f4424aa5e74cda9 | Python | 13,976 | 379 | """ RMSProp modified to behave like Tensorflow impl
Originally cut & paste from PyTorch RMSProp
https://github.com/pytorch/pytorch/blob/063946d2b3f3f1e953a2a3b54e0b34f1393de295/torch/optim/rmsprop.py
Licensed under BSD-Clause 3 (ish), https://github.com/pytorch/pytorch/blob/master/LICENSE
References for added functio... |
c551a971a97aeaa177d434ab8a3585c56470cca614dac2f56fbba46b725f4f03 | Python | 13,987 | 335 | # -*- coding: utf-8 -*-
"""
molvs.standardize
~~~~~~~~~~~~~~~~~
This module contains the main :class:`~molvs.standardize.Standardizer` class that can be used to perform all
standardization tasks, as well as convenience functions like :func:`~molvs.standardize.standardize_smiles` for common
standardization tasks.
"""
... |
8f5cc67c9597b0c73d6258b29594ebb1afc5c9fd1ac930abe502da04b4649b2a | Python | 13,992 | 428 | import itertools
import json
import os
import shutil
from typing import Optional
import numpy as np
import pytest
from hypothesis import given, note, settings
from scipy.sparse import csr_matrix
import xgboost
from xgboost import testing as tm
from xgboost.testing.data import RelDataCV, make_ltr, simulate_clicks, sor... |
1070b6201e93551b2936f484651aa9035c1aaf786a8d42c51ae8e8a9e540b8f3 | Python | 13,995 | 249 | """
ClinicalASL - Clinical Arterial Spin Labeling processing pipeline
Repository: https://github.com/JSIERO/ClinicalASL
Author: Jeroen Siero
Institution: UMCU (University Medical Center Utrecht), The Netherlands
Contact: j.c.w.siero@umcutrecht.nl
Description:
This script saves CBF, AAT, ATA, and CVR results for ... |
0aabc7feaa45e1a8a6ecf2f80440858abc6bc2bedafd42c174823b117d5ef1b2 | Python | 14,031 | 457 | """
@author: Nikolai M Chapochnikov
Created in 2022
"""
import numpy as np
from scipy import linalg as LA
from functions.nmf import get_init_matrix
from functions.general import rectify, FLOAT_TYPE, EPSILON
from typing import Tuple
def mat_mul(A, B, alpha=1):
"""
https://www.benjaminjohnston.com.au/matmul
... |
09439f62967a585d364dc1fba33b227bc597f5852dbf752e745b88f7c965c6fd | Python | 14,037 | 397 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils import data
from torch.utils.data import SequentialSampler
from torch import nn
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from time import time
from sklearn.metrics impo... |
f3c0d5ddeed3c334a4c55c6f8fefd1ed2c56cbd7b91b85a97c1c0f6308deb704 | Python | 14,044 | 332 | import torch
import random
from .default import NormalNN
class L2(NormalNN):
"""
@article{kirkpatrick2017overcoming,
title={Overcoming catastrophic forgetting in neural networks},
author={Kirkpatrick, James and Pascanu, Razvan and Rabinowitz, Neil and Veness, Joel and Desjardins, Guillaume and... |
88188ef5f8905f69383f89cb17b869996491b5286386e0b3e78cb259f16b0b8e | Python | 14,067 | 332 | import torch
import random
from .default import NormalNN
class L2(NormalNN):
"""
@article{kirkpatrick2017overcoming,
title={Overcoming catastrophic forgetting in neural networks},
author={Kirkpatrick, James and Pascanu, Razvan and Rabinowitz, Neil and Veness, Joel and Desjardins, Guillaume and... |
b23ce289faca70c4b7214e207e77a48cdef469afc6ebd5984a05dce87168c681 | Python | 14,074 | 408 | import datetime
import argparse
import numpy as np
import pandas as pd
import itertools
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint
from rdkit import Chem
from rdkit.Chem import A... |
0937301c1ffd8bab174e7482cdfe356214ad10c4f6525011782bd69c2f6a1a37 | Python | 14,090 | 374 | #!/usr/bin/env python
import logging
import sys
import os
import gzip
from argparse import ArgumentParser
from threading import Thread
from math import isnan
from glob import glob
import traceback
from time import time
import torch.cuda
from typing import Dict, Set, Optional
import numpy
import pandas
import csv
from... |
61b24b431c6ffd2c7427ed7b7c40056681018ae80613b2b2715898227ea1f0e1 | Python | 14,095 | 367 | # JHK
# Python script for generating Figure 1
# Also, ED Figures 3 and 4 are based on this script.
from netCDF4 import Dataset
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
#==========================================================
# Set main directory
#========================================... |
6a86d2e41288e9770ece0ada46349f90683ab78af3edd644d9f819d376ececc6 | Python | 14,095 | 386 | import io
import os
import numpy
import cellprofiler_core.constants.measurement
import cellprofiler_core.measurement
import cellprofiler_core.modules.groups
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
import tests.core
def get_data_directory():
folder = os.path.dirname(tests.core.__file... |
df14929f99207233b82ea9e6b4e6ed2ad95024abe008595ab68eded99e328da0 | Python | 14,098 | 376 | # Pytorch Tabular
# Author: Manu Joseph <manujoseph@gmail.com>
# For license information, see LICENSE.TXT
"""Mixture Density Models"""
import logging
import math
from abc import ABCMeta
from typing import Dict, Optional
import torch
import torch.nn as nn
from omegaconf import DictConfig
from torch import Tensor
from t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.