repo
stringlengths
2
99
file
stringlengths
14
239
code
stringlengths
20
3.99M
file_length
int64
20
3.99M
avg_line_length
float64
9.73
128
max_line_length
int64
11
86.4k
extension_type
stringclasses
1 value
ZINBAE
ZINBAE-master/ZINBAE.py
""" Implementation of ZINBAE model """ from time import time import numpy as np from keras.models import Model import keras.backend as K from keras.engine.topology import Layer, InputSpec from keras.layers import Dense, Input, GaussianNoise, Layer, Activation, Lambda, Multiply, BatchNormalization, Reshape, Concatenate...
10,280
39.636364
154
py
ZINBAE
ZINBAE-master/loss.py
import numpy as np import tensorflow as tf from keras import backend as K def _nan2zero(x): return tf.where(tf.is_nan(x), tf.zeros_like(x), x) def _nan2inf(x): return tf.where(tf.is_nan(x), tf.zeros_like(x)+np.inf, x) def _nelem(x): nelem = tf.reduce_sum(tf.cast(~tf.is_nan(x), tf.float32)) return tf...
4,141
30.142857
122
py
ZINBAE
ZINBAE-master/layers.py
from keras.engine.topology import Layer from keras.layers import Lambda from keras import backend as K import tensorflow as tf class ConstantDispersionLayer(Layer): ''' An identity layer which allows us to inject extra parameters such as dispersion to Keras models ''' def __init__(...
1,798
32.314815
98
py
ZINBAE
ZINBAE-master/ZINBAE0.py
""" Implementation of scDeepCluster for scRNA-seq data """ from time import time import numpy as np from keras.models import Model import keras.backend as K from keras.engine.topology import Layer, InputSpec from keras.layers import Dense, Input, GaussianNoise, Layer, Activation, Lambda, Multiply, BatchNormalization, ...
8,888
39.040541
154
py
ZINBAE
ZINBAE-master/preprocess.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import pickle, os, numbers import numpy as np import scipy as sp import pandas as pd import scanpy.api as sc from sklearn.model_selection import train_test_split from sklearn.preprocessing import scale #TO...
4,580
33.969466
112
py
incremental-ks
incremental-ks-master/IncrementalKS/Pure Python/IKS.py
from Treap import Treap from math import log class IKS: def __init__(self): self.treap = None self.n = [0, 0] @staticmethod def KSThresholdForPValue(pvalue, N): '''Threshold for KS Test given a p-value Args: pval (float): p-value. N (int): the size of the samples. Returns: ...
3,778
29.475806
199
py
incremental-ks
incremental-ks-master/IncrementalKS/Pure Python/Treap.py
from random import random class Treap: def __init__(self, key, value = 0): self.key = key self.value = value self.priority = random() self.size = 1 self.height = 1 self.lazy = 0 self.max_value = value self.min_value = value self.left = None self.right = None @staticmethod ...
3,699
21.02381
64
py
incremental-ks
incremental-ks-master/IncrementalKS/Python C++ Wrapper/ForgettingBuffer.py
class Node: def __init__(self, value): self.value = value self.next = None class ForgettingBuffer: def __init__(self, values): self.first = None self.last = None for val in values: if self.first == None: self.first = Node(val) self.last = self.first else: se...
930
18.808511
40
py
incremental-ks
incremental-ks-master/IncrementalKS/Python C++ Wrapper/IKS.py
from cffi import FFI ffi = FFI() ffi.cdef(""" typedef struct { void * pointer; } IKS_WrappedPointer; IKS_WrappedPointer IKS_NewGeneratorWithSeed(unsigned seed); IKS_WrappedPointer IKS_NewGenerator(void); void IKS_DeleteGenerator(IKS_WrappedPointer pointer); IKS_WrappedPointer IKS_NewIKS(IKS_WrappedPointer gen...
4,612
30.813793
199
py
pyterpol
pyterpol-master/grid_to_binary.py
import os import argparse import numpy as np def main(): ps = argparse.ArgumentParser() ps.add_argument('--remove', action='store_true', default=False, help='Removes ascii files.') ps.add_argument('--overwrite', action='store_true', default=False, help='Overwrites binary files -- mandatory for every mach...
1,998
34.696429
140
py
pyterpol
pyterpol-master/fitting/fitter.py
import os import nlopt import emcee # import warnings import numpy as np from scipy.optimize import fmin from scipy.optimize import fmin_slsqp try: from scipy.optimize import differential_evolution except ImportError as ex: print ex differential_evolution = None from pyterpol.synthetic.auxiliary import parl...
20,033
31.842623
114
py
pyterpol
pyterpol-master/fitting/interface.py
import copy import corner # import sys import warnings import numpy as np import matplotlib.pyplot as plt from scipy import stats from pyterpol.synthetic.makespectrum import SyntheticGrid from pyterpol.observed.observations import ObservedSpectrum from pyterpol.fitting.parameter import Parameter from pyterpol.fitting.p...
151,519
35.127802
120
py
pyterpol
pyterpol-master/synthetic/auxiliary.py
import numpy as np import matplotlib.pyplot as plt from astropy.constants import c from scipy.interpolate import splrep from scipy.interpolate import splev from scipy.interpolate import bisplrep from scipy.interpolate import bisplev from scipy.interpolate import RectBivariateSpline from scipy.interpolate import Interpo...
10,363
24.033816
115
py
pyterpol
pyterpol-master/synthetic/makespectrum.py
import os import sys import copy import warnings import numpy as np import matplotlib.pyplot as plt from astropy.constants import c from auxiliary import is_within_interval from auxiliary import instrumental_broadening from auxiliary import interpolate_spec from auxiliary import interpolate_block_faster from auxiliary ...
45,773
34.319444
119
py
pyterpol
pyterpol-master/synthetic/defaults.py
# defaults settings - for more utility, this was transfered # to init import os, inspect curdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # DEFINITIONS OF GRIDS OF RELATIVE SPECTRA gridDirectory = os.path.join("/".join(curdir.split('/')[:-1]), 'grids') # name of the file containing r...
2,466
34.242857
120
py
pyterpol
pyterpol-master/plotting/plotting.py
import copy import matplotlib.pyplot as plt import matplotlib.gridspec as gs import numpy as np from scipy.stats import norm from pyterpol.synthetic.auxiliary import read_text_file def get_walker(db, nchain, nwalker, niter): """ Retrieves a walker from the chain. :param db: :param nchain: :param n...
9,041
22.42487
95
py
pyterpol
pyterpol-master/pyterpol_examples/Interface/output/example.py
""" This tutorial serves as demonstration of how to fit observed spectra with Pyterpol. Our observed spectra were created with the old C++ version of the code. We have three spectra of a binary consisting of primary: teff = 25000, g = 4.2, , vrot = 150, lr = 0.7, z = 1.0 secondary: teff = 18000, g = 4.2, , vrot = 50, ...
5,219
47.333333
146
py
pyterpol
pyterpol-master/pyterpol_examples/Interface/setup/example.py
""" This tutorial serves as demonstration of how to set up an Interface. Our observed spectra were created with the old C++ version of the code. We have three spectra of a binary consisting of primary: teff = 25000, g = 4.2, , vrot = 150, lr = 0.7, z = 1.0 secondary: teff = 18000, g = 4.2, , vrot = 50, lr = 0.3, z = 1....
9,099
51.601156
151
py
pyterpol
pyterpol-master/pyterpol_examples/Interface/fit/example.py
""" This tutorial serves as demonstration of how to fit observed spectra with Pyterpol. Our observed spectra were created with the old C++ version of the code. We have three spectra of a binary consisting of primary: teff = 25000, g = 4.2, , vrot = 150, lr = 0.7, z = 1.0 secondary: teff = 18000, g = 4.2, , vrot = 50, ...
8,806
45.845745
146
py
pyterpol
pyterpol-master/pyterpol_examples/SyntheticSpectrum/example.py
""" This is a tutorial script how to handle the class Synthetic Spectrum. """ import pyterpol import numpy as np import matplotlib.pyplot as plt # Load the spectrum using the library numpy wave, intens = np.loadtxt('grid.dat', unpack=True, usecols=[0,1]) # The synthetic spectrum can be created either from arrays ss =...
1,449
25.851852
92
py
pyterpol
pyterpol-master/pyterpol_examples/SyntheticGrid/example.py
""" This script serves a demonstration of the class SyntheticGrid. """ # import the library import pyterpol import matplotlib.pyplot as plt # The handling of the synthetic grid is shadowed from the user, # therefore the interaction of the user with the grid should # restrict to only few methods. # How to create a gri...
2,610
31.6375
83
py
pyterpol
pyterpol-master/pyterpol_examples/observed_spectra_fitting/v746cas/v746cas_2.py
""" V746Cas - fitting of a observed spectra. This example also show, ho we can proceed if we want to fit parameters step by step. """ import pyterpol import matplotlib.pyplot as plt def inspect_spectra(f): ifile = open(f, 'r') slist = ifile.readlines() ifile.close() for rec in slist: ifile = ...
2,974
28.455446
90
py
pyterpol
pyterpol-master/pyterpol_examples/observed_spectra_fitting/v746cas/v746cas.py
""" V746Cas - fitting of a observed spectra. This example also show, ho we can proceed if we want to fit parameters step by step. """ import pyterpol import matplotlib.pyplot as plt def inspect_spectra(f): ifile = open(f, 'r') slist = ifile.readlines() ifile.close() for rec in slist: ifile = ...
2,974
28.455446
90
py
pyterpol
pyterpol-master/pyterpol_examples/observed_spectra_fitting/v746cas_2/v746cas_2.py
""" V746Cas - fitting of a observed spectra. This example also show, ho we can proceed if we want to fit parameters step by step. """ import pyterpol import numpy as np import matplotlib.pyplot as plt def inspect_spectra(f): """ Plots all spectra. :param f: :return: """ ifile = open(f, 'r') ...
3,716
24.993007
89
py
pyterpol
pyterpol-master/pyterpol_examples/observed_spectra_fitting/v746cas_2/v746cas_eval_mcmc.py
import pyterpol # check convergence of individual parameters pyterpol.Interface.plot_convergence_mcmc('chain.dat', figname='mcmc_convergence.png') # plot covariance of radiative parameters pyterpol.Interface.plot_covariances_mcmc('chain.dat', parameters=['vrot', 'teff', 'logg'], figname='mcmc_correlations.png') # pl...
514
38.615385
123
py
pyterpol
pyterpol-master/pyterpol_examples/observed_spectra_fitting/v746cas_2/ondrejov/mask_tell.py
import sys import numpy as np tellbase = [ [6522., 6525.5], [6530., 6538.5], [6541.8, 6550.37], [6551.75, 6554.9], [6557., 6560], [6563.6, 6564.8], [6568.38, 6576.3], [6580.2, 6588.2], [6594.2, 6596.], [6598.8, 6603.4] ] def remove_telluric(f): """ Removes intervals def...
770
15.404255
56
py
pyterpol
pyterpol-master/pyterpol_examples/ObservedList/example.py
""" This example demonstrates how to prepare observations. """ import pyterpol # create a blank list ol = pyterpol.ObservedList() # now we are ready to attach some data - lets have a look at the data first # the spectrum is not a KOREL spectrum, so we do not have to pass additional # information obs1 = pyterpol.Obse...
2,934
34.361446
104
py
pyterpol
pyterpol-master/pyterpol_examples/StarList/example.py
""" This script demonstrates capabilities of the StarList class. """ import pyterpol # create an empty class sl = pyterpol.StarList() # pyterpol knows a set of parameters, which are given to a component # these parameters are teff, logg, z, lr, vrot and rv. Therefore # adding component is possible by just calling: s...
2,079
31
107
py
pyterpol
pyterpol-master/pyterpol_examples/disentangled_spectra_fitting/hd81357/hd81357_plot.py
""" This shows how to evaluate the outcome of the fitting We were fitting the disentangled spectra of the secondary. """ import pyterpol # 1) Load the last session - create an empty Interface itf = pyterpol.Interface() # fill it with teh last session itf.load('hd81357.sav') # 2) Have a look at the comparisons itf.pl...
627
20.655172
58
py
pyterpol
pyterpol-master/pyterpol_examples/disentangled_spectra_fitting/hd81357/hd81357.py
""" Real life demonstration. HD81357 is an interacting binary. Its secondary is a Roche-lobe filling star, which is probably losing its mass. We obtained disentangled spectra of the secondary in two spectral regions. Here is an estimate of its radiative properties. """ # import numpy as np import pyterpol ## 1) Creat...
5,610
39.366906
154
py
pyterpol
pyterpol-master/pyterpol_examples/Fitter/example.py
""" This function demonstrates usage of the class Fitter. """ import pyterpol import numpy as np import matplotlib.pyplot as plt import time # define a function that will be minimized def func(x): """ Polynomial of order 4 :param x: :param p: :return: """ x = x[0] return 0.5*x**4 - 2*x...
2,764
28.105263
89
py
pyterpol
pyterpol-master/pyterpol_examples/RegionList/example.py
""" This script demonstrates capabilities of the RegionList class. """ import pyterpol # create an empty class rl = pyterpol.RegionList() # add a region - the simplest way rl.add_region(wmin=4300, wmax=4500) # add a region, define name rl.add_region(wmin=6200, wmax=6600, identification='red') # for some reason we ...
1,879
35.153846
89
py
pyterpol
pyterpol-master/grids_ABS/ready_phoenix.py
""" ready_phoenix.py Convert Phoenix synthetic spectra from FITS to DAT. """ __author__ = "Miroslav Broz (miroslav.broz@email.cz)" __version__ = "Jun 23rd 2016" import sys import numpy as np from scipy.interpolate import splrep, splev from astropy.io import fits from pyterpol.synthetic.auxiliary import instrumenta...
2,065
20.747368
97
py
pyterpol
pyterpol-master/observed/observations.py
import warnings import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import splrep from scipy.interpolate import splev # repeat userwarnings warnings.simplefilter('always', UserWarning) class ObservedSpectrum: """ A wrapper class for the observed spectra. """ def __init__(self, w...
15,903
33.498915
118
py
davis2017-evaluation
davis2017-evaluation-master/setup.py
from setuptools import setup import sys if sys.version_info < (3, 6): sys.exit('Sorry, only Python >= 3.6 is supported') setup( python_requires='>=3.6, <4', install_requires=[ 'Pillow>=4.1.1', 'networkx>=2.0', 'numpy>=1.12.1', 'opencv-python>=4.0.0.21', 'pandas>=0.2...
506
23.142857
54
py
davis2017-evaluation
davis2017-evaluation-master/evaluation_method.py
import os import sys from time import time import argparse import numpy as np import pandas as pd from davis2017.evaluation import DAVISEvaluation default_davis_path = '/path/to/the/folder/DAVIS' time_start = time() parser = argparse.ArgumentParser() parser.add_argument('--davis_path', type=str, help='Path to the DA...
3,492
49.623188
118
py
davis2017-evaluation
davis2017-evaluation-master/evaluation_codalab.py
import sys import os.path from time import time import numpy as np import pandas from davis2017.evaluation import DAVISEvaluation task = 'semi-supervised' gt_set = 'test-dev' time_start = time() # as per the metadata file, input and output directories are the arguments if len(sys.argv) < 3: input_dir = "input_di...
4,122
42.861702
140
py
davis2017-evaluation
davis2017-evaluation-master/davis2017/utils.py
import os import errno import numpy as np from PIL import Image import warnings from davis2017.davis import DAVIS def _pascal_color_map(N=256, normalized=False): """ Python implementation of the color map function for the PASCAL VOC data set. Official Matlab version can be found in the PASCAL VOC devkit ...
6,009
33.342857
110
py
davis2017-evaluation
davis2017-evaluation-master/davis2017/results.py
import os import numpy as np from PIL import Image import sys class Results(object): def __init__(self, root_dir): self.root_dir = root_dir def _read_mask(self, sequence, frame_id): try: mask_path = os.path.join(self.root_dir, sequence, f'{frame_id}.png') return np.arr...
1,236
37.65625
111
py
davis2017-evaluation
davis2017-evaluation-master/davis2017/metrics.py
import math import numpy as np import cv2 def db_eval_iou(annotation, segmentation, void_pixels=None): """ Compute region similarity as the Jaccard Index. Arguments: annotation (ndarray): binary annotation map. segmentation (ndarray): binary segmentation map. void_pixels (ndarray)...
6,823
33.464646
137
py
davis2017-evaluation
davis2017-evaluation-master/davis2017/evaluation.py
import sys from tqdm import tqdm import warnings warnings.filterwarnings("ignore", category=RuntimeWarning) import numpy as np from davis2017.davis import DAVIS from davis2017.metrics import db_eval_boundary, db_eval_iou from davis2017 import utils from davis2017.results import Results from scipy.optimize import linea...
6,143
54.351351
143
py
davis2017-evaluation
davis2017-evaluation-master/davis2017/davis.py
import os from glob import glob from collections import defaultdict import numpy as np from PIL import Image class DAVIS(object): SUBSET_OPTIONS = ['train', 'val', 'test-dev', 'test-challenge'] TASKS = ['semi-supervised', 'unsupervised'] DATASET_WEB = 'https://davischallenge.org/davis2017/code.html' V...
5,514
43.837398
130
py
mapalignment
mapalignment-master/projects/mapalign/evaluate_funcs/evaluate_utils.py
import sys import numpy as np sys.path.append("../../utils") import polygon_utils def compute_batch_polygon_distances(gt_polygons_batch, aligned_disp_polygons_batch): # Compute distances distances = np.sqrt(np.sum(np.square(aligned_disp_polygons_batch - gt_polygons_batch), axis=-1)) min = np.nanmin(dis...
2,799
36.333333
100
py
mapalignment
mapalignment-master/projects/mapalign/dataset_utils/preprocess_bradbury_buildings_multires.py
import sys import os import json import math import skimage.transform import skimage.draw import numpy as np # from PIL import Image, ImageDraw # Image.MAX_IMAGE_PIXELS = 200000000 import tensorflow as tf import config_bradbury_buildings_multires as config sys.path.append("../../../data/bradbury_buildings_roads_he...
17,281
47.68169
163
py
mapalignment
mapalignment-master/projects/mapalign/dataset_utils/preprocess_aerial_image_multires.py
import sys import os import math import json import random import skimage.transform import numpy as np import tensorflow as tf import config_aerial_image_multires as config sys.path.append("../../../data/AerialImageDataset") import read # sys.path.append("../utils") # import visualization sys.path.append("../../u...
16,812
46.360563
182
py
mapalignment
mapalignment-master/projects/mapalign/dataset_utils/dataset_multires.py
import sys import os import math import tensorflow as tf sys.path.append("../utils") # Mapalign sub-projects utils import visualization import skimage.io sys.path.append("../../utils") # Projects utils import tf_utils import python_utils STRING_QUEUE_CAPACITY = 4000 MIN_QUEUE_EXAMPLES = 2000 def all_items_are...
27,745
47.422339
197
py
mapalignment
mapalignment-master/projects/mapalign/utils/visualization.py
import os import sys import numpy as np import cv2 current_filepath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(current_filepath, "../../utils")) import python_utils import polygon_utils # Try importing pyplot: display_is_available = python_utils.get_display_availability() use_pyplot = ...
13,891
40.717718
173
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/main.py
# Quicky align the OSM data of your images with this script import sys import os import argparse import skimage.io import numpy as np import test sys.path.append("../../utils") import run_utils import print_utils import geo_utils CONFIG = "config" IMAGE = "geo_images/test_image.tif" SHAPEFILE = None BATCH_SIZE = 1...
8,129
31.390438
176
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/5_model_buildings.py
import os.path import numpy as np import bpy, bmesh import config OUTPUT_BASE_DIRPATH = os.path.join(config.PROJECT_DIR, "3d_buildings/leibnitz") SCALE = 0.1 IMAGE_HEIGHT = 12360 * 0.5 # In meters IMAGE_WIDTH = 17184 * 0.5 # In meters UV_SCALE = (1 / (IMAGE_HEIGHT * SCALE), 1 / (IMAGE_WIDTH * SCALE)) # (u, v)...
1,792
27.460317
79
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/model_utils.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import sys import tensorflow as tf sys.path.append("../../utils") import tf_utils import print_utils DEBUG = False SUMMARY = False def print_debug(obj): if DEBUG: print_utils.print_...
20,710
44.820796
185
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/loss_utils.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import numpy as np import tensorflow as tf sys.path.append("../../utils") import tf_utils def displacement_error(gt, preds, level_loss_coefs, polygon_map, disp_loss_params): """ :param g...
9,420
44.73301
125
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/multires_pipeline.py
import sys import skimage.transform import skimage.io import numpy as np import model sys.path.append("../../utils") import run_utils import polygon_utils import print_utils def rescale_data(image, polygons, scale): downsampled_image = skimage.transform.rescale(image, scale, order=3, preserve_range=True, multic...
6,435
47.390977
186
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/4_compute_building_heights.py
import os.path import sys import math import itertools import numpy as np import config sys.path.append("../../utils") import geo_utils DATASET_DIR = os.path.join(config.PROJECT_DIR, "../../../data/stereo_dataset") RAW_DIR = os.path.join(DATASET_DIR, "raw/leibnitz") INPUT_DIR = "test/stereo_dataset_real_displacemen...
4,526
40.154545
174
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/download_pretrained.py
import os.path import urllib.request import zipfile ressource_filename_list = ["runs.igarss2019.zip"] ressource_dirpath_url = "https://www-sop.inria.fr/members/Nicolas.Girard/downloads/mapalignment" script_filepath = os.path.realpath(__file__) zip_download_dirpath = os.path.join(os.path.dirname(script_filepath), "ru...
953
35.692308
102
py
mapalignment
mapalignment-master/projects/mapalign/mapalign_multires/1_train.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import tensorflow as tf import os import model sys.path.append(os.path.join("../dataset_utils")) import dataset_multires sys.path.append("../../utils") import python_utils import run_utils flags...
9,943
44.2
146
py
mapalignment
mapalignment-master/projects/utils/tf_utils.py
import tensorflow as tf from tensorflow.python.framework.ops import get_gradient_function import math import numpy as np def get_tf_version(): return tf.__version__ def bytes_feature(value): return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value])) def int64_feature(value): return tf.train...
9,356
35.694118
155
py
mapalignment
mapalignment-master/projects/utils/viz_utils.py
import sys import numpy as np sys.path.append("../../utils") import polygon_utils import skimage.io import cv2 def save_plot_image_polygon(filepath, image, polygons): spatial_shape = image.shape[:2] polygons_map = polygon_utils.draw_polygon_map(polygons, spatial_shape, fill=False, edges=True, ...
1,610
34.021739
98
py
mapalignment
mapalignment-master/projects/utils/dataset_utils.py
import os import tensorflow as tf class TFRecordShardWriter: def __init__(self, filepath_format, max_records_per_shard): self.filepath_format = filepath_format self.max_records_per_shard = max_records_per_shard self.current_shard_record_count = 0 # To know when to switch to a new file ...
1,079
36.241379
83
py
mapalignment
mapalignment-master/projects/utils/python_utils.py
import os import errno import json from jsmin import jsmin def module_exists(module_name): try: __import__(module_name) except ImportError: return False else: return True def choose_first_existing_path(path_list): for path in path_list: if os.path.exists(os.path.expa...
2,600
24.5
136
py
mapalignment
mapalignment-master/projects/utils/image_utils.py
from io import BytesIO import math import numpy as np from PIL import Image import skimage.draw import python_utils CV2 = False if python_utils.module_exists("cv2"): import cv2 CV2 = True if python_utils.module_exists("matplotlib.pyplot"): import matplotlib.pyplot as plt def get_image_size(filepath): ...
8,487
34.514644
148
py
mapalignment
mapalignment-master/projects/utils/print_utils.py
class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' DEBUG = '\033[31;40m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def print_info(string): print(bcolors.OKBLUE + string + bcolors.ENDC) def print_suc...
1,293
19.21875
65
py
mapalignment
mapalignment-master/projects/utils/polygon_utils.py
import math import random import numpy as np import scipy.spatial from PIL import Image, ImageDraw, ImageFilter import skimage import python_utils if python_utils.module_exists("skimage.measure"): from skimage.measure import approximate_polygon if python_utils.module_exists("shapely"): from shapely import g...
42,079
36.437722
131
py
mapalignment
mapalignment-master/projects/utils/geo_utils.py
import numpy as np import time import json import os.path from osgeo import gdal, ogr from osgeo import osr import overpy # from fiona.crs import from_epsg # import fiona from pyproj import Proj, transform import polygon_utils import math_utils import print_utils QUERY_BASE = \ """ <osm-script timeout="900"...
12,156
32.86351
187
py
mapalignment
mapalignment-master/projects/utils/math_utils.py
import numpy as np import time import sklearn.datasets import skimage.transform import python_utils import image_utils # if python_utils.module_exists("matplotlib.pyplot"): # import matplotlib.pyplot as plt CV2 = False if python_utils.module_exists("cv2"): import cv2 CV2 = True # import multiprocessing ...
11,176
31.873529
147
py
mapalignment
mapalignment-master/data/mapping_challenge_dataset/read.py
import sys sys.path.append("../utils") import visualization from pycocotools.coco import COCO from pycocotools import mask as cocomask import numpy as np import skimage.io as io import matplotlib.pyplot as plt import pylab import random import os FOLD_LIST = ["train", "val"] IMAGES_DIRPATH_FORMAT = "{}/images" # v...
3,220
29.102804
103
py
mapalignment
mapalignment-master/data/AerialImageDataset/convert_npy_to_shp.py
import os.path import sys import read FILE_DIRNAME = os.getcwd() sys.path.append(os.path.join(FILE_DIRNAME, "../../projects/utils")) import geo_utils RAW_DIRPATH = os.path.join(FILE_DIRNAME, "raw") IMAGE_INFO_LIST = [ { "city": "bloomington", "numbers": list(range(1, 37)), }, { ...
2,189
25.071429
168
py
mapalignment
mapalignment-master/data/AerialImageDataset/fetch_gt_polygons.py
import sys import os import numpy as np sys.path.append("../../../projects/utils") import python_utils import polygon_utils import geo_utils DIR_PATH_LIST = ["./raw/train", "./raw/test"] IMAGE_DIR_NAME = "images" IMAGE_EXTENSION = "tif" GT_POLYGONS_DIR_NAME = "gt_polygons" def load_gt_polygons(image_filepath):...
2,053
29.656716
115
py
mapalignment
mapalignment-master/data/AerialImageDataset/read.py
import os.path import csv import sys import numpy as np import skimage.io CITY_METADATA_DICT = { "bloomington": { "fold": "test", "pixelsize": 0.3, "numbers": list(range(1, 37)), }, "bellingham": { "fold": "test", "pixelsize": 0.3, "numbers": list(range(1, 3...
4,120
26.657718
115
py
mapalignment
mapalignment-master/data/bradbury_buildings_roads_height_dataset/download.py
import os.path import urllib.request import zipfile BASE_URL = 'https://figshare.com/collections/Aerial_imagery_object_identification_dataset_for_building_and_road_detection_and_building_height_estimation/3290519' FILE_URL_FORMAT = "https://ndownloader.figshare.com/articles/{}/versions/1" FILE_METADATA_LIST = [ { ...
1,842
24.957746
161
py
mapalignment
mapalignment-master/data/bradbury_buildings_roads_height_dataset/read.py
import os.path import csv import numpy as np import skimage.io CITY_METADATA_DICT = { "Arlington": { "pixelsize": 0.3, "numbers": [1, 2, 3], }, "Atlanta": { "pixelsize": 0.1524, "numbers": [1, 2, 3], }, "Austin": { "pixelsize": 0.1524, "numbers": ...
5,849
29.952381
118
py
cowrie
cowrie-master/setup.py
from setuptools import setup try: import twisted except ImportError: raise SystemExit("twisted not found. Make sure you " "have installed the Twisted core package.") setup( packages=["cowrie", "twisted"], include_package_data=True, package_dir={"": "src"}, package_data={...
642
22.814815
88
py
cowrie
cowrie-master/src/twisted/plugins/cowrie_plugin.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
10,607
38.434944
110
py
cowrie
cowrie-master/src/cowrie/_version.py
""" Provides cowrie version information. """ # This file is auto-generated! Do not edit! # Use `python -m incremental.update cowrie` to change this file. from __future__ import annotations from incremental import Version __version__ = Version("cowrie", 2, 5, 0) __all__: list[str] = ["__version__"]
303
20.714286
64
py
cowrie
cowrie-master/src/cowrie/output/xmpp.py
from __future__ import annotations import json import string from random import choice from wokkel import muc from wokkel.client import XMPPClient from wokkel.xmppim import AvailablePresence from twisted.application import service from twisted.python import log from twisted.words.protocols.jabber import jid from twis...
2,986
29.479592
84
py
cowrie
cowrie-master/src/cowrie/output/rethinkdblog.py
from __future__ import annotations import time from datetime import datetime import rethinkdb as r import cowrie.core.output from cowrie.core.config import CowrieConfig def iso8601_to_timestamp(value): return time.mktime(datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%fZ").timetuple()) RETHINK_DB_SEGMENT = "outp...
1,526
30.163265
85
py
cowrie
cowrie-master/src/cowrie/output/reversedns.py
from __future__ import annotations from functools import lru_cache import ipaddress from twisted.internet import defer from twisted.names import client, error from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig class Output(cowrie.core.output.Output): """ Ou...
3,128
28.242991
88
py
cowrie
cowrie-master/src/cowrie/output/mysql.py
""" MySQL output connector. Writes audit logs to MySQL database """ from __future__ import annotations from twisted.enterprise import adbapi from twisted.internet import defer from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig import mysql.connector class Reconnec...
11,175
37.143345
102
py
cowrie
cowrie-master/src/cowrie/output/telegram.py
# Simple Telegram Bot logger import treq from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig class Output(cowrie.core.output.Output): """ telegram output """ def start(self): self.bot_token = CowrieConfig.get("output_telegram", "bot_token") ...
2,326
34.8
86
py
cowrie
cowrie-master/src/cowrie/output/influx.py
from __future__ import annotations import re from influxdb import InfluxDBClient from influxdb.exceptions import InfluxDBClientError from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig class Output(cowrie.core.output.Output): """ influx output """ d...
7,285
31.968326
87
py
cowrie
cowrie-master/src/cowrie/output/virustotal.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
18,353
35.416667
117
py
cowrie
cowrie-master/src/cowrie/output/jsonlog.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
2,770
36.958904
75
py
cowrie
cowrie-master/src/cowrie/output/hpfeeds3.py
""" Output plugin for HPFeeds """ from __future__ import annotations import json import logging from hpfeeds.twisted import ClientSessionService from twisted.internet import endpoints, ssl from twisted.internet import reactor from twisted.python import log import cowrie.core.output from cowrie.core.config import C...
4,221
34.478992
87
py
cowrie
cowrie-master/src/cowrie/output/csirtg.py
from __future__ import annotations import os import sys from datetime import datetime from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig token = CowrieConfig.get("output_csirtg", "token", fallback="a1b2c3d4") if token == "a1b2c3d4": log.msg("output_csirtg: token ...
2,714
26.15
86
py
cowrie
cowrie-master/src/cowrie/output/mongodb.py
from __future__ import annotations import pymongo from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig class Output(cowrie.core.output.Output): """ mongodb output """ def insert_one(self, collection, event): try: object_id = collec...
5,057
37.318182
106
py
cowrie
cowrie-master/src/cowrie/output/discord.py
""" Simple Discord webhook logger """ from __future__ import annotations import json from io import BytesIO from twisted.internet import reactor from twisted.internet.ssl import ClientContextFactory from twisted.web import client, http_headers from twisted.web.client import FileBodyProducer import cowrie.core.outpu...
1,486
26.537037
75
py
cowrie
cowrie-master/src/cowrie/output/graylog.py
""" Simple Graylog HTTP Graylog Extended Log Format (GELF) logger. """ from __future__ import annotations import json import time from io import BytesIO from twisted.internet import reactor from twisted.internet.ssl import ClientContextFactory from twisted.web import client, http_headers from twisted.web.client impo...
1,607
26.254237
75
py
cowrie
cowrie-master/src/cowrie/output/abuseipdb.py
# 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 # and/or sell copies of the Software, and to permit persons to whom the # Software is furnish...
18,525
36.275654
89
py
cowrie
cowrie-master/src/cowrie/output/datadog.py
""" Simple Datadog HTTP logger. """ from __future__ import annotations import json import platform from io import BytesIO from twisted.internet import reactor from twisted.internet.ssl import ClientContextFactory from twisted.python import log from twisted.web import client, http_headers from twisted.web.client impo...
2,286
30.763889
86
py
cowrie
cowrie-master/src/cowrie/output/crashreporter.py
""" Cowrie Crashreport This output plugin is not like the others. It has its own emit() function and does not use cowrie eventid's to avoid circular calls """ from __future__ import annotations import json import treq from twisted.internet import defer from twisted.logger._levels import LogLevel from twisted.pytho...
2,005
24.392405
86
py
cowrie
cowrie-master/src/cowrie/output/elasticsearch.py
# Simple elasticsearch logger from __future__ import annotations from typing import Any from elasticsearch import Elasticsearch, NotFoundError import cowrie.core.output from cowrie.core.config import CowrieConfig class Output(cowrie.core.output.Output): """ elasticsearch output """ index: str ...
4,393
33.873016
94
py
cowrie
cowrie-master/src/cowrie/output/localsyslog.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
2,683
36.277778
78
py
cowrie
cowrie-master/src/cowrie/output/threatjammer.py
""" Cowrie plugin for reporting login attempts via the ThreatJammer.com Report API. "ThreatJammer.com is a tool to track and detect attacks" <https://threatjammer.com> """ __author__ = "Diego Parrilla Santamaria" __version__ = "0.1.0" import datetime from typing import Optional from collections.abc import Generator...
7,010
32.545455
111
py
cowrie
cowrie-master/src/cowrie/output/dshield.py
""" Send SSH logins to SANS DShield. See https://isc.sans.edu/ssh.html """ from __future__ import annotations import base64 import hashlib import hmac import re import time import dateutil.parser import requests from twisted.internet import reactor from twisted.internet import threads from twisted.python import log...
6,123
33.994286
100
py
cowrie
cowrie-master/src/cowrie/output/splunk.py
""" Splunk HTTP Event Collector (HEC) Connector. Not ready for production use. JSON log file is still recommended way to go """ from __future__ import annotations import json from io import BytesIO from typing import Any from twisted.internet import reactor from twisted.internet.ssl import ClientContextFactory from...
3,647
30.179487
88
py
cowrie
cowrie-master/src/cowrie/output/sqlite.py
from __future__ import annotations import sqlite3 from typing import Any from twisted.enterprise import adbapi from twisted.internet import defer from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig class Output(cowrie.core.output.Output): """ sqlite output ...
7,367
33.919431
102
py
cowrie
cowrie-master/src/cowrie/output/textlog.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
2,383
38.733333
80
py
cowrie
cowrie-master/src/cowrie/output/redis.py
from __future__ import annotations import json from configparser import NoOptionError import redis import cowrie.core.output from cowrie.core.config import CowrieConfig SEND_METHODS = { "lpush": lambda redis_client, key, message: redis_client.lpush(key, message), "rpush": lambda redis_client, key, message: r...
1,797
27.539683
87
py
cowrie
cowrie-master/src/cowrie/output/misp.py
from __future__ import annotations import warnings from functools import wraps from pathlib import Path from pymisp import MISPAttribute, MISPEvent, MISPSighting from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig try: from pymisp import ExpandedPyMISP as PyMISP ...
4,393
31.308824
85
py
cowrie
cowrie-master/src/cowrie/output/slack.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
2,394
35.287879
75
py
cowrie
cowrie-master/src/cowrie/output/cuckoo.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
5,799
33.52381
88
py