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 |
|---|---|---|---|---|---|---|
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/gui.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# gui.py
# Purpose: control a continuously running LAMMPS simulation via a Tkinter GUI
# Syntax: gui.py in.lammps Nfreq
# in.lammps = LAMMPS input script
# Nfreq = query GUI every this many steps
# IMPORTANT: thi... | 2,805 | 23.831858 | 77 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/viz_atomeye.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# viz_atomeye.py
# Purpose: viz running LAMMPS simulation via AtomEye
# Syntax: viz_atomeye.py in.lammps Nfreq Nsteps
# in.lammps = LAMMPS input script
# Nfreq = dump and viz shapshot every this many steps
# ... | 1,913 | 25.219178 | 74 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/viz_vmd.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# viz_vmd.py
# Purpose: viz running LAMMPS simulation via VMD
# Syntax: viz_vmd.py in.lammps Nfreq Nsteps
# in.lammps = LAMMPS input script
# Nfreq = dump and viz shapshot every this many steps
# Nsteps =... | 2,063 | 21.434783 | 74 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/vizplotgui_vmd.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# vizplotgui_vmd.py
# Purpose: viz running LAMMPS simulation via VMD with plot and GUI
# Syntax: vizplotgui_vmd.py in.lammps Nfreq compute-ID
# in.lammps = LAMMPS input script
# Nfreq = plot data point and viz sha... | 4,390 | 24.235632 | 75 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/viz_pymol.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# viz_pymol.py
# Purpose: viz running LAMMPS simulation via PyMol
# Syntax: viz_pymol.py in.lammps Nfreq Nsteps
# in.lammps = LAMMPS input script
# Nfreq = dump and viz shapshot every this many steps
# Ns... | 1,874 | 21.590361 | 74 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/vizplotgui_pymol.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# vizplotgui_pymol.py
# Purpose: viz running LAMMPS simulation via PyMol with plot and GUI
# Syntax: vizplotgui_pymol.py in.lammps Nfreq compute-ID
# in.lammps = LAMMPS input script
# Nfreq = plot data point and v... | 4,404 | 24.171429 | 75 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/demo.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# demo.py
# Purpose: illustrate use of many library interface commands
# Syntax: demo.py
# uses in.demo as LAMMPS input script
import sys
# parse command line
argv = sys.argv
if len(argv) != 1:
print "Syntax: demo.py"... | 1,430 | 22.080645 | 61 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/plot.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# plot.py
# Purpose: plot Temp of running LAMMPS simulation via GnuPlot in Pizza.py
# Syntax: plot.py in.lammps Nfreq Nsteps compute-ID
# in.lammps = LAMMPS input script
# Nfreq = plot data point every this many s... | 1,869 | 23.605263 | 73 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/trivial.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# trivial.py
# Purpose: run a LAMMPS input script via Python
# Syntax: trivial.py in.lammps
# in.lammps = LAMMPS input script
import sys
# parse command line
argv = sys.argv
if len(argv) != 2:
print "Syntax: trivial.p... | 793 | 18.365854 | 61 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/vizplotgui_gl.py | #!/usr/bin/env python -i
# preceeding line should have path for Python on your machine
# vizplotgui_gl.py
# Purpose: viz running LAMMPS simulation via GL tool with plot and GUI
# Syntax: vizplotgui_gl.py in.lammps Nfreq compute-ID
# in.lammps = LAMMPS input script
# Nfreq = plot data point and viz s... | 4,373 | 23.852273 | 75 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/pizza/gnu.py | # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is... | 12,601 | 31.817708 | 79 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/pizza/dump.py | # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is... | 40,308 | 31.771545 | 79 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/pizza/pdbfile.py | # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is... | 9,342 | 31.217241 | 117 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/pizza/vmd.py | # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is... | 8,758 | 38.102679 | 148 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/pizza/vizinfo.py | # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is... | 13,236 | 32.767857 | 78 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/python/examples/pizza/gl.py | # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is... | 43,711 | 31.866165 | 79 | py |
LIGGGHTS-WITH-BONDS | LIGGGHTS-WITH-BONDS-master/doc/Scripts/correlate.py | #!/usr/bin/env python
"""
function:
parse the block of thermo data in a lammps logfile and perform auto- and
cross correlation of the specified column data. The total sum of the
correlation is also computed which can be converted to an integral by
multiplying by the timestep.
output:
stand... | 2,537 | 27.2 | 79 | py |
verrou | verrou-master/generateBackendInterOperator.py | #!/usr/bin/env python3
# This file is part of Verrou, a FPU instrumentation tool.
# Copyright (C) 2014-2021 EDF
# F. Févotte <francois.fevotte@edf.fr>
# B. Lathuilière <bruno.lathuiliere@edf.fr>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General... | 6,229 | 40.258278 | 172 | py |
verrou | verrou-master/pyTools/DD_stoch.py |
# This file is part of Verrou, a FPU instrumentation tool.
# Copyright (C) 2014-2021 EDF
# F. Févotte <francois.fevotte@edf.fr>
# B. Lathuilière <bruno.lathuiliere@edf.fr>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# pu... | 43,084 | 37.128319 | 171 | py |
verrou | verrou-master/pyTools/paraview_script.py | ##### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
import os
DATAPATH=os.environ["VERROU_PARAVIEW_DATA_PATH"]
try:
DATAPATH
except NameError:
print("Please set the DATAPATH variable with the... | 2,245 | 26.728395 | 168 | py |
verrou | verrou-master/pyTools/rounding_tool.py | #!/usr/bin/python3
import sys
roundingDetTab=["nearest","upward","downward", "toward_zero", "away_zero","farthest","float","ftz"]
roundingNonDetTab=[x+y for x in ["random", "average", "prandom"] for y in ["","_det","_comdet"]] +[x+y for x in ["random", "average"] for y in ["_scomdet"]]+["sr_monotonic"]
allRoundingTa... | 2,865 | 33.119048 | 173 | py |
verrou | verrou-master/pyTools/DD.py | #!/usr/bin/env python3
# $Id: DD.py,v 1.2 2001/11/05 19:53:33 zeller Exp $
# Enhanced Delta Debugging class
# Copyright (c) 1999, 2000, 2001 Andreas Zeller.
# This module (written in Python) implements the base delta debugging
# algorithms and is at the core of all our experiments. This should
# easily run on any pl... | 31,416 | 29.710655 | 115 | py |
verrou | verrou-master/pyTools/post_config.py | import getopt
import os
import sys
import re
import copy
from . import gen_config
from . import rounding_tool
class postConfig(gen_config.gen_config):
def __init__(self, argv, environ,config_keys=["POST"]):
super().__init__(argv,environ, config_keys)
self.normalize()
self.check_instr_tab... | 6,419 | 36.54386 | 181 | py |
verrou | verrou-master/pyTools/dd_config.py | # This file is part of Verrou, a FPU instrumentation tool.
# Copyright (C) 2014-2021 EDF
# F. Févotte <francois.fevotte@edf.fr>
# B. Lathuilière <bruno.lathuiliere@edf.fr>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# pub... | 5,918 | 40.391608 | 202 | py |
verrou | verrou-master/pyTools/DD_exec_stat.py | # This file is part of Verrou, a FPU instrumentation tool.
# Copyright (C) 2014-2021 EDF
# F. Févotte <francois.fevotte@edf.fr>
# B. Lathuilière <bruno.lathuiliere@edf.fr>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# pub... | 1,983 | 30.492063 | 103 | py |
verrou | verrou-master/pyTools/gen_config.py | import getopt
import os
import sys
import re
import copy
class gen_config:
def __init__(self, argv, environ,config_keys=["INTERFLOP"], lengthValidTab=[2]):
self.config_keys=config_keys
self.registryTab =[]
self.registerOptions()
self.readDefaultValueFromRegister()
self.pars... | 7,593 | 38.14433 | 176 | py |
verrou | verrou-master/pyTools/convNumLineTool.py | #!/usr/bin/python3
import sys
import difflib
class convNumLineTool:
"""convNumLineTool provides a way to update a delta line when the search space
computed by two delta-debug run (ie the two reference computations).
The class user has to provide the two search spaces and two functions (one to partition
... | 5,044 | 36.649254 | 108 | py |
verrou | verrou-master/Interlibmath/testCos.py | #!/usr/bin/env python3
import math
import sys
import numpy
x=float(sys.argv[1])
y=numpy.nextafter(x,math.inf)
for i in range(4):
print("cos(x)-cos(x): ", math.cos(x)-math.cos(x))
print("cos(x)-cos(y): ", math.cos(x)-math.cos(y))
| 242 | 15.2 | 53 | py |
verrou | verrou-master/interflop_backends/interflop_verrou/gen_interflop_verrou_flop_impl.py | #!/usr/bin/python3
import sys
listOfUnaryOp=["sqrt"]
listOfBinaryOp=["add","sub","mul","div"]
listOfTernaryOp=["madd"]
listOfType=["double","float"]
protoTypeUnary="""
IFV_INLINE void IFV_FCTNAME(/OP/_/TYPE/) (/TYPE/ a, /TYPE/* res,void* context) {
typedef OpWithDynSelectedRoundingMode</OPCLASS/ </TYPE/> > Op;
... | 8,887 | 35.727273 | 170 | py |
verrou | verrou-master/interflop_backends/interflop_verrou/prng/genXoshiro.py | #!/usr/bin/python3
import os
import sys
#Script use to generate all xoshiro function with a specific name to be able to use different one in the same binary. If you accept modern C++ (>17) you should consider
# https://github.com/Reputeless/Xoshiro-cpp instead.
repOrgImpl="org"
def extractFun(fileName, name):
... | 4,265 | 30.367647 | 168 | py |
verrou | verrou-master/check_perf_tools/gen_stat.py | #!/usr/bin/python3
import os
import re
import sys
import subprocess
import math
from tabular import *
detRounding=["random_det","average_det", "random_comdet","average_comdet", "random_scomdet","average_scomdet", "sr_monotonic"]
roundingListNum=["random", "average", "nearest", "upward", "downward"]
buildConfList=[ "c... | 8,753 | 37.734513 | 313 | py |
verrou | verrou-master/check_perf_tools/tabular.py |
class tabular:
def __init__(self):
self.currentStr=""
def begin(self):
pass
def end(self):
pass
def lineSep(self):
print("")
def endLine(self):
print(self.currentStr)
self.currentStr=""
def line(self,tab):
self.currentStr+=("\t".join(tab))... | 1,646 | 26.45 | 88 | py |
verrou | verrou-master/check_perf_tools/gen_build.py | #!/usr/bin/python3
import os
import re
import sys
import subprocess
gitRepositoty="origin/"
gitRepositoty=""
branch="master"
valgrind_version="valgrind-3.21.0"
verrouConfigList={
"stable": { "tag":"v2.4.0" ,"flags":"--enable-verrou-fma"},
"current": { "valgrind":valgrind_version, "branch... | 4,201 | 45.175824 | 195 | py |
verrou | verrou-master/check_perf_tools/gen_perf.py | #!/usr/bin/python3
import os
import re
import sys
import subprocess
from tabular import *
roundingListPerf=["random", "average","nearest"]
detRounding=["random_det","average_det", "random_comdet","average_comdet","random_scomdet","average_scomdet", "sr_monotonic"]
buildConfigList=["stable","current", "current_fast"... | 9,679 | 34.2 | 157 | py |
verrou | verrou-master/synchroLib/trace_verrou_synchro.py | #! /usr/bin/python3.5
# portions copyright 2001, Autonomous Zones Industries, Inc., all rights...
# err... reserved and offered to the public under the terms of the
# Python 2.2 license.
# Author: Zooko O'Whielacronx
# http://zooko.com/
# mailto:zooko@zooko.com
#
# Copyright 2000, Mojam Media, Inc., all rights reserv... | 32,905 | 35.643653 | 82 | py |
verrou | verrou-master/synchroLib/verrouPyBinding.py | #!/usr/bin/python3
import sys, platform
import ctypes, ctypes.util
import os
import os.path
class bindingSynchroLib:
def __init__(self, pathLib=None):
if(pathLib!=None):
self.lib=ctypes.CDLL(pathLib)
else:
self.lib=ctypes.CDLL(searchDefaultPath("verrouSynchroLib.so") )... | 4,470 | 29.209459 | 84 | py |
verrou | verrou-master/synchroLib/tstDDPython/Muller.py | #!/usr/bin/python3
def muller(nt,verbose=False):
x0 = 11./2.;
x1 = 61./11.;
for it in range(nt):
temp0 = 3000./x0;
temp1 = 1130. - temp0;
temp2 = temp1 /x1 ;
x2 = 111. - temp2;
if verbose:
print("it: %i\tx2: %f\ttemp0: %f\ttemp1: %f\ttemp2: %f"%... | 472 | 15.310345 | 94 | py |
verrou | verrou-master/synchroLib/tstDDPython/extractOrCmp.py | #!/usr/bin/python3
import sys
import os
def extractValue(rep):
lines=(open(os.path.join(rep,"res.dat")).readlines())
for line in lines:
if line.startswith("x[12]="):
return float(line.partition("=")[2])
return None
if __name__=="__main__":
if len(sys.argv)==2:
... | 603 | 22.230769 | 57 | py |
verrou | verrou-master/unitTest/check-verrou-dd-synchro/cmp.py | #!/usr/bin/python3
import sys
import os
def extract(rep):
fileName=os.path.join(rep,"res.out")
value=float(open(fileName).readline().split(":")[1])
return value
def cmpRep(repRef,rep):
valueRef=extract(repRef)
value=extract(rep)
print("valueRef: ",valueRef)
print("value: ",value)
... | 690 | 19.323529 | 56 | py |
verrou | verrou-master/unitTest/check-libM/genTab.py | #!/usr/bin/env python3
import sys
import math
def readFile(fileName):
data=(open(fileName).readlines())
keyData=data[0].split()
brutData=[line.split() for line in data[1:]]
res={}
for index in range(len(keyData)):
fileNameKey=fileName.replace("res","")
dataIndex=[float(line[index])... | 3,645 | 33.396226 | 145 | py |
verrou | verrou-master/unitTest/checkRounding/runCheck.py | #!/usr/bin/env python3
# This file is part of Verrou, a FPU instrumentation tool.
# Copyright (C) 2014-2021 EDF
# F. Févotte <francois.fevotte@edf.fr>
# B. Lathuilière <bruno.lathuiliere@edf.fr>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General ... | 27,482 | 37.330544 | 262 | py |
verrou | verrou-master/unitTest/testPlotStat/dot.py | #!/usr/bin/env python3
def computeDot(v1,v2, blockSize):
totalSize=len(v1)
if totalSize!=len(v2):
print("incoherent size")
sys.exit(42)
if totalSize % blockSize !=0:
print("block size should divide total size")
sys.exit(42)
res=0.
for iExtern in range(int(... | 841 | 25.3125 | 64 | py |
verrou | verrou-master/unitTest/testPlotStat/extract.py | #!/usr/bin/env python3
import sys
blockSize=32
for line in open(sys.argv[1]+"/out"):
if line.startswith("1-dot("+str(blockSize)+")"):
print(line.split()[2])
sys.exit(0)
sys.exit(42)
| 208 | 18 | 52 | py |
verrou | verrou-master/unitTest/checkStatRounding/extract.py | #!/usr/bin/python3
import os
import sys
defaultType="double"
defaultAlgo="Seq"
def extract(fileName,typeFloat, algo):
if not typeFloat in ["double","float"]:
print("invalid ALGO_TYPE")
sys.exit(42)
if not algo in ["Seq","Rec","SeqRatio","RecRatio"]:
print("invalid ALGO")
sys.e... | 1,253 | 26.26087 | 66 | py |
verrou | verrou-master/unitTest/ddTest/ddCmpTrue.py | #!/usr/bin/env python3
import sys
sys.exit(0)
| 48 | 7.166667 | 22 | py |
verrou | verrou-master/unitTest/ddTest/ddCmp.py | #!/usr/bin/env python3
import sys
import ddRun
#DDConfig
import os
import pickle
def cmpNorm(ref, toCmp, ddCase):
print("norm")
if "dd.sym" in ref and "dd.line" not in ref:
return ddCase.statusOfSymConfig(open(os.path.join(toCmp,"path_exclude")).readline())
if "dd.line" in ref:
return dd... | 679 | 20.935484 | 94 | py |
verrou | verrou-master/unitTest/ddTest/ddCmpFalse.py | #!/usr/bin/env python3
import sys
sys.exit(1)
| 48 | 7.166667 | 22 | py |
verrou | verrou-master/unitTest/ddTest/ddRun.py | #!/usr/bin/env python3
import sys
import os
import pickle
import random
proba=1.
try:
proba = float(os.environ["DD_TEST_PROBA"])
except:
pass
def simulateRandom(fail):
if fail!=0:
if( random.random()<proba):
return fail
return 0
class ddConfig:
def __init__(self,listOf1Fai... | 14,135 | 37.102426 | 185 | py |
verrou | verrou-master/unitTest/ddTest/ddCheck.py | #!/usr/bin/env python3
import sys
import ddRun
import os
import pickle
def loadResult(rep):
if "dd.line" in rep:
pref="dd.line"
if "dd.sym" in rep:
pref="dd.sym"
listOfrddim=[[line.strip()
for line in open(os.path.join(rep,x,pref+".include")).readlines()]
... | 1,394 | 25.826923 | 97 | py |
tet-vs-hex | tet-vs-hex-master/bending/run_forces.py | import os
import json
import glob
import subprocess
import tempfile
import numpy as np
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
# out_folder = "results"
# folder_path = "meshes"
# j_file = "bar.json"
out_folder = "ar_res"
folder_path =... | 2,250 | 32.597015 | 149 | py |
tet-vs-hex | tet-vs-hex-master/bending/run_times.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
# out_folder = "times"
# folder_path = "meshes"
# j_file = "bar.json"
out_folder = "ar_times"
folder_path = "ar"
j_file ... | 1,856 | 28.951613 | 148 | py |
tet-vs-hex | tet-vs-hex-master/bending/plot_forces.py | import os
import glob
import numpy as np
import json
import plotly.graph_objs as go
import plotly.offline as plotly
colors = {'P1': 'rgb(9, 132, 227)', 'P2': 'rgb(108, 92, 231)', 'Q1': 'rgb(225, 112, 85)', 'Q2': 'rgb(214, 48, 49)'}
marker_shapes = {'P1': 'circle', 'P2': 'circle', 'Q1': 'star', 'Q2': 'star'}
marker_si... | 3,879 | 21.55814 | 115 | py |
tet-vs-hex | tet-vs-hex-master/bending/print_times.py | import os
import json
import glob
import numpy as np
def get_data(p, q):
p1 = p[0]
p2 = p[1]
q1 = q[0]
q2 = q[1]
p1 = np.mean(p1)
p2 = np.mean(p2)
q1 = np.mean(q1)
q2 = np.mean(q2)
return p1, p2, q1, q2
def print_line(title, tb, ta, ts, t, e):
string = "{}&\t{:.2e}&\t{:.2e... | 3,749 | 29.737705 | 132 | py |
tet-vs-hex | tet-vs-hex-master/bending/mesh.py | import numpy as np
import igl
import meshplot as mp
import wildmeshing as wm
mp.offline()
v=np.array([
[-10., -0.5, -50],
[-10., 0.5, -50],
[10., 0.5, -50],
[10., -0.5, -50],
#
[-10., -0.5, 50],
[-10., 0.5, 50],
[10., 0.5, 50],
[10., -0.5, 50]
])
f = np.array([
[0, 1, 2],... | 1,766 | 19.546512 | 105 | py |
tet-vs-hex | tet-vs-hex-master/plate_hole/paraview.py | import re
from paraview.simple import *
group0 = GroupDatasets()
group0.Input.Clear()
group1 = GroupDatasets()
group1.Input.Clear()
group2 = GroupDatasets()
group2.Input.Clear()
group3 = GroupDatasets()
group3.Input.Clear()
sources = []
ii = 0
for k in GetSources():
s = GetSources()[k]
if s == group0 or s == group1... | 1,653 | 18.232558 | 61 | py |
tet-vs-hex | tet-vs-hex-master/plate_hole/run.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
# out_folder = "results"
out_folder = "results_inc"
folder_path = "meshes"
current_folder = cwd = os.getcwd()
discr_orders = ... | 1,326 | 32.175 | 140 | py |
tet-vs-hex | tet-vs-hex-master/incompressible/paraview.py | from paraview.simple import *
import os
sources = []
for k in GetSources():
s = GetSources()[k]
sources.append(s)
warpeds = []
names = []
for s in sources:
name = s.FileName[0]
name = os.path.splitext(os.path.basename(name))[0]
print(name)
warped = WarpByVector(Input=s)
warped.Vectors = ['POINTS', 'solution'... | 1,273 | 23.037736 | 88 | py |
tet-vs-hex | tet-vs-hex-master/incompressible/print_times.py | import os
import json
import glob
import numpy as np
def get_data(p, q):
p1 = p[0]
p2 = p[1]
q1 = q[0]
q2 = q[1]
p1 = np.mean(p1)
p2 = np.mean(p2)
q1 = np.mean(q1)
q2 = np.mean(q2)
return p1, p2, q1, q2
def print_line(title, tb, ta, ts, t):
string = "{}&\t{:.2e}&\t{:.2e}&\... | 1,295 | 20.966102 | 128 | py |
tet-vs-hex | tet-vs-hex-master/incompressible/run.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
vtu_folder = "vtu"
json_folder = "out"
discr_orders = [1, 2]
exts = ["obj"]
folder_path = "meshes"
current_folder = cwd =... | 2,715 | 37.8 | 147 | py |
tet-vs-hex | tet-vs-hex-master/twisted_bar/paraview.py | from paraview.simple import *
colors = {'P1': [9, 132, 227], 'P2': [108, 92, 231], 'Q1': [225, 112, 85], 'Q2': [214, 48, 49]}
centre = 9.5
ii = 0
sources = []
for k in GetSources():
s = GetSources()[k]
sources.append(s)
layout = GetLayout()
layout.SplitHorizontal(0, 0.5)
SetActiveView(None)
lineChartView = Create... | 1,438 | 22.983333 | 95 | py |
tet-vs-hex | tet-vs-hex-master/twisted_bar/plot.py | import numpy as np
import math
import pandas as pd
import plotly.graph_objs as go
import plotly.offline as plotly
colors = {'P1': 'rgb(9, 132, 227)', 'P2': 'rgb(108, 92, 231)', 'Q1': 'rgb(225, 112, 85)', 'Q2': 'rgb(214, 48, 49)', 'Spline': 'rgb(45, 52, 54)'}
marker_shapes = {'P1': 'circle', 'P2': 'circle', 'Q1': 'sta... | 2,794 | 21.540323 | 144 | py |
tet-vs-hex | tet-vs-hex-master/twisted_bar/save_screen.py | from paraview.simple import *
import os
sources = []
for k in GetSources():
s = GetSources()[k]
sources.append(s)
warpeds = []
names = []
for source in sources:
name = source.FileName[0]
name = os.path.splitext(os.path.basename(name))[0]
print(name)
hexes = name.find('_h') > 0
if hexes:
calc = Calculator(s... | 1,562 | 23.421875 | 86 | py |
tet-vs-hex | tet-vs-hex-master/orthotropic/run_forces.py | import os
import json
import glob
import subprocess
import tempfile
import numpy as np
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
out_folder = "results"
folder_path = "meshes"
j_file = "ortho.json"
discr_orders = [1, 2]
fs = -np.arange(0... | 1,863 | 33.518519 | 149 | py |
tet-vs-hex | tet-vs-hex-master/orthotropic/run_times.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
out_folder = "times"
folder_path = "meshes"
j_file = "ortho.json"
discr_orders = [1, 2]
force = -0.00001
exts = ["mesh"... | 1,598 | 29.169811 | 148 | py |
tet-vs-hex | tet-vs-hex-master/orthotropic/plot_forces.py | import os
import glob
import numpy as np
import json
import plotly.graph_objs as go
import plotly.offline as plotly
colors = {'P1': 'rgb(9, 132, 227)', 'P2': 'rgb(108, 92, 231)', 'Q1': 'rgb(225, 112, 85)', 'Q2': 'rgb(214, 48, 49)'}
marker_shapes = {'P1': 'circle', 'P2': 'circle', 'Q1': 'star', 'Q2': 'star'}
marker_si... | 3,201 | 21.871429 | 115 | py |
tet-vs-hex | tet-vs-hex-master/orthotropic/print_times.py | import os
import json
import glob
import numpy as np
def get_data(p, q):
p1 = p[0]
p2 = p[1]
q1 = q[0]
q2 = q[1]
p1 = np.mean(p1)
p2 = np.mean(p2)
q1 = np.mean(q1)
q2 = np.mean(q2)
return p1, p2, q1, q2
def print_line(title, tb, ta, ts, t, e):
string = "{}&\t{:.2e}&\t{:.2e... | 2,885 | 27.019417 | 132 | py |
tet-vs-hex | tet-vs-hex-master/ars/hists.py | import os
import glob
import numpy as np
import pandas as pd
import plotly.graph_objs as go
import plotly.offline as plotly
colors = {
'tet': 'rgb(9, 132, 227)', 'P1': 'rgb(9, 132, 227)', 'P2': 'rgb(108, 92, 231)',
'hex': 'rgb(225, 112, 85)', 'Q1': 'rgb(225, 112, 85)', 'Q2': 'rgb(214, 48, 49)'}
use_logs = [... | 2,981 | 19.013423 | 98 | py |
tet-vs-hex | tet-vs-hex-master/fixed/print_table.py | import os
import json
def get_filed(data, other, field):
if field == "time":
vbase = data["time_building_basis"] + data["time_assembling_stiffness_mat"] +data["time_solving"]
vother = other["time_building_basis"] + other["time_assembling_stiffness_mat"] +other["time_solving"]
elif field == "... | 3,494 | 32.285714 | 112 | py |
tet-vs-hex | tet-vs-hex-master/fixed/run.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
out_folder = "results"
discr_orders = [2]
folder_path = "meshes"
current_folder = cwd = os.getcwd()
with open("beam.json", '... | 1,862 | 31.684211 | 108 | py |
tet-vs-hex | tet-vs-hex-master/matching_error/run.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
print(polyfem_exe)
out_folder = "err"
refs = [0, 1]
p2s = [[], [] #["square_beam.off_20.mesh"]
# ["square_beam.off_1.mesh"... | 8,306 | 50.277778 | 329 | py |
tet-vs-hex | tet-vs-hex-master/matching_error/plot.py | import os
import json
import glob
import pandas as pd
from pandas.io.json import json_normalize
import numpy as np
import pickle
import plotly.graph_objs as go
import plotly.offline as plotly
colors = {'P1': 'rgb(9, 132, 227)', 'P2': 'rgb(108, 92, 231)', 'Q1': 'rgb(225, 112, 85)', 'Q2': 'rgb(214, 48, 49)', 'SR': 'rgb... | 4,716 | 25.351955 | 228 | py |
tet-vs-hex | tet-vs-hex-master/stokes/paraview.py | from paraview.simple import *
import os
sources = []
for k in GetSources():
s = GetSources()[k]
sources.append(s)
models = []
names = []
for s in sources:
name = s.FileName[0]
name = os.path.splitext(os.path.basename(name))[0]
print(name)
Hide(s)
modelDisplay = Show(s)
ColorBy(modelDisplay, ('POINTS', 'solu... | 1,113 | 21.28 | 86 | py |
tet-vs-hex | tet-vs-hex-master/stokes/run.py | import os
import json
import glob
# import polyfempy
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
out_folder = "results"
discr_orders = [2]
folder_path = "meshes"
current_folder = cwd = os.getcwd()
with... | 1,628 | 31.58 | 131 | py |
tet-vs-hex | tet-vs-hex-master/stokes/plot.py | import os
import glob
import numpy as np
import json
import pandas as pd
import plotly.graph_objs as go
import plotly.offline as plotly
colors = {'P1': 'rgb(9, 132, 227)', 'P2': 'rgb(108, 92, 231)', 'Q1': 'rgb(225, 112, 85)', 'Q2': 'rgb(214, 48, 49)'}
marker_shapes = {'P1': 'circle', 'P2': 'circle', 'Q1': 'star', 'Q... | 2,267 | 22.625 | 115 | py |
tet-vs-hex | tet-vs-hex-master/L/run.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
out_folder = "results"
vtu_folder = "vtu"
discr_orders = [1, 2]
exts = ["mesh", "HYBRID"]
folder_path = "meshes"
current... | 1,575 | 31.833333 | 151 | py |
tet-vs-hex | tet-vs-hex-master/L/save_screen.py | from paraview.simple import *
import os
sources = []
for k in GetSources():
s = GetSources()[k]
sources.append(s)
warpeds = []
names = []
for s in sources:
name = s.FileName[0]
name = os.path.splitext(os.path.basename(name))[0]
print(name)
warped = WarpByVector(Input=s)
warped.Vectors = ['POINTS', 'solution'... | 1,374 | 24.462963 | 92 | py |
tet-vs-hex | tet-vs-hex-master/time-depentent/paraview.py | from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# find source
#dense
sources = {
"P1": 17450,
"P2": 17450,
"Q1": 36864,
"Q2": 36864,
}
#coarse
# sources = {
# "P1": 49531,
# "P2": 49531,
# "Q1": 26896,
# ... | 5,681 | 81.347826 | 844 | py |
tet-vs-hex | tet-vs-hex-master/time-depentent/run.py | import os
import json
import glob
import subprocess
import tempfile
if __name__ == '__main__':
polyfem_exe = os.path.join(os.environ["POLYFEM_BIN_DIR"], "PolyFEM_bin")
vtu_folder = "vtu"
json_folder = "out"
discr_orders = [1, 2]
time_steps = 40
tend = 0.5
exts = ["obj"]
folder_path = ... | 2,206 | 35.180328 | 119 | py |
tet-vs-hex | tet-vs-hex-master/time-depentent/plot.py | import os
import glob
import numpy as np
import json
import pandas as pd
import plotly.graph_objs as go
import plotly.offline as plotly
colors = {'P1': 'rgb(9, 132, 227)', 'P2': 'rgb(108, 92, 231)', 'Q1': 'rgb(225, 112, 85)', 'Q2': 'rgb(214, 48, 49)'}
marker_shapes = {'P1': 'circle', 'P2': 'circle', 'Q1': 'star', 'Q... | 2,420 | 24.21875 | 115 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/setup.py | from setuptools import setup, find_packages
setup(
name='pytorchts',
version='0.1.0',
description="PyTorch Probabilistic Time Series Modeling framework",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
url='https://github.com/kashif/pytorch-ts',
li... | 871 | 21.947368 | 74 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/load_dataset.py | import numpy as np
import pandas as pd
import copy
import os
from pathlib import Path
from utils import convert_price_file
from pts.dataset import ListDataset, FieldName
from accuracy_evaluator import calculate_and_save_data
def first_nonzero(arr, axis, invalid_val=-1):
mask = arr!=0
return np.where(mask.an... | 12,830 | 44.021053 | 153 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/accuracy_evaluator.py | import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
import gc
import os
from pprint import pprint
from typing import Union
from tqdm.notebook import tqdm_notebook as tqdm
prediction_length = 28
# Memory reduction helper function:
def reduce_mem_usage(df, verbose=True):
numerics = ['int16', ... | 17,382 | 39.709602 | 149 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/preprocessing.py | import numpy as np
import pandas as pd
import copy
import os
from pathlib import Path
from utils import convert_price_file
from accuracy_evaluator import calculate_and_save_data
def main(m5_input_path):
# make price file
converted_price_file = Path(f'{m5_input_path}/converted_price_evaluation.csv')
if no... | 2,003 | 38.294118 | 138 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/training.py | import time
import torch
import numpy as np
import pandas as pd
from tqdm import tqdm
from pprint import pprint
from pathlib import Path
import logging
import os
from pts.model import Predictor
from pts.model.deepar import DeepAREstimator
from pts.modules import TweedieOutput
from pts.trainer import Trainer
from pts.... | 3,592 | 27.744 | 110 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/utils.py |
import numpy as np
from pts.evaluation import Evaluator
import accuracy_evaluator
class M5Evaluator(Evaluator):
def __init__(self, prediction_length, **kwargs):
super().__init__(**kwargs)
self.prediction_length = prediction_length
def evaluate_wrmsse(self, predicti... | 1,931 | 36.153846 | 151 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/__init__.py | 0 | 0 | 0 | py | |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/ensemble.py | import numpy as np
import pandas as pd
from glob import glob
import os
from tqdm import tqdm
import logging
from accuracy_evaluator import load_precalculated_data
from pts.core.logging import get_log_path, set_logger
logger = logging.getLogger("mofl").getChild("ensemble")
class Ensembler(object):
def __init__(s... | 5,535 | 32.756098 | 124 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/examples/m5/make_predictions.py |
import numpy as np
import torch
import os
from tqdm import tqdm
from pathlib import Path
import logging
from pts.core.logging import get_log_path
from pts.model import Predictor
from load_dataset import make_m5_dataset
from pts.evaluation.backtest import make_evaluation_predictions, make_validation_data
#test_sta... | 3,587 | 30.2 | 123 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/exception.py | def assert_pts(condition: bool, message: str, *args, **kwargs) -> None:
if not condition:
raise Exception(message.format(*args, **kwargs))
| 151 | 37 | 71 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/__init__.py | from pkgutil import extend_path
from pkg_resources import get_distribution, DistributionNotFound
from .exception import assert_pts
from .trainer import Trainer
__path__ = extend_path(__path__, __name__) # type: ignore
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__vers... | 343 | 25.461538 | 64 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/trainer.py | import time
from typing import List, Optional, Tuple
import logging
import torch
import torch.nn as nn
from torch.optim.lr_scheduler import CosineAnnealingLR
from warmup_scheduler import GradualWarmupScheduler
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from tqdm import tq... | 6,578 | 35.55 | 137 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/feature/lag.py | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 4,951 | 34.625899 | 95 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/feature/utils.py | import re
from functools import lru_cache
from typing import Tuple
def get_granularity(freq_str: str) -> Tuple[int, str]:
"""
Splits a frequency string such as "7D" into the multiple 7 and the base
granularity "D".
Parameters
----------
freq_str
Frequency string of the form [multiple... | 1,454 | 26.980769 | 93 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/feature/holiday.py | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 7,419 | 32.423423 | 85 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/feature/__init__.py | from .holiday import SPECIAL_DATE_FEATURES, SpecialDateFeatureSet
from .lag import get_lags_for_frequency, get_fourier_lags_for_frequency
from .time_feature import (
DayOfMonth,
DayOfWeek,
DayOfYear,
HourOfDay,
MinuteOfHour,
MonthOfYear,
TimeFeature,
WeekOfYear,
FourierDateFeatures,
... | 458 | 26 | 71 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/feature/time_feature.py | from abc import ABC, abstractmethod
from typing import List
import numpy as np
import pandas as pd
from pandas.tseries.frequencies import to_offset
from pts.core.component import validated
from .utils import get_granularity
class TimeFeature(ABC):
@validated()
def __init__(self, normalized: bool = True):
... | 5,559 | 26.389163 | 93 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/modules/scaler.py | from abc import ABC, abstractmethod
from typing import Tuple
import torch
import torch.nn as nn
class Scaler(ABC, nn.Module):
def __init__(self, keepdim: bool = False):
super().__init__()
self.keepdim = keepdim
@abstractmethod
def compute_scale(
self, data: torch.Tensor, observed... | 3,528 | 31.376147 | 91 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/modules/lambda_layer.py | import torch.nn as nn
class LambdaLayer(nn.Module):
def __init__(self, function):
super().__init__()
self._func = function
def forward(self, x, *args):
return self._func(x, *args)
| 215 | 18.636364 | 35 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/modules/distribution_output.py | from abc import ABC, abstractmethod
from typing import Callable, Dict, Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import (
Distribution,
Beta,
NegativeBinomial,
StudentT,
Normal,
Independent,
LowRankMultivar... | 8,743 | 25.904615 | 95 | py |
M5_Accuracy_3rd | M5_Accuracy_3rd-master/pts/modules/__init__.py | from .distribution_output import (
ArgProj,
Output,
DistributionOutput,
NormalOutput,
StudentTOutput,
BetaOutput,
NegativeBinomialOutput,
IndependentNormalOutput,
LowRankMultivariateNormalOutput,
MultivariateNormalOutput,
FlowOutput,
TweedieOutput
)
from .feature import F... | 465 | 23.526316 | 54 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.