repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
klayout | klayout-master/src/lay/lay/salt_templates/python_lib/python/new_object.py | class NewSampleLibraryClass(object):
def __init__(self):
# TODO: add your code here
pass
| 101 | 13.571429 | 36 | py |
klayout | klayout-master/macbuild/build4mac_util.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#========================================================================================
# File: "macbuild/build4mac_util.py"
#
# Here are utility functions and classes ...
# for building KLayout (http://www.klayout.de/index.php)
# version 0.26.1 or later on different... | 25,604 | 45.135135 | 146 | py |
klayout | klayout-master/macbuild/nightlyBuild.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import shutil
import glob
import platform
import optparse
import subprocess
#------------------------------------------------------------------------------
## To test if the platform is a member of valid platforms
#
# @param[in] platforms valid ... | 27,286 | 41.70266 | 123 | py |
klayout | klayout-master/macbuild/build4mac.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#===============================================================================
# File: "macbuild/build4mac.py"
#
# The top Python script for building KLayout (http://www.klayout.de/index.php)
# version 0.26.1 or later on different Apple Mac OSX platforms.
#===========... | 88,786 | 46.479679 | 145 | py |
klayout | klayout-master/macbuild/makeDMG4mac.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#=============================================================================================
# File: "macbuild/makeDMG4mac.py"
#
# Python script for making a DMG file of KLayout (http://www.klayout.de/index.php) bundle.
#
# This is a derivative work of Ref. 2) below.... | 34,291 | 41.598758 | 129 | py |
klayout | klayout-master/macbuild/build4mac_env.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#===============================================================================
# File: "macbuild/build4mac_env.py"
#
# Here are dictionaries of ...
# different modules for building KLayout (http://www.klayout.de/index.php)
# version 0.26.1 or later on different Apple... | 21,938 | 51.485646 | 177 | py |
klayout | klayout-master/macbuild/macQAT.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#===============================================================================
# File: "macbuild/macQAT.py"
#
# The top Python script to run "ut_runner" after building KLayout
# (http://www.klayout.de/index.php) version 0.26.1 or later on different Apple
# ßMac OSX p... | 10,510 | 37.643382 | 115 | py |
klayout | klayout-master/macbuild/python3HB.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#==============================================================================
# File: macbuild/python3HB.py
#
# Descriptions: A handy tool to setup the standardized directory structures
# for Homebrew's Python 3.x
#========================================... | 6,402 | 35.588571 | 102 | py |
klayout | klayout-master/macbuild/Resources/start-console.py | #!/Applications/klayout.app/Contents/MacOS/klayout -b -r
import readline
import code
import sys
import os
pwd = os.getcwd()
sys.path.append(pwd)
variables = globals().copy()
variables.update(locals())
shell = code.InteractiveConsole(variables)
cprt = 'Type "help", "copyright", "credits" or "license" for more informati... | 519 | 29.588235 | 79 | py |
klayout | klayout-master/scripts/stubgen.py | """ Stub file generation routines.
This module contains routines to generate stub files from klayout's python API.
This uses the `tl` module of the API, which offers an introspection layer to
the C-extension modules.
"""
from collections import Counter
from copy import copy
from dataclasses import dataclass, field
fr... | 14,620 | 30.042463 | 94 | py |
klayout | klayout-master/scripts/pyqrc.py |
# A lean substitute for QRC which is employed in the non-Qt case
import xml.etree.ElementTree as et
import argparse
import zlib
import os
# A class providing the generator
class RCFile(object):
def __init__(self, alias, path):
self.path = path
self.alias = alias
def write(self, file, index):
f =... | 4,002 | 24.825806 | 112 | py |
klayout | klayout-master/testdata/pymod/import_QtSql.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,321 | 29.744186 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtSvg_Qt6.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,413 | 29.73913 | 76 | py |
klayout | klayout-master/testdata/pymod/import_rdb.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,415 | 29.782609 | 76 | py |
klayout | klayout-master/testdata/pymod/issue1327.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 968 | 32.413793 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtCore.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,539 | 29.8 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtXml.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,630 | 30.980392 | 81 | py |
klayout | klayout-master/testdata/pymod/import_QtDesigner.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,396 | 30.75 | 76 | py |
klayout | klayout-master/testdata/pymod/testprep.py |
import os
# Whatever drove these people to drop PATH support for Windows in Python 3.8 (bpo-36085)
# they at least had mercy and let us emulate PATH through os.add_dll_directory.
external_dll_path = os.getenv("KLAYOUT_PYMOD_DLL_PATH")
if ("add_dll_directory" in os.__dict__) and external_dll_path is not None:
for p... | 390 | 31.583333 | 88 | py |
klayout | klayout-master/testdata/pymod/import_QtPrintSupport.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,474 | 31.065217 | 76 | py |
klayout | klayout-master/testdata/pymod/import_tl.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,441 | 29.041667 | 76 | py |
klayout | klayout-master/testdata/pymod/import_lay.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,919 | 28.538462 | 76 | py |
klayout | klayout-master/testdata/pymod/import_db.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,807 | 30.719298 | 81 | py |
klayout | klayout-master/testdata/pymod/import_QtGui_Qt6.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,956 | 27.779412 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtXmlPatterns.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,351 | 30.44186 | 76 | py |
klayout | klayout-master/testdata/pymod/pya_tests.py |
import sys
import os
import unittest
import testprep
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "python"))
# Include all tests from testdata/python
# Missing:
# - basic.py (Test classes not available yet)
# - qtbinding (No applicable because QApplication is missing)
import tlTest
import db... | 1,771 | 36.702128 | 107 | py |
klayout | klayout-master/testdata/pymod/import_QtWidgets_Qt6.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,570 | 31.061224 | 76 | py |
klayout | klayout-master/testdata/pymod/bridge.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,588 | 31.428571 | 93 | py |
klayout | klayout-master/testdata/pymod/import_QtGui.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,483 | 29.285714 | 76 | py |
klayout | klayout-master/testdata/pymod/import_lib.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,398 | 30.088889 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtNetwork.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,431 | 30.822222 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtCore5Compat.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,391 | 30.636364 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtSvg.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,442 | 30.369565 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtUiTools.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,386 | 30.522727 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtWidgets.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,638 | 27.754386 | 76 | py |
klayout | klayout-master/testdata/pymod/import_QtMultimedia.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,422 | 30.622222 | 76 | py |
klayout | klayout-master/testdata/python/dbReaders.py | # encoding: UTF-8
# KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option)... | 5,675 | 30.186813 | 76 | py |
klayout | klayout-master/testdata/python/dbLayoutVsSchematic.py |
# encoding: UTF-8
# KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option... | 6,120 | 32.266304 | 157 | py |
klayout | klayout-master/testdata/python/dbPolygonTest.py | # encoding: UTF-8
# KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option)... | 35,430 | 45.866402 | 437 | py |
klayout | klayout-master/testdata/python/tlTest.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 8,488 | 36.396476 | 149 | py |
klayout | klayout-master/testdata/python/dbNetlistCrossReference.py |
# encoding: UTF-8
# KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option... | 6,397 | 33.031915 | 130 | py |
klayout | klayout-master/testdata/python/dbLayoutTest.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 38,842 | 31.477425 | 107 | py |
klayout | klayout-master/testdata/python/dbLayoutToNetlist.py | # encoding: UTF-8
# KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option)... | 28,218 | 37.762363 | 172 | py |
klayout | klayout-master/testdata/python/layLayers.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 35,132 | 35.219588 | 155 | py |
klayout | klayout-master/testdata/python/layPixelBuffer.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 1,908 | 27.492537 | 76 | py |
klayout | klayout-master/testdata/python/qtbinding.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 18,147 | 26.538695 | 207 | py |
klayout | klayout-master/testdata/python/dbRegionTest.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 2,887 | 30.736264 | 93 | py |
klayout | klayout-master/testdata/python/dbTransTest.py | # encoding: UTF-8
# KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option)... | 25,960 | 42.268333 | 134 | py |
klayout | klayout-master/testdata/python/basic.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 92,107 | 28.493436 | 140 | py |
klayout | klayout-master/testdata/python/dbPCells.py | # KLayout Layout Viewer
# Copyright (C) 2006-2023 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.... | 20,465 | 39.526733 | 146 | py |
klayout | klayout-master/testdata/bd/strmrun.py | import pya
print("Hello, world " + str(pya.DBox(0, 0, 42, -42)) + "!")
| 71 | 23 | 59 | py |
klayout | klayout-master/testdata/klayout_main/test.py |
print("Variable v1="+str(v1)+" v2="+str(v2))
| 47 | 11 | 44 | py |
klayout | klayout-master/testdata/lym/m2.py |
import os
import inspect
def lineno():
return inspect.currentframe().f_back.f_lineno
print("Stop 1: " + os.path.basename(pya.Macro.real_path(__file__, lineno())) + ":" + str(pya.Macro.real_line(__file__, lineno())))
# %include a_inc.py
print(f())
print("Stop 2: " + os.path.basename(pya.Macro.real_path(__file__,... | 387 | 23.25 | 130 | py |
klayout | klayout-master/testdata/lym/a_inc.py |
import os
def f():
return("f: " + os.path.basename(pya.Macro.real_path(__file__, lineno())) + ":" + str(pya.Macro.real_line(__file__, lineno())))
| 151 | 20.714286 | 128 | py |
klayout | klayout-master/testdata/lym/m1.py |
print("Hello, world!")
| 24 | 7.333333 | 22 | py |
brain_sas_baseline | brain_sas_baseline-main/download_data.py | import argparse
from glob import glob
import os
import shutil
import zipfile
import nibabel as nib
import numpy as np
from tqdm import tqdm
from utils.data_utils import DATAROOT
from utils.registrator import MRIRegistrator
from utils.robex import strip_skull_ROBEX
class BraTSHandler():
def __init__(self, args):... | 19,146 | 35.96332 | 110 | py |
brain_sas_baseline | brain_sas_baseline-main/baseline.py | import argparse
from multiprocessing import Pool
import os
from time import time
import matplotlib.pyplot as plt
import numpy as np
import torch
from torch.utils.data import Dataset
from utils.data_utils import DatasetHandler, load_mr_scan
from utils import evaluation, utils
class DataPreloader(Dataset):
def __... | 4,617 | 34.79845 | 96 | py |
brain_sas_baseline | brain_sas_baseline-main/utils/registrator.py | import multiprocessing
import os
from time import time
import SimpleITK as sitk
from dipy.align.imaffine import AffineMap
from dipy.align.imaffine import (
AffineRegistration,
MutualInformationMetric,
transform_centers_of_mass,
)
from dipy.align.transforms import (
AffineTransform3D,
RigidTransform... | 13,490 | 34.976 | 114 | py |
brain_sas_baseline | brain_sas_baseline-main/utils/utils.py | import matplotlib.pyplot as plt
import numpy as np
from skimage.exposure import equalize_hist
from skimage.measure import label, regionprops
import torch
import torch.nn.functional as F
from torchvision.utils import make_grid, save_image
from tqdm import tqdm
""" General utilities """
def torch2np_img(img: torch.Ten... | 4,772 | 28.103659 | 79 | py |
brain_sas_baseline | brain_sas_baseline-main/utils/data_utils.py | from glob import glob
import os
import nibabel as nib
import numpy as np
import torch
from torchvision.datasets.folder import IMG_EXTENSIONS
from warnings import warn
from utils.utils import CenterCrop3D, ResizeGray, histogram_equalization
DATAROOT = str(os.environ.get('DATAROOT'))
DICOM_EXT = ('.dcm', )
NIFTI_EXT ... | 5,620 | 31.304598 | 108 | py |
brain_sas_baseline | brain_sas_baseline-main/utils/evaluation.py | import warnings
import matplotlib.pyplot as plt
import numpy as np
from skimage import measure
from sklearn.metrics import auc, precision_recall_curve, roc_auc_score, roc_curve
import torch
from tqdm import tqdm
from torchvision.utils import make_grid
from utils.utils import connected_components_3d, torch2np_img
de... | 11,908 | 34.655689 | 118 | py |
brain_sas_baseline | brain_sas_baseline-main/utils/robex.py | import multiprocessing
import os
import subprocess
from time import time
from utils.data_utils import DATAROOT
import numpy as np
def strip_skull_ROBEX(paths, out_dir=None, num_cpus=None):
"""Use ROBEX to strip the skull of a T1 weighted brain MR Image. Takes ~100s
DOES NOT WORK PROPERLY FOR T2 WEIGHTED IMA... | 2,393 | 33.2 | 96 | py |
jpf-bmc | jpf-bmc-master/configEx.py | import os
import subprocess
import glob
z3 = 'z3=' + subprocess.Popen(['which', 'z3'], stdout=subprocess.PIPE).stdout.readline()
def editPath(conf):
with open(conf,'r') as f:
newlines = []
for line in f.readlines():
if 'z3=' in line:
line = z3
newlines.append(line)
with open(conf, 'w') as f:
... | 598 | 18.322581 | 88 | py |
fastdtw | fastdtw-master/setup.py | import os.path
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext as _build_ext
import sys
import warnings
try:
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
# numpy path is needed for building with and wi... | 2,556 | 28.390805 | 99 | py |
fastdtw | fastdtw-master/tests/test_fastdtw.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import unittest
import numpy as np
from fastdtw._fastdtw import fastdtw as fastdtw_c
from fastdtw._fastdtw import dtw as dtw_c
from fastdtw.fastdtw import fastdtw as fastdtw_p
from fastdtw.fastdtw import dtw as dtw_p
cl... | 2,038 | 32.983333 | 74 | py |
fastdtw | fastdtw-master/fastdtw/fastdtw.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import numbers
import numpy as np
from collections import defaultdict
try:
range = xrange
except NameError:
pass
def fastdtw(x, y, radius=1, dist=None):
''' return the approximate distance between 2 time serie... | 5,627 | 29.421622 | 78 | py |
fastdtw | fastdtw-master/fastdtw/__init__.py | try:
from ._fastdtw import fastdtw, dtw
except ImportError:
from .fastdtw import fastdtw, dtw
| 102 | 19.6 | 38 | py |
clinicalBERT | clinicalBERT-master/lm_pretraining/format_mimic_for_BERT.py | import psycopg2
import pandas as pd
import sys
import spacy
import re
import stanfordnlp
import time
import scispacy
from tqdm import tqdm
from heuristic_tokenize import sent_tokenize_rules
# update these constants to run this script
OUTPUT_DIR = '/PATH/TO/OUTPUT/DIR' #this path will contain tokenized notes. This di... | 4,036 | 28.683824 | 153 | py |
clinicalBERT | clinicalBERT-master/lm_pretraining/heuristic_tokenize.py | # NOTE: this code is taken directly from Willie Boag's mimic-tokenize github repository
# https://github.com/wboag/mimic-tokenize/blob/master/heuristic-tokenize.py commit e953d271bbb4c53aee5cc9a7b8be870a6b007604
# The code was modified in two ways:
# (1) to make the script compatible with Python 3
# (2) to remove the ... | 10,720 | 32.089506 | 125 | py |
clinicalBERT | clinicalBERT-master/lm_pretraining/run_pretraining.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 18,667 | 36.789474 | 82 | py |
clinicalBERT | clinicalBERT-master/lm_pretraining/create_pretraining_data.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 15,237 | 33.397291 | 80 | py |
clinicalBERT | clinicalBERT-master/downstream_tasks/run_classifier.py | # Code is adapted from the PyTorch pretrained BERT repo - See copyright & license below.
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not ... | 33,551 | 41.57868 | 139 | py |
clinicalBERT | clinicalBERT-master/downstream_tasks/run_ner.py | #! usr/bin/env python3
# -*- coding:utf-8 -*-
"""
This code is adapted from the kyzhouhzau/BERT-NER repo with several modifications.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import collections
import os
import math
import modeling
imp... | 35,580 | 38.05708 | 149 | py |
clinicalBERT | clinicalBERT-master/downstream_tasks/i2b2_preprocessing/i2b2_2006_deid/split_train_dev.py | with open('train_dev.conll', 'r') as f:
sents = f.read().strip().split('\n\n')
print(len(sents))
import random
random.seed(555)
n = len(sents)
ind = int(0.7*n)
train_sents = sents[:ind]
dev_sents = sents[ind:]
print(len(train_sents))
with open('train.conll', 'w') as f:
f.write('\n\n'.join(train_sents))
pr... | 410 | 17.681818 | 42 | py |
clinicalBERT | clinicalBERT-master/downstream_tasks/i2b2_preprocessing/i2b2_2006_deid/to_conll.py | import re
import sys
import xml.etree.ElementTree as ET
i = 0
with open(sys.argv[1]) as f:
for line in f.readlines():
# filter out non-lines
if line.startswith( '<RECORD') or line.startswith( '<TEXT') or line.startswith( '<ROOT>') or \
line.startswith('</RECORD') or line.startswith('</T... | 1,950 | 32.637931 | 102 | py |
clinicalBERT | clinicalBERT-master/downstream_tasks/ner_eval/format_for_i2b2_eval.py | import argparse
import os
# Functions are all taken from Willie Boag's cliner code `documents.py` at
# https://github.com/text-machine-lab/CliNER/blob/5e1599fb2a2209fa0183f623308516816a033d4f/code/notes/documents.py
def convert_to_i2b2_format(tok_sents, pred_labels, mode=None):
"""
Purpose: Return the given ... | 8,250 | 32.404858 | 114 | py |
clinicalBERT | clinicalBERT-master/downstream_tasks/ner_eval/ner_detokenize.py | # Note that this code is adapted from the BioBERT github repo:
# https://github.com/guidoajansen/biobert/tree/87e70a4dfb0dcc1e29ef9d6562f87c4854504e97/biobert/biocodes
import argparse
import itertools
parser = argparse.ArgumentParser(description='')
parser.add_argument('--token_test_path', type=str, help='')
parser... | 7,206 | 41.89881 | 132 | py |
clinicalBERT | clinicalBERT-master/downstream_tasks/ner_eval/score_i2b2.py |
import argparse
import os
import re
parser = argparse.ArgumentParser(description='')
parser.add_argument('--input_pred_dir', type=str, help='Location of input i2b2 prediction formatted files')
parser.add_argument('--input_gold_dir', type=str, help='Location of input i2b2 gold formatted files')
parser.add_argument(... | 2,241 | 31.028571 | 126 | py |
psds | psds-master/script/collect_results.py | #!/bin/python
import os, argparse
parser = argparse.ArgumentParser()
parser.add_argument('directory', type = str, help = "Directory with executables. Path must be relative to project parent directory.")
parser.add_argument('sum_results', type = str, help = "Results filename for SUM.")
parser.add_argument('update_resu... | 1,013 | 22.045455 | 133 | py |
psds | psds-master/include/nodes/print_table.py | import sys
n = int(sys.argv[1])
for row in range(n+1):
for col in range(row):
print("0,", end='')
for col in range(n - row):
print("all1,", end='')
print("") | 186 | 19.777778 | 30 | py |
IDEC-toy | IDEC-toy-master/DEC.py | """
Toy implementation for Deep Embedded Clustering as described in the paper:
Junyuan Xie, Ross Girshick, and Ali Farhadi. Unsupervised deep embedding for clustering analysis. ICML 2016.
Main differences with original code at https://github.com/piiswrong/dec.git:
1. Autoencoder is pretrain in an end-to-e... | 13,998 | 39.459538 | 120 | py |
IDEC-toy | IDEC-toy-master/datasets.py | import numpy as np
def load_mnist():
# the data, shuffled and split between train and test sets
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x = np.concatenate((x_train, x_test))
y = np.concatenate((y_train, y_test))
x = x.reshape((x.shape[0], -1))
... | 5,688 | 36.675497 | 113 | py |
IDEC-toy | IDEC-toy-master/IDEC.py | """
Toy implementation for Improved Deep Embedded Clustering as described in paper:
Xifeng Guo, Long Gao, Xinwang Liu, Jianping Yin. Improved Deep Embedded Clustering with Local Structure
Preservation. IJCAI 2017.
The Autoencoder is pretrained directly in an end-to-end manner, NOT greedy layer-wise tr... | 9,906 | 42.073913 | 116 | py |
CE-OCL | CE-OCL-main/src/embed_mip.py | import pandas as pd
import numpy as np
from pyomo import environ
from pyomo.environ import *
import sys
def optimization_MIP(model,
x, ## decision variables (already attached to model)
model_master, ## master table that specifies learned functions for constraints (and param... | 24,754 | 59.378049 | 220 | py |
CE-OCL | CE-OCL-main/src/ce_helpers.py | import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler, OneHotEncoder
from sklearn.model_selection import train_test_split
from pyomo.environ import *
import constraint_learning as cl
import run_MLmodels as rm
import os
import pickle
from scipy import stats
from sklearn.pipeline import Pi... | 28,137 | 36.417553 | 125 | py |
CE-OCL | CE-OCL-main/src/run_MLmodels.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# module load python/3.6.3
# module load sloan/python/modules/3.6
# srun --pty --mem=16G -p sched_mit_sloan_interactive python3
import numpy as np
import pandas as pd
from sklearn import metrics
from sklearn import tree
from sklearn.model_selection import GridSearchCV
fr... | 22,467 | 46.004184 | 123 | py |
CE-OCL | CE-OCL-main/src/constraint_learning.py | import pandas as pd
import numpy as np
'''
ContraintLearning class contains a set of functions for the
extrapolation of constraints from a trained Optimal Classification Tree
(with and without hyperplanes).
'''
class ConstraintLearning(object):
'''
The initialization requires:
X: dataset without the targ... | 17,259 | 46.15847 | 165 | py |
CE-OCL | CE-OCL-main/numerical experiments/evaluate_carla_methods.py |
import pandas as pd
import numpy as np
import ce_helpers
import pickle
import os
import warnings
warnings.filterwarnings("ignore")
# from importlib import reload
# reload(ce_helpers)
import Datasets as DS
wd = 'data/'
alg = 'rf'
dataset = DS.adult
results_path = 'results/'
'''
---------DATA---------
'''
df, df_t... | 6,618 | 59.172727 | 266 | py |
CE-OCL | CE-OCL-main/numerical experiments/Datasets.py | import pandas as pd
import pickle
import os
import opticl as oc
import ce_helpers
# import sys
def adult(wd, alg = 'rf'):
## load data
df = pd.read_csv(wd+'adult/dataset_carla_adult.csv')
df_train = pd.read_csv(wd + 'adult/train_carla_adult.csv')
df_test = pd.read_csv(wd + 'adult/test_carla_adult.csv'... | 13,519 | 30.009174 | 113 | py |
CE-OCL | CE-OCL-main/numerical experiments/CE-OCL_DiCE_results.py | import Datasets as DS
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import ce_helpers
from itertools import chain
import dice_ml
import os
import pandas as pd
'''
You need to adjust the directory to the data folder and the results.
You need to change the dataset.
You need to change the model (... | 15,474 | 49.080906 | 266 | py |
drizzle | drizzle-master/setup.py | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import sys
from setuptools import setup, Extension
import numpy
def get_extensions():
srcdir = os.path.join(os.path.dirname(__file__), 'src')
cdriz_sources = ['cdrizzleapi.c',
'cdrizzleblot.c... | 1,138 | 28.205128 | 70 | py |
drizzle | drizzle-master/docs/conf.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configurati... | 6,008 | 37.273885 | 87 | py |
drizzle | drizzle-master/drizzle/dodrizzle.py | """
STScI Python compatable drizzle module
"""
import numpy as np
from . import util
from . import calc_pixmap
from . import cdrizzle
def dodrizzle(insci, input_wcs, inwht,
output_wcs, outsci, outwht, outcon,
expin, in_units, wt_scl,
wcslin_pscale=1.0, uniqid=1,
... | 6,734 | 35.016043 | 80 | py |
drizzle | drizzle-master/drizzle/doblot.py | """
STScI Python compatable blot module
"""
import numpy as np
from . import calc_pixmap
from . import cdrizzle
def doblot(source, source_wcs, blot_wcs, exptime, coeffs=True,
interp='poly5', sinscl=1.0, stepsize=10, wcsmap=None):
"""
Low level routine for performing the 'blot' operation.
Crea... | 2,484 | 29.679012 | 80 | py |
drizzle | drizzle-master/drizzle/util.py | import numpy as np
def find_keyword_extn(fimg, keyword, value=None):
"""
This function will return the index of the extension in a multi-extension
FITS file which contains the desired keyword with the given value.
Parameters
----------
fimg : hdulist
A list of header data units
... | 5,743 | 21.350195 | 77 | py |
drizzle | drizzle-master/drizzle/drizzle.py | """
The `drizzle` module defines the `Drizzle` class, for combining input
images into a single output image using the drizzle algorithm.
"""
import os
import os.path
import numpy as np
from astropy import wcs
from astropy.io import fits
from . import util
from . import doblot
from . import dodrizzle
class Drizzle(o... | 22,810 | 39.231041 | 90 | py |
drizzle | drizzle-master/drizzle/__init__.py | """
A package for combining dithered images into a single image
"""
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
__version__ = 'unknown'
| 281 | 22.5 | 64 | py |
drizzle | drizzle-master/drizzle/calc_pixmap.py | import numpy as np
def calc_pixmap(first_wcs, second_wcs):
"""
Calculate a mapping between the pixels of two images.
Parameters
----------
first_wcs : wcs
A WCS object representing the coordinate system you are
converting from
seond_wcs : wcs
A WCS object representin... | 1,650 | 30.150943 | 84 | py |
drizzle | drizzle-master/drizzle/tests/test_cdrizzle.py | import numpy as np
from drizzle import cdrizzle
def test_cdrizzle():
"""
Call C unit tests for cdrizzle, which are in the src/tests directory
"""
size = 100
data = np.zeros((size,size), dtype='float32')
weights = np.ones((size,size), dtype='float32')
pixmap = np.indices((size,size), dty... | 690 | 26.64 | 72 | py |
drizzle | drizzle-master/drizzle/tests/test_file_io.py | import os
import pytest
import numpy as np
from astropy import wcs
from astropy.io import fits
from drizzle import drizzle
from drizzle import util
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
DATA_DIR = os.path.join(TEST_DIR, 'data')
def read_header(filename):
"""
Read the primary header from a ... | 4,922 | 27.131429 | 75 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.