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
3d_sir
3d_sir-master/sir3d/synth/multiprocessing.py
import numpy as np try: from mpi4py import MPI _mpi_available = True except: _mpi_available = False from enum import IntEnum import h5py from tqdm import tqdm, trange import logging from . import slant class tags(IntEnum): READY = 0 DONE = 1 EXIT = 2 START = 3 class Iterator(object): ...
22,823
41.033149
155
py
3d_sir
3d_sir-master/sir3d/synth/jaime_slant.py
import numpy as np import sys """ Model slant+projection tools """ # ***************************************************************************** def fftshift_image(im_in, dy=0.0, dx=0.0, isPeriodic=True, useLog=False): """ FFTSHIFT_IMAGE, shifts an image by dy, dx pixels using Fourier transforms. ...
7,068
30.558036
143
py
3d_sir
3d_sir-master/sir3d/psf/degrade_backup.py
import numpy as np try: from mpi4py import MPI _mpi_available = True except: _mpi_available = False from enum import IntEnum import h5py from tqdm import tqdm, trange import logging import scipy.interpolate import skimage.transform import pyfftw.interfaces as fft # from ipdb import set_trace as stop clas...
15,334
36.585784
159
py
3d_sir
3d_sir-master/sir3d/psf/__init__.py
from .degrade import *
23
11
22
py
3d_sir
3d_sir-master/sir3d/psf/degrade.py
import numpy as np try: from mpi4py import MPI _mpi_available = True except: _mpi_available = False from enum import IntEnum import h5py from tqdm import tqdm, trange import logging import scipy.interpolate import skimage.transform import pyfftw.interfaces as fft # from ipdb import set_trace as stop clas...
16,222
36.640371
158
py
HamiltonianOpInf
HamiltonianOpInf-main/KdV_BBM_utils.py
# Functions for running the KdV and BBM experiments # Anthony Gruber 3-31-2023 # Import necessary packages from functools import partial import numpy as np from numpy.linalg import norm, solve from numpy.fft import rfft, irfft from scipy.optimize import root from scipy.integrate import solve_ivp from scipy.linalg im...
14,804
29.588843
79
py
HamiltonianOpInf
HamiltonianOpInf-main/OpInf_utils.py
# Convenience functions for running the various OpInf procedures # Anthony Gruber 5-28-2023 import numpy as np from numpy.linalg import solve from scipy.sparse import csc_matrix, identity, issparse from scipy.sparse.linalg import spsolve # Finite differences: 4th order in middle, 1st order at ends def FDapprox(y, st...
6,737
32.859296
77
py
HamiltonianOpInf
HamiltonianOpInf-main/ROM_utils.py
# Convenience functions for running the ROMs # Anthony Gruber 3-31-2023 # Standared numpy/scipy imports import numpy as np from numpy.linalg import norm, eigvals from scipy.linalg import lu_factor, lu_solve from scipy.sparse import csc_matrix, identity from scipy.sparse.linalg import factorized # For additional plott...
8,335
29.093863
78
py
degree2
degree2-master/vector_valued_smfs.py
# -*- coding: utf-8 -*- ''' The space of vector valued Siegel modular forms of degree two. cf Satoh, On vector valued Siegel modular forms of degree two, Ibukiyama, Vector valued Siegel modular forms of symmetric tensor weight of small degrees. ''' import operator from sage.misc.cachefunc import cached_method from d...
6,907
34.06599
82
py
degree2
degree2-master/const.py
# -*- coding: utf-8 -*- ''' A module for construction of vector valued Siegel modular forms. ''' from __future__ import print_function from abc import ABCMeta, abstractmethod, abstractproperty import os import hashlib import time from sage.all import (cached_method, mul, fork, matrix, QQ, gcd, latex, ...
24,913
30.10362
79
py
degree2
degree2-master/hecke_module.py
# -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod, abstractproperty import operator import sage from sage.all import (factor, ZZ, QQ, PolynomialRing, matrix, zero_vector, vector, gcd, valuation) from sage.misc.cachefunc import cached_method from degree2.utils import (_is_triple_of...
17,368
31.648496
87
py
degree2
degree2-master/modular_form_module.py
# -*- coding: utf-8; mode: sage -*- from abc import ABCMeta, abstractmethod from sage.all import matrix, QQ, PolynomialRing, identity_matrix, vector class ModularFormModule(object): __metaclass__ = ABCMeta @abstractmethod def basis(self): ''' Should return a list [b_i for i = 0, ..., n-1...
3,849
33.684685
72
py
degree2
degree2-master/all.py
# -*- coding: utf-8 -*- from degree2.scalar_valued_smfs import ( x10_with_prec, x12_with_prec, x35_with_prec, eisenstein_series_degree2, KlingenEisensteinAndCuspForms, y12_with_prec, CuspFormsDegree2, degree2_modular_forms_ring_level1_gens) from degree2.scalar_valued_smfs import SpaceOfModForms as ...
759
32.043478
78
py
degree2
degree2-master/tsushima_dimension_formula.py
# -*- coding: utf-8 -*- from sage.all import (NumberField, var, QQ, PolynomialRing, cached_function, dimension_cusp_forms, O, PowerSeriesRing) global_ring = PolynomialRing(QQ, names="t,s") def derivative_exp(f, n, t): if n == 0: return f else: return derivative_exp(t * f...
8,747
30.467626
79
py
degree2
degree2-master/utils.py
# -*- coding: utf-8 -*- from __future__ import print_function import traceback from multiprocessing import Process, Pipe, cpu_count import operator from itertools import groupby from abc import ABCMeta, abstractmethod import sage from sage.misc.cachefunc import cached_function from sage.all import CC, RR, factorial, ...
7,573
24.761905
82
py
degree2
degree2-master/__init__.py
# -*- coding: utf-8 -*-
24
11.5
23
py
degree2
degree2-master/elements.py
# -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod import operator from itertools import imap import sage from sage.all import (QQ, save, load, gcd, PolynomialRing, divisors, mod, vector) from degree2.utils import (is_number, list_group_by, CommRingLikeElment, pmap) from degree2.b...
39,573
32.881849
92
py
degree2
degree2-master/standard_l_scalar_valued.py
# -*- coding: utf-8; mode: sage -*- ''' Algebraic part of a value of the standard L of Siegel cusp forms of degree 2. Cf. [Kat] H. Katsurada, exact standard zeta values of Siegel modular forms, Experimental Mathematics (2010), 19:1, 65-77 Original implementation was done by H. Katsurada by the wolfram language. ''' fr...
4,536
32.858209
92
py
degree2
degree2-master/scalar_valued_smfs.py
# -*- coding: utf-8 -*- import os import operator from abc import ABCMeta, abstractproperty import sage from sage.misc.cachefunc import cached_method, cached_function from sage.all import (QQ, save, load, gcd, PolynomialRing, ZZ, CuspForms, floor, matrix, factor, sqrt, ceil, ...
22,427
30.994294
83
py
degree2
degree2-master/diff_operator_pullback_vector_valued.py
# -*- coding: utf-8 -*- ''' cf. [Bö] S.Böcherer, Über die Fourier-Jacobi-Entwickling Siegelscher Eisensteinreihen II, Mathematische Zeichtschrift, 189 (1985), 81 - 110. [BSY] S. Böcherer, T. Satoh, T. Yamazaki, On the pullback of a differential operator and its application to vector valued Eisenstein series, Comment. ...
12,790
32.484293
96
py
degree2
degree2-master/rankin_cohen_diff.py
# -*- coding: utf-8 -*- from sage.all import QQ, PolynomialRing, matrix, log, cached_function, fork from degree2.utils import mul, combination, group, pmap from degree2.elements import SymWtGenElt as SWGElt from degree2.elements import (QexpLevel1, QseriesTimesQminushalf, ModFormQexpLev...
17,142
31.467803
89
py
degree2
degree2-master/basic_operation.py
# -*- coding: utf-8 -*- import multiprocessing from sage.all import Integer, ZZ, gcd, QQ, mod, floor, sqrt from sage.misc.cachefunc import cached_function from degree2.utils import (list_group_by, partition_weighted, _is_triple_of_integers, pmap) def _common_base_ring(r1, r2): if r1.h...
12,176
28.555825
82
py
degree2
degree2-master/interpolate.py
# -*- coding: utf-8 -*- import multiprocessing from degree2.basic_operation import PrecisionDeg2 from degree2.elements import ModFormQexpLevel1, QexpLevel1 from degree2.utils import group, mul, pmap from sage.all import QQ, ZZ, PolynomialRing, floor, matrix, sqrt def _to_polynomial(f, val1): prec = f.prec.value ...
3,922
34.026786
90
py
degree2
degree2-master/vector_valued_impl/utils.py
# -*- coding: utf-8; mode: sage -*- import os data_dir = os.path.join(os.getenv("HOME"), "data/vector_valued")
112
21.6
64
py
degree2
degree2-master/vector_valued_impl/__init__.py
0
0
0
py
degree2
degree2-master/vector_valued_impl/sym2/odd_structure.py
''' This module provides functions gen_consts and ignored_dct. cf. Ibukiyama, Vector valued Siegel modular forms of symmetric tensor weight of small degrees. ''' from degree2.const import ScalarModFormConst as SMFC from degree2.const import ConstVectValued def cvv(w1, w2, w3): return ConstVectValued(2, [SMFC([w]...
556
23.217391
76
py
degree2
degree2-master/vector_valued_impl/sym2/even_structure.py
'''This module provides functions gen_consts and ignored_dct. cf. Satoh, On vector valued Siegel modular forms of degree two. ''' from degree2.const import ScalarModFormConst as SMFC from degree2.const import ConstVectValued def cvv(w1, w2): return ConstVectValued(2, [SMFC([w1]), SMFC([w2])], inc=0, tp=None) d...
531
25.6
71
py
degree2
degree2-master/vector_valued_impl/sym2/__init__.py
0
0
0
py
degree2
degree2-master/vector_valued_impl/tests/test_eigenvalue.py
from sage.all import (ComplexField, NumberField, PolynomialRing, CuspForms, QQ, CartesianProduct, fork) import unittest from degree2.vector_valued_smfs import vector_valued_siegel_modular_forms as vvsmf from degree2.basic_operation import number_of_procs def _hecke_pol_klingen(k, j): '''k: e...
3,563
38.6
88
py
degree2
degree2-master/vector_valued_impl/tests/__init__.py
0
0
0
py
degree2
degree2-master/vector_valued_impl/sym4/odd_structure.py
''' This module provides functions gen_consts and ignored_dct. cf. Ibukiyama, Vector valued Siegel modular forms of symmetric tensor weight of small degrees. ''' from degree2.const import ScalarModFormConst as SMFC from degree2.const import ConstVectValued def cvv(w1, w2, w3): return ConstVectValued(4, [SMFC([w]...
545
22.73913
76
py
degree2
degree2-master/vector_valued_impl/sym4/even_structure.py
''' This module provides functions gen_consts and ignored_dct. cf. Ibukiyama, Vector valued Siegel modular forms of symmetric tensor weight of small degrees. ''' from degree2.const import ScalarModFormConst as SMFC from degree2.const import ConstVectValued def cvv(w1, w2, inc=0): return ConstVectValued(4, [SMFC(...
517
22.545455
76
py
degree2
degree2-master/vector_valued_impl/sym4/__init__.py
0
0
0
py
degree2
degree2-master/vector_valued_impl/sym10/relation.py
''' This module provides a function 'relation' that returns a linear relation as a dictionary among generators. ''' from sage.all import QQ, gcd from degree2.vector_valued_smfs import vector_valued_siegel_modular_forms as vvsmf def relation(wt, data_directory=None): '''For a given weight wt, this funciton return...
1,135
36.866667
82
py
degree2
degree2-master/vector_valued_impl/sym10/odd_structure.py
# -*- coding: utf-8 -*- '''This module provides functions gen_consts and ignored_dct.''' from degree2.const import ScalarModFormConst as SMFC from degree2.const import (CalculatorVectValued, ConstDivision, ConstMul, ConstVectValued) from sage.all import QQ, PolynomialRing from degree2.vecto...
6,057
31.223404
86
py
degree2
degree2-master/vector_valued_impl/sym10/even_structure.py
# -*- coding: utf-8; mode: sage -*- '''This modules provides functions gen_consts and ignored_dct. ''' from sage.all import Integer, matrix import os from degree2.const import ScalarModFormConst as SMFC from degree2.const import (CalculatorVectValued, ConstDivision, ConstMul, ConstVectValued)...
9,857
33.711268
74
py
degree2
degree2-master/vector_valued_impl/sym10/__init__.py
0
0
0
py
degree2
degree2-master/vector_valued_impl/sym10/tests/test_relation.py
'''Test relations among generators. ''' import unittest from degree2.vector_valued_impl.sym10.module_of_given_wt import relation, sym10_space import os from degree2.const import CalculatorVectValued from degree2.vector_valued_impl.sym10.even_structure import gen_consts as even_gen_consts from degree2.vector_valued_impl...
1,342
40.96875
89
py
degree2
degree2-master/vector_valued_impl/sym10/tests/test_division.py
''' A module for testing generators of smaller weights. ''' import unittest from degree2.const import CalculatorVectValued from degree2.vector_valued_impl.sym10.even_structure import _wt18_consts from degree2.const import ConstVectValuedHeckeOp as CVH from degree2.const import ConstDivision, ScalarModFormConst from deg...
7,508
32.977376
89
py
degree2
degree2-master/vector_valued_impl/sym10/tests/test_ramanujan_conj.py
'''This module tests Ramanujan conjecture for eigenforms in M_{det^k Sym(10)} for k <= 29 and tests Hecke polynomials of degree 4 for known lifts and Eisenstein series. ''' import os from degree2.vector_valued_impl.sym10.module_of_given_wt import sym10_space from sage.all import ComplexField, NumberField, PolynomialRin...
4,232
39.701923
89
py
degree2
degree2-master/vector_valued_impl/sym10/tests/__init__.py
0
0
0
py
degree2
degree2-master/tests/test_interpolate.py
# -*- coding: utf-8 -*- import unittest from degree2.all import eisenstein_series_degree2, x35_with_prec from degree2.interpolate import calc_forms, det_deg2 class TestInterpolate(unittest.TestCase): def test_interpolate(self): prec = 15 es4 = eisenstein_series_degree2(4, prec) x35 = x35...
1,297
36.085714
78
py
degree2
degree2-master/tests/test_fc_mul_add.py
# -*- coding: utf-8 -*- from degree2.scalar_valued_smfs import eisenstein_series_degree2, QexpLevel1,\ x10_with_prec, x12_with_prec, x35_with_prec, ModFormQexpLevel1 from degree2.basic_operation import PrecisionDeg2 import unittest from sage.all import FiniteField, ZZ, QQ, PolynomialRing import operator global_pre...
8,797
30.992727
78
py
degree2
degree2-master/tests/test_eigenforms.py
# -*- coding: utf-8 -*- import unittest import operator from sage.all import NumberField, QQ, var, Integer, ZZ, PolynomialRing from degree2.scalar_valued_smfs import ( eisenstein_series_degree2, x10_with_prec, x12_with_prec, x35_with_prec, KlingenEisensteinAndCuspForms, CuspFormsDegree2) from .data_...
6,618
33.473958
94
py
degree2
degree2-master/tests/misc_test.py
# -*- coding: utf-8 -*- import unittest from unittest import skip from degree2.basic_operation import ( PrecisionDeg2, semi_pos_def_matarices, _spos_def_mats_lt) from degree2.scalar_valued_smfs import (KlingenEisensteinAndCuspForms, eisenstein_series_degree2, ...
5,310
36.666667
98
py
degree2
degree2-master/tests/data_dir.py
import os.path as opath from sage.all import load def data_dir(name): return opath.join(opath.dirname(opath.abspath(__file__)), "data", name) def load_from_data_dir(fname, dirname): return load(opath.join(data_dir(dirname), fname))
244
21.272727
75
py
degree2
degree2-master/tests/test_save_load.py
# -*- coding: utf-8 -*- import unittest from degree2.scalar_valued_smfs import eisenstein_series_degree2, x12_with_prec, x35_with_prec,\ ModFormQexpLevel1, QexpLevel1 import tempfile from sage.all import FiniteField, ZZ global_prec = 8 es4 = eisenstein_series_degree2(4, global_prec) qsres4 = QexpLevel1(es4.fc_dct,...
2,241
32.462687
96
py
degree2
degree2-master/tests/test_prec_class.py
# -*- coding: utf-8 -*- import unittest from degree2.basic_operation import PrecisionDeg2, reduced_form_with_sign class TestPrecClass(unittest.TestCase): def test_eq(self): l = [(n, r, m) for n, r, m in PrecisionDeg2(10) if n == 10 and m == 10] self.assertTrue(PrecisionDeg2(10) == PrecisionDeg2(l...
1,501
37.512821
87
py
degree2
degree2-master/tests/test_divide.py
# -*- coding: utf-8 -*- import unittest # from unittest import skip from degree2.scalar_valued_smfs import eisenstein_series_degree2, x10_with_prec from degree2.rankin_cohen_diff import rankin_cohen_pair_sym class TestDivide(unittest.TestCase): def testdivide(self): prec = 10 x10 = x10_with_prec...
996
31.16129
79
py
degree2
degree2-master/tests/test_const.py
'''A module for testing degree2.const. ''' import unittest from degree2.const import (ConstMul, ConstDivision, ConstVectValued, dependencies, needed_precs, ConstVectValuedHeckeOp) from degree2.all import degree2_modular_forms_ring_level1_gens from degree2.scalar_valued_smfs import x10_with_p...
4,115
36.761468
78
py
degree2
degree2-master/tests/test_vector_valued.py
# -*- coding: utf-8 -*- import os.path as opath import unittest # from unittest import skip from sage.all import CuspForms, PolynomialRing, QQ, matrix, identity_matrix from degree2.scalar_valued_smfs import ( eisenstein_series_degree2, degree2_modular_forms_ring_level1_gens, x5__with_prec) from degree2.elem...
5,627
35.545455
78
py
degree2
degree2-master/tests/__init__.py
0
0
0
py
degree2
degree2-master/tests/test_pullback_se_vector_valued.py
# -*- coding: utf-8 -*- import unittest from degree2.diff_operator_pullback_vector_valued import ( bracket_power, ad_bracket, _Z_U_ring, _diff_z_exp, fc_of_pullback_of_diff_eisen, _U_ring, sqcap_mul, D_tilde_nu, algebraic_part_of_standard_l, _pullback_vector, _u3_u4_nonzero) from sage.all import (random_mat...
10,101
38.155039
99
py
degree2
degree2-master/tests/test_all.py
import os import re # import imp from os.path import dirname, isfile, join pat = re.compile(".*test.+py$") this_dir = dirname(__file__) def test_module_names(): return [f for f in os.listdir(this_dir) if re.match(pat, f) and isfile(join(this_dir, f)) and join(this_dir, f) != __file__] from degree2.t...
774
28.807692
76
py
degree2
degree2-master/tests/test_gens.py
# -*- coding: utf-8 -*- import unittest from degree2.scalar_valued_smfs import eisenstein_series_degree2, x10_with_prec, x12_with_prec,\ x35_with_prec from degree2.basic_operation import PrecisionDeg2 from .data_dir import load_from_data_dir fc_dct4 = load_from_data_dir("es4_fc_dct.sobj", "eigen_forms") fc_dct6 ...
1,528
30.204082
96
py
degree2
degree2-master/tests/test_pullback_se_scalar_valued.py
import unittest from sage.all import random_prime, matrix, PolynomialRing, QQ, mul, vector from degree2.all import CuspFormsDegree2 from degree2.standard_l_scalar_valued import (epsilon_tilde_l_k_degree2, tpl_to_half_int_mat, first_elt_of_kern_of_vandermonde) from degree2.b...
1,824
40.477273
93
py
SAFE
SAFE-master/safe.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni from asm_embedding.FunctionAnalyzerRadare import RadareFunctionAnalyzer from argparse import ArgumentParser from asm_embedding.FunctionNormalizer import FunctionNormalizer from asm_embedding....
2,105
35.947368
114
py
SAFE
SAFE-master/downloader.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import argparse import os import sys from subprocess import call class Downloader: def __init__(self): parser = argparse.ArgumentParser(description='SAFE downloader') p...
5,027
46.885714
281
py
SAFE
SAFE-master/__init__.py
0
0
0
py
SAFE
SAFE-master/dataset_creation/DatabaseFactory.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni from asm_embedding.InstructionsConverter import InstructionsConverter from asm_embedding.FunctionAnalyzerRadare import RadareFunctionAnalyzer import json import multiprocessing from multiproce...
6,785
38.684211
118
py
SAFE
SAFE-master/dataset_creation/ExperimentUtil.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import argparse from dataset_creation import DatabaseFactory, DataSplitter, FunctionsEmbedder from utils.utils import print_safe def debug_msg(): msg = "SAFE DATABASE UTILITY" msg +=...
5,282
47.916667
120
py
SAFE
SAFE-master/dataset_creation/DataSplitter.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import json import random import sqlite3 from tqdm import tqdm class DataSplitter: def __init__(self, db_name): self.db_name = db_name def create_pair_table(self, table_nam...
5,467
37.237762
119
py
SAFE
SAFE-master/dataset_creation/__init__.py
0
0
0
py
SAFE
SAFE-master/dataset_creation/convertDB.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import sqlite3 import json from networkx.readwrite import json_graph import logging from tqdm import tqdm from asm_embedding.InstructionsConverter import InstructionsConverter # Create the d...
4,558
36.368852
134
py
SAFE
SAFE-master/dataset_creation/FunctionsEmbedder.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni from asm_embedding.FunctionNormalizer import FunctionNormalizer import json from neural_network.SAFEEmbedder import SAFEEmbedder import numpy as np import sqlite3 from tqdm import tqdm class...
2,021
37.884615
118
py
SAFE
SAFE-master/neural_network/SAFE_model.py
# SAFE TEAM # distributed under license: GPL 3 License http://www.gnu.org/licenses/ from SiameseSAFE import SiameseSelfAttentive from PairFactory import PairFactory import tensorflow as tf import random import sys, os import numpy as np from sklearn import metrics import matplotlib import tqdm matplotlib.use('Agg') i...
13,262
43.959322
119
py
SAFE
SAFE-master/neural_network/SiameseSAFE.py
import tensorflow as tf # SAFE TEAM # # # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) # # Siamese Self-Attentive Network for Binary Similarity: # # arXiv Nostro. # # based on the self attentive network:arXiv:1703.03130 Z. Lin at al. “A structured self-a...
7,721
48.819355
155
py
SAFE
SAFE-master/neural_network/SAFEEmbedder.py
import tensorflow as tf # SAFE TEAM # distributed under license: GPL 3 License http://www.gnu.org/licenses/ class SAFEEmbedder: def __init__(self, model_file): self.model_file = model_file self.session = None self.x_1 = None self.adj_1 = None self.len_1 = None self....
1,282
31.075
121
py
SAFE
SAFE-master/neural_network/parameters.py
# SAFE TEAM # distributed under license: GPL 3 License http://www.gnu.org/licenses/ import argparse import time import sys, os import logging # # Parameters File for the SAFE network. # # Authors: SAFE team def getLogger(logfile): logger = logging.getLogger(__name__) hdlr = logging.FileHandler(logfile) ...
5,285
37.867647
118
py
SAFE
SAFE-master/neural_network/__init__.py
0
0
0
py
SAFE
SAFE-master/neural_network/PairFactory.py
# SAFE TEAM # distributed under license: GPL 3 License http://www.gnu.org/licenses/ import sqlite3 import json import numpy as np from multiprocessing import Queue from multiprocessing import Process from asm_embedding.FunctionNormalizer import FunctionNormalizer # # PairFactory class, used for training the SAFE net...
6,350
32.962567
150
py
SAFE
SAFE-master/neural_network/train.py
from SAFE_model import modelSAFE from parameters import Flags import sys import os import numpy as np from utils import utils import traceback def load_embedding_matrix(embedder_folder): matrix_file='embedding_matrix.npy' matrix_path=os.path.join(embedder_folder,matrix_file) if os.path.isfile(matrix_path)...
2,675
30.482353
103
py
SAFE
SAFE-master/utils/utils.py
from pyfiglet import figlet_format def print_safe(): a = figlet_format('SAFE', font='starwars') print(a) print("By Massarelli L., Di Luna G. A., Petroni F., Querzoni L., Baldoni R.") print("Please cite: http://arxiv.org/abs/1811.05296 \n")
257
31.25
81
py
SAFE
SAFE-master/utils/__init__.py
0
0
0
py
SAFE
SAFE-master/function_search/FunctionSearchEngine.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import sys import numpy as np import sqlite3 import pandas as pd import tqdm import tensorflow as tf if sys.version_info >= (3, 0): from functools import reduce pd.set_option('display.m...
5,075
34.25
137
py
SAFE
SAFE-master/function_search/fromJsonSearchToPlot.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import matplotlib.pyplot as plt import json import math import numpy as np from multiprocessing import Pool def find_dcg(element_list): dcg_score = 0.0 for j, sim in enumerate(elemen...
3,260
25.088
114
py
SAFE
SAFE-master/function_search/EvaluateSearchEngine.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni from FunctionSearchEngine import FunctionSearchEngine from sklearn import metrics import sqlite3 from multiprocessing import Process import math import warnings import random import json c...
4,821
35.255639
139
py
SAFE
SAFE-master/function_search/__init__.py
0
0
0
py
SAFE
SAFE-master/asm_embedding/FunctionNormalizer.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import numpy as np class FunctionNormalizer: def __init__(self, max_instruction): self.max_instructions = max_instruction def normalize(self, f): f = np.asarray(f[0...
1,121
29.324324
114
py
SAFE
SAFE-master/asm_embedding/DocumentManipulation.py
import json import re import os def list_to_str(li): i='' for x in li: i=i+' '+x i=i+' endfun'*5 return i def document_append(strin): with open('/Users/giuseppe/docuent_X86','a') as f: f.write(strin) ciro=set() cantina=[] num_total=0 num_filtered=0 with open('/Users/giuseppe/dump....
869
22.513514
54
py
SAFE
SAFE-master/asm_embedding/__init__.py
0
0
0
py
SAFE
SAFE-master/asm_embedding/FunctionAnalyzerRadare.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import json import r2pipe class RadareFunctionAnalyzer: def __init__(self, filename, use_symbol, depth): self.r2 = r2pipe.open(filename, flags=['-2']) self.filename = fi...
5,885
29.030612
117
py
SAFE
SAFE-master/asm_embedding/InstructionsConverter.py
# SAFE TEAM # Copyright (C) 2019 Luca Massarelli, Giuseppe Antonio Di Luna, Fabio Petroni, Leonardo Querzoni, Roberto Baldoni import json class InstructionsConverter: def __init__(self, json_i2id): f = open(json_i2id, 'r') self.i2id = json.load(f) f.close() def convert_to_ids(self,...
1,118
32.909091
114
py
CaBERT-SLU
CaBERT-SLU-main/baseline_midsf.py
"""For model training and inference Data input should be a single sentence. """ import random import torch import torch.nn as nn from torch.autograd import Variable from torch.optim import Adam, RMSprop from transformers import BertTokenizer, BertModel, BertConfig from keras.preprocessing.sequence import pad_sequences...
16,880
36.182819
138
py
CaBERT-SLU
CaBERT-SLU-main/all_data_context.py
import torch as t from torch.utils.data import Dataset, DataLoader import pickle from config import opt from sklearn.model_selection import train_test_split import numpy as np from keras.preprocessing.sequence import pad_sequences class Turns: def __init__(self, token_ids, slot_ids): token_ids, mask = self...
4,711
34.164179
113
py
CaBERT-SLU
CaBERT-SLU-main/all_data_slot.py
import torch as t from torch.utils.data import Dataset, DataLoader import pickle from config import opt from sklearn.model_selection import train_test_split from keras.preprocessing.sequence import pad_sequences import numpy as np class CoreDataset(Dataset): def __init__(self, data, num_labels, num_slot_labels, o...
1,819
29.847458
100
py
CaBERT-SLU
CaBERT-SLU-main/utils.py
import random import torch import torch.nn as nn from torch.autograd import Variable from torch.optim import Adam, RMSprop from transformers import BertTokenizer, BertModel, BertConfig, AdamW from keras.preprocessing.sequence import pad_sequences from sklearn.model_selection import train_test_split import pickle impor...
6,421
34.877095
115
py
CaBERT-SLU
CaBERT-SLU-main/config.py
class Config: #################### For BERT fine-tuning #################### # control datatype = "e2e" retrain = False # Reuse trained model weights test_mode = "data" # "validation", "data" data_mode = "multi" #"single" # single or multi intent in data ###########...
1,463
39.666667
122
py
CaBERT-SLU
CaBERT-SLU-main/bert_context.py
"""For model training and inference (multi dialogue act & slot detection) """ import random import torch import torch.nn as nn from torch.autograd import Variable from torch.optim import Adam, RMSprop from transformers import BertTokenizer, BertModel, BertConfig, AdamW from keras.preprocessing.sequence import pad_sequ...
15,293
36.211679
192
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/._config.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/._all_data_slot.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/._all_data_context.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/._utils.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/._baseline_midsf.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/._bert_context.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/baseline_stackprop/._train.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/baseline_stackprop/._utils_bert.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/baseline_stackprop/utils/.___init__.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/baseline_stackprop/utils/._process.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py
CaBERT-SLU
CaBERT-SLU-main/__MACOSX/CaBERT-SLU-main/baseline_stackprop/utils/._miulab.py
Mac OS X  2ATTR<<com.apple.quarantineq/0081;6067ce05;Chrome;EB6190ED-75B9-4A04-87B2-88BD2FC5C689
207
207
207
py