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
toulbar2
toulbar2-master/misc/script/wcsp2lp-support.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import copy import os import sys import itertools import numpy assert len(sys.argv) == 3, "Please specify INPUT and OUTPUT filenames." # does the WCSP have one or more constant terms has_constant_term = False # classe pour écriture à largeur de texte contrôlée class Widt...
9,939
31.913907
146
py
toulbar2
toulbar2-master/validation/bilevel/bilevel_mibs2.py
import pytoulbar2 as tb2 cfn = tb2.CFN(ubinit = 1000, verbose = 0) cfn.NoPreprocessing() cfn.Option.btdMode = 1 cfn.Option.hbfs = 0 # create restricted leader problem cfn.Option.bilevel = 1 cfn.AddVariable('x0',range(2)) cfn.AddVariable('x1',range(2)) cfn.AddVariable('x2',range(2)) cfn.AddLinearConstraint([7,5,2],['...
2,994
43.044118
181
py
toulbar2
toulbar2-master/validation/bilevel/bilevel_mibs0.py
import pytoulbar2 as tb2 cfn = tb2.CFN(ubinit = 1000, verbose = 0) cfn.NoPreprocessing() cfn.Option.btdMode = 1 cfn.Option.hbfs = 0 # create restricted leader problem cfn.Option.bilevel = 1 cfn.AddVariable('x',range(9)) cfn.AddFunction(['x'],[-vx for vx in range(9)]) cfn.Option.initialLbBLP = cfn.Option.initialLbB...
2,055
37.792453
211
py
toulbar2
toulbar2-master/validation/bilevel/bilevel_mibs1.py
import pytoulbar2 as tb2 cfn = tb2.CFN(ubinit = 1000, verbose = 0) cfn.NoPreprocessing() cfn.Option.btdMode = 1 cfn.Option.hbfs = 0 # create restricted leader problem cfn.Option.bilevel = 1 cfn.AddVariable('C0',range(11)) cfn.AddFunction(['C0'],[-v for v in range(11)]) cfn.Option.initialLbBLP = cfn.Option.initialLb...
2,196
40.45283
280
py
toulbar2
toulbar2-master/validation/default/weightedcspconstraint.py
VERBOSE=0 PROBLEM1="../../validation/bilevel/bilevel1b.cfn" PROBLEM2="../../validation/bilevel/bilevel2.cfn" LB=11 UB=20 import pytoulbar2 as tb2 cfn1 = tb2.CFN(verbose = VERBOSE) cfn1.Read(PROBLEM1) cfn2 = tb2.CFN(verbose = VERBOSE) cfn2.Read(PROBLEM2) cfn1.AddWeightedCSPConstraint(cfn2, LB, UB, True) cfn1.Solve(s...
375
19.888889
65
py
toulbar2
toulbar2-master/validation/default/clique.py
import pytoulbar2 as tb2 m = tb2.CFN(1, verbose=0) w=m.AddVariable('w', range(2)) x=m.AddVariable('x', range(2)) y=m.AddVariable('y', range(2)) z=m.AddVariable('z', range(2)) m.CFN.wcsp.postCliqueConstraint([x,y,z,w],'1 1 1 1 1 1 1 1 1') for u in [w,x,y,z]: for v in [w,x,y,z]: if u<v: m.AddFunction([u,v],[0, ...
377
18.894737
62
py
toulbar2
toulbar2-master/validation/default/sregular.py
import pytoulbar2 as tb2 m = tb2.CFN(12, verbose=0) v1=m.AddVariable('v1', range(2)) v2=m.AddVariable('v2', range(2)) v3=m.AddVariable('v3', range(2)) v4=m.AddVariable('v4', range(2)) m.AddFunction([v1], [2, 0]) m.AddFunction([v4], [0, 3]) m.CFN.wcsp.postWRegular([v1,v2,v3,v4],'var','DAG', 12, 2, [tb2.tb2.WeightedO...
534
28.722222
202
py
ns_lattice
ns_lattice-master/ns_lattice/setup.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Jan 27, 2017 @author: Niels Lubbes https://python-packaging.readthedocs.io/en/latest/minimal.html https://pypi.python.org/pypi?%3Aaction=list_classifiers ''' from setuptools import setup setup( nam...
1,250
29.512195
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_class_ns_tools.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 13, 2017 @author: Niels Lubbes ''' from ns_lattice.class_ns_tools import NSTools class TestClassNSTools: def test__p( self ): NSTools.filter( None ) assert NSTools.p( 'Hello wor...
1,654
28.035088
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_class_div.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 8, 2017 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_ZZ from ns_lattice.sage_interface import sage_matrix from ns_lattice.class_div import Div from ns_lattice.class_ns_tools im...
4,686
41.225225
104
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_class_dp_lattice.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Nov 7, 2017 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_QQ from ns_lattice.sage_interface import sage_identity_matrix from ns_lattice.sage_interface import sage_matrix from ns_latt...
11,122
31.054755
706
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_div_in_lattice.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 8, 2017 @author: Niels Lubbes ''' from ns_lattice.class_ns_tools import NSTools from ns_lattice.class_div import Div from ns_lattice.div_in_lattice import get_divs from ns_lattice.div_in_lattice import...
5,065
32.773333
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_class_eta.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Jan 27, 2018 @author: Niels Lubbes ''' from ns_lattice.class_eta import ETA from ns_lattice.class_ns_tools import NSTools class TestClassETA(): def test__update( self ): eta = ETA( 10, 2 ) ...
592
21.807692
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_dp_root_basis.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 13, 2017 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_QQ from ns_lattice.sage_interface import sage_identity_matrix from ns_lattice.sage_interface import sage_Graph from ns_latt...
4,288
31.007463
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_ns_basis.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 9, 2017 @author: Niels Lubbes ''' import sys from ns_lattice.sage_interface import sage_identity_matrix from ns_lattice.sage_interface import sage_matrix from ns_lattice.sage_interface import sage_ZZ f...
5,021
29.071856
153
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_convert_to_tex.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 8, 2017 @author: Niels Lubbes ''' from ns_lattice.class_ns_tools import NSTools from ns_lattice.convert_to_tex import cls_to_tex class TestConvertToTex: def test__cls_to_tex( self ): ...
543
16.548387
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/__init__.py
0
0
0
py
ns_lattice
ns_lattice-master/ns_lattice/src/tests/test_dp_involutions.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 8, 2017 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_vector from ns_lattice.sage_interface import sage_matrix from ns_lattice.sage_interface import sage_identity_matrix from ns_l...
6,780
37.310734
133
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/class_eta.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Jan 27, 2018 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_n from ns_lattice.class_ns_tools import NSTools import time class ETA( object ): ''' For estimating the time it...
2,603
26.410526
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/dp_root_bases.py
''' Created on Aug 11, 2016 @author: Niels See [http://arxiv.org/abs/1302.6678] for more info. Classification of root subsystems of root systems of type either A1, A1+A2, A4, D5, E6, E7 or E8. ''' import time from ns_lattice.sage_interface import sage_VectorSpace from ns_lattice.sage_interface import sage_vector fro...
13,321
30.56872
158
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/dp_involutions.py
''' Created on Aug 11, 2016 @author: Niels Lubbes Classification of unimodular involutions of Neron-Severi lattice of weak del Pezzo surfaces. ''' from ns_lattice.sage_interface import sage_ZZ from ns_lattice.sage_interface import sage_QQ from ns_lattice.sage_interface import sage_matrix from ns_lattice.sage_interfa...
4,093
28.035461
116
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/__main__.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Aug 11, 2016 @author: Niels Lubbes ''' import sys import os from ns_lattice.sage_interface import sage_matrix from ns_lattice.sage_interface import sage_ZZ from ns_lattice.sage_interface import sage_ident...
17,992
33.601923
140
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/convert_to_tex.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Dec 14, 2017 @author: Niels Lubbes ''' from ns_lattice.class_div import Div from ns_lattice.class_dp_lattice import DPLattice from ns_lattice.class_ns_tools import NSTools from ns_lattice.sage_interface ...
7,948
32.682203
201
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/class_div.py
''' Created on Aug 11, 2016 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_ZZ from ns_lattice.sage_interface import sage_diagonal_matrix from ns_lattice.sage_interface import sage_vector class Div: '''Element in Neron-Severi lattice. The class represents a divisor class in the Nero...
16,148
27.683837
122
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/class_dp_lattice.py
''' Created on Aug 15, 2016 @author: Niels Lubbes This module is for classifying real structures and singularities of weak Del Pezzo surfaces of degree between 1 and 7. ''' import time from ns_lattice.sage_interface import sage_identity_matrix from ns_lattice.sage_interface import sage_ZZ from ns_lattice.sage_inter...
47,232
34.674471
195
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/div_in_lattice.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Aug 11, 2016 @author: Niels Lubbes Algorithm for computing elements in a unimodular lattice. We use this algorithm in the context of Neron-Severi lattices of weak del Pezzo surfaces. See Arxiv: "Compu...
9,393
31.061433
233
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/ns_basis.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 9, 2017 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_identity_matrix from ns_lattice.sage_interface import sage_matrix from ns_lattice.sage_interface import sage_ZZ from ns_lattic...
8,302
30.214286
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/class_ns_tools.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Feb 7, 2017 @author: Niels Lubbes ''' from ns_lattice.sage_interface import sage_load from ns_lattice.sage_interface import sage_save import inspect import time import sys import os class NSTools(): '...
6,196
27.689815
97
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/__init__.py
1
0
0
py
ns_lattice
ns_lattice-master/ns_lattice/src/ns_lattice/sage_interface.py
''' Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. Created on Jul 12, 2017 @author: Niels Lubbes Sage has a complicated import structure and it is not possible to simply import each need module. It seems that "from sage.all import *" is the only option. Therefore...
6,555
28.936073
115
py
MORSE
MORSE-master/Generate_Params_Par.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys import os import multiprocessing as mp import traceback import logging import gc import time from argparse import ArgumentParser import numpy from matplotlib import pyplot #from joblib import Parallel, delayed from scipy.signal import argrelextrema import mult...
8,000
28.307692
134
py
MORSE
MORSE-master/constants.py
### Constants used throughout my project code ### c = 3e10 G = 6.67428e-8 Msun = 1.989e33 rho_0 = 10**14.3 rho_ns = 2.7e14 rho_1 = 1.85 * rho_ns rho_2 = 2. * rho_1 #rho_2 = 1.8 * rho_1 rho_3 = 2. * rho_2 P_0 = 1.5281267425e+33 gamma_0 = 2.68019358431 dyncm2_to_MeVfm3 = 1./(1.6022e33) gcm3_to_MeVfm3 = 1./(1.7827e12...
346
18.277778
49
py
MORSE
MORSE-master/PosteriorProbRho.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys import os import multiprocessing as mp import traceback import logging import gc import numpy from matplotlib import pyplot from argparse import ArgumentParser from scipy.interpolate import UnivariateSpline, RegularGridInterpolator from scipy.integrate import ...
7,431
31.596491
150
py
MORSE
MORSE-master/Plotting.py
import numpy import pandas from matplotlib import pyplot from scipy.interpolate import griddata from InputPosteriors import Pobs, find_CI_level pyplot.rcParams['xtick.direction'] = 'in' pyplot.rcParams['xtick.minor.visible'] = True pyplot.rcParams['ytick.direction'] = 'in' pyplot.rcParams['ytick.minor.visible'] = True...
3,918
32.784483
108
py
MORSE
MORSE-master/Create_MRcurves_Par.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys import os import multiprocessing as mp import traceback import logging import gc import time from constants import c, G, Msun, rho_0, rho_ns, rho_1, rho_2, rho_3, P_0, gamma_0, dyncm2_to_MeVfm3, gcm3_to_MeVfm3, oneoverfm_MeV import numpy from argparse import A...
21,060
35.755672
139
py
MORSE
MORSE-master/InputPosteriors.py
import numpy def Create_Input_Posterior(percent, masses, radii, rho): Robs = radii Mobs = masses sigmaM = numpy.zeros(3) sigmaR = numpy.zeros(3) sigmaM[0] = percent[0]*Mobs[0] sigmaR[0] = percent[0]*Robs[0] sigmaM[1] = percent[1]*Mobs[1] sigmaR[1] = percent[1]*Robs[1] sigmaM[...
1,586
27.339286
95
py
MORSE
MORSE-master/JacobianRho.py
import sys import os import multiprocessing as mp import traceback import logging import gc import time from argparse import ArgumentParser import numpy import pandas from matplotlib import pyplot from scipy.interpolate import UnivariateSpline def UniqueParams(Parameters): df = pandas.DataFrame({'P1':Parameters[...
6,006
27.334906
123
py
UEDGE
UEDGE-master/setup.py
#!/usr/bin/env python # To use: # python setup.py install # import sys import os import os.path import string import site from Forthon.compilers import FCompiler import getopt import logging version='8.0.4.1' try: os.environ['PATH'] += os.pathsep + site.USER_BASE + '/bin' import setuptools import di...
6,228
30.780612
90
py
UEDGE
UEDGE-master/localrules.py
#rules for converting mppl to f90 # This is generic down to the UEDGE section import copy import os def Use2use(s): #Return s if this is a comment if (not s[0].isspace()) and s[0] != "U": return s #Do a substitution if line contains "Use" and it is not #part of a comment if (s.find("Use")+1)...
6,579
32.917526
97
py
UEDGE
UEDGE-master/pyexamples/d3dHsm/runcase.py
#-import uedge from uedge import * #-import hdf5 routines from uedge.hdf5 import * #-import graphics, math, etc. import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np import os #-import some utilities for using OS ###execfile(os.path.join(os.environ['HOME'], 'utils/python/osfun.py...
1,603
21.591549
70
py
UEDGE
UEDGE-master/pyexamples/d3dHsm/rd_d3dHsm_in.py
# # ########################################################################### # DESCRIPTION OF PROBLEM (d3dHsm) from FACETS test suite: # DIII-D single-null geometry with 5 variables (ni,upi,te,ti,ng) and a # (16+2)*(8+2)=18x10 [poloidal*radial] mesh yielding 900 variables. # Solver used is Newton Krylov (svrpkg="nks...
3,347
36.617978
80
py
UEDGE
UEDGE-master/pyexamples/box2/plotcontour.py
import matplotlib import matplotlib.gridspec as gridspec gs=gridspec.GridSpec(2, 2) plt.figure(10) plt.subplot(gs[0,0]) CS = plt.contour(com.zm[:,:,0], com.rm[:,:,0], bbb.te/ev) plt.clabel(CS, inline=1, fontsize=10) params = {'mathtext.default': 'regular' } plt.rcParams.update(params) plt.title('T$\mathregul...
987
23.097561
66
py
UEDGE
UEDGE-master/pyexamples/box2/runcase.py
#import uedge from uedge import * #-import hdf5 routines from uedge.hdf5 import * #-import graphics, math, etc. import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np import os #-import some utilities for using OS ###execfile(os.path.join(os.environ['HOME'], 'utils/python/osfun.py'...
2,306
23.284211
76
py
UEDGE
UEDGE-master/pyexamples/box2/box2_in.py
########################################################################### # DESCRIPTION OF PROBLEM (box2): # # This is a Python version of the box case from Andreas Holm ########################################################################### #-Geometry bbb.mhdgeo=-1 #-set cartesian geometry bbb.isfixlb=2 #left ...
4,169
27.758621
75
py
UEDGE
UEDGE-master/pyscripts/paws.py
def paws(): programPause = raw_input("Press the <ENTER> key to continue...")
81
26.333333
68
py
UEDGE
UEDGE-master/pyscripts/uedge_lists.py
""" This module uses some of the Forthon methods to provide routines for listing and searching the Uedge compiled packages. """ import uedge import re packages = [uedge.com,uedge.aph,uedge.api,uedge.bbb,uedge.flx,uedge.grd,uedge.svr,uedge.wdf,uedge.ncl] def packagename2object(package): for p in packages:...
4,004
30.289063
103
py
UEDGE
UEDGE-master/pyscripts/osfun.py
def date(): os.system("date") def ls(opts=""): os.system("ls " + opts) def more(fname): os.system("more " + fname) def pwd(): os.system("pwd") def cp(opts=""): os.system("cp " + opts) def mv(opts=""): os.system("mv " + opts)
254
13.166667
30
py
UEDGE
UEDGE-master/pyscripts/convert1.py
#!/usr/bin/env python # # $Id: convert1.py,v 7.1 2019/11/01 22:38:19 meyer8 Exp $ # # To try solving linear critical gradient import sys import os import getopt import string from . import convert from .convert import * # define the mppl to f90 class class M2F(generic): suffixin = "m" suffixout = "F" subrules =...
1,164
17.492063
62
py
UEDGE
UEDGE-master/pyscripts/bas2py_rules.py
from uedge import * import uedge.uedge_lists as ul subrules = [ ['\(','['], ['\)',']'], [';','\n'], ['^!','#!'], ['^ *',''], ['^\t*',''], [r'\ballocate\b','bbb.allocate()'], [r'\bexmain\b','bbb.exmain()'], [r'\bexponseed\b','grd.exponseed()'], ] warnrules = [] def raw_string(s): s = s....
878
25.636364
82
py
UEDGE
UEDGE-master/pyscripts/rdinitdt.py
# Setup file to run time-dependently using dtreal # Change dtreal for starting dt and savefname to change pfb file name # Once variables are set, read rdrundt to execute a time-dependent run from uedge import * i_stor = 0 nfe_tot = 0 savefn = "savedt.hdf5" # name of hdf5 savefile written every timestep bbb.rdtphidtr...
2,050
52.973684
76
py
UEDGE
UEDGE-master/pyscripts/ruthere.py
from numpy import * import time import signal import sys ############################################################################# # From Dave Grote: # --- Setup signal handler to capture Control-C # --- To use, first call arminterrupt(). Then at the place where the interrupt # --- is allowed, call ruthere(). Thi...
2,199
31.835821
82
py
UEDGE
UEDGE-master/pyscripts/__version__.py
__version__ = '8.0.0'
22
10.5
21
py
UEDGE
UEDGE-master/pyscripts/checkver.py
import json pkg = 'uedge' try: import importlib.metadata thisver = importlib.metadata.version(pkg) except: import pkg_resources thisver = pkg_resources.get_distribution(pkg).version try: import urllib.request contents = urllib.request.urlopen('https://pypi.org/pypi/'+pkg+'/json').read() data = ...
928
24.108108
85
py
UEDGE
UEDGE-master/pyscripts/uedge.py
try: import IPython from IPython.terminal.prompts import Prompts,Token from IPython.terminal.embed import InteractiveShellEmbed except: pass try: from traitlets.config.loader import Config except: pass import sys,os,__main__ import numpy as np from numpy import array,tanh,exp,arange ArrayType = np....
3,031
23.650407
78
py
UEDGE
UEDGE-master/pyscripts/uexec.py
import sys try: from importlib import reload,import_module except: from importlib import import_module import builtins def uexec(mname,returns=globals()): if mname in sys.modules: _m = reload(sys.modules[mname]) else: _m = import_module(mname) # is there an __all__? if so res...
652
20.064516
65
py
UEDGE
UEDGE-master/pyscripts/uedgeplots.py
import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.axes as ax import sys from matplotlib.collections import PolyCollection from matplotlib.colors import LinearSegmentedColormap from matplotlib import rcdefaults from matplotlib import interactive from uedge import * from nump...
14,603
33.524823
135
py
UEDGE
UEDGE-master/pyscripts/rundt.py
# Holm10 Nov 5 2019, based on rdcontdt.py # 191121 - Created hdf5-routines to read and save time-dependent data # Writes and reads dictionary with multi-dimensional arrays # containing all restore-parameters. # 230210 - Updated old rundt function to RunData class, modularizing # all functi...
30,206
40.83795
81
py
UEDGE
UEDGE-master/pyscripts/hdf5.py
import numpy as np import h5py import uedge try: import __version__ as pyv pyver = pyv.__version__ except: pyver = uedge.__version__ from .uedge import bbb from .uedge import com from .uedge_lists import * import time from Forthon import packageobject def hdf5_restore(file): """ Read a hdf5 fi...
11,545
33.363095
90
py
UEDGE
UEDGE-master/pyscripts/filelists.py
# Methods to create a list of files in a directory, and a sub-list containing sspecified suffixes. import os import string def filelist(path): return os.listdir(path) def filesublist(path,suffix): sublist = [] biglist = filelist(path) for filename in biglist: filesplit = filename.split(".") ...
404
21.5
98
py
UEDGE
UEDGE-master/pyscripts/convert.py
# A Python translator that will convert files following a set # of file-suffix-specific substitution rules # Written by Ron Cohen, February 2007. Last revision March 15, 2007. # import utilities to create filtered list of files from filelists import * import os import filecmp """ create a list of classes to enstant...
11,542
37.734899
92
py
UEDGE
UEDGE-master/pyscripts/double.py
from uedge import * def uedouble(): com.nxleg=2*com.nxleg com.nxcore=2*com.nxcore com.nycore=2*com.nycore com.nysol=2*com.nysol if com.nxomit > 0: if com.geometry=="dnbot": com.nxomit = com.nxleg[0,0]+com.nxcore[0,0] + 2*com.nxxptxx + 1 else: com.nxomit=2*(co...
739
28.6
103
py
UEDGE
UEDGE-master/pyscripts/__init__.py
from .uedge import * from os import path from pathlib import Path try: from uedge.__version__ import __version__ from uedge.__src__ import __src__ import uedge.checkver except: try: from __version__ import __version__ from __src__ import __src__ import checkver except: ...
805
24.1875
54
py
UEDGE
UEDGE-master/pyscripts/__src__.py
__src__ = '/Users/meyer8/gitstuff/UEDGE'
41
20
40
py
UEDGE
UEDGE-master/pyscripts/cdf4.py
import numpy as np import netCDF4 as nc from .uedge import bbb def cdf4_restore(file): """ Read a cdf4 file previously written from Uedge. This reads the file and puts the 6 standard variables into the correct format. """ try: cf = nc.Dataset(file) except: print("Coul...
2,293
22.649485
84
py
UEDGE
UEDGE-master/pyscripts/sources.py
# # Bill Meyer - 7/24/2019 # meyer8@llnl.gov # # from __future__ import print_function import sys def sources(): """ This routine simply dumps all the modules as a sorted list along with the "__file__" attribute. Prints "unknown" for those that don't have this attribute. This is just for ...
670
20.645161
75
py
UEDGE
UEDGE-master/pyscripts/pdb2h5.py
#!/usr/bin/env python # @description This script will convert a pdb data file into an hdf5 # data file # # @keywords Py-UEDGE # # @contact John Cary # # @version $id: $ # import sys for system commands import sys, os # Import uefacets for interface convenience from . import uefacets # import...
1,094
16.380952
68
py
UEDGE
UEDGE-master/pyscripts/rdcontdt.py
# This file runs a time-dependent case using dtreal. First, obtain a converged # solution for a (usually small) dtreal; xuedge must report iterm=1 at the end. # Then adjust control parameters in rdinitdt; read this file, which reads rdinitdt. # If a mistake is made, to restart this file without a Jacobian evaluation, ...
10,702
41.472222
88
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case3/rd_forthon_case3.py
#Typical mesh (nx=64, ny=32) for DIII-D MHD equilibrium #Uses inertial neutrals, so six variables (ni,upi,Te,Ti,ng,upg) # ##package flx;package grd;package bbb # Initialize pyuedge from uedge import * # Set the geometry bbb.mhdgeo = 1 #use MHD equilibrium os.system('rm -f aeqdsk neqdsk') #change names of MHD eqil....
3,833
34.831776
74
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case2/rd_forthon_case2.py
#Coarse mesh (nx=16, ny=8) for DIII-D MHD equilibrium #Uses diffusive neutrals, so five variables (ni,upi,Te,Ti,ng) # ##package flx;package grd;package bbb # Initialize pyuedge from uedge import * #from uefacets import * from uedge.pdb_restore import * from uedge.hdf5 import * #bbb.uedge_petscInit() # Set the geometr...
3,496
36.202128
74
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case6/rdtimedpd_1.py
#Coarse mesh (nx=16, ny=8) for DIII-D MHD equilibrium #Uses diffusive neutrals, so five variables (ni,upi,Te,Ti,ng) # ##package flx;package grd;package bbb # Initialize pyuedge from uedge import * # Set the geometry bbb.mhdgeo = 1 #use MHD equilibrium os.system('rm -f aeqdsk neqdsk') #change names of MHD eqil. fil...
2,813
35.545455
77
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case6/rdtimedpd_2.py
#Coarse mesh (nx=16, ny=8) for DIII-D MHD equilibrium #Uses diffusive neutrals, so five variables (ni,upi,Te,Ti,ng) # ##package flx;package grd;package bbb # Initialize pyuedge from uedge import * # Set the geometry bbb.mhdgeo = 1 #use MHD equilibrium os.system('rm -f aeqdsk neqdsk') #change names of MHD eqil. fil...
2,827
35.25641
77
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case5/plate.iter-feat.py
# define divertor plate for ITER-FEAT # derived from equilibrium from Kukushkin Jan 2002 ###integer oldecho=echo ###echo=no # for inboard half of mesh: grd.nplate1=15 grd.gchange("Mmod",0) grd.rplate1=[\ 3.96500E+00, 4.06360E+00, 4.29140E+00, 4.44480E+00, 4.48730E+00, \ 4.40860E+00, 4.23980E+00, 4.07090E+00, 4.341...
1,132
31.371429
68
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case5/rd_forthon_case5.py
###character*6 probname="itfa40" #Case of full toroidal equilibrium for ITER-FEAT with multi-species Carbon # ####package flx;package grd;package bbb # Initial pyuedge from uedge import * from pdb_restore import * bbb.mhdgeo=1 bbb.isfixlb=0 bbb.isfixrb=0 os.system('rm -f aeqdsk neqdsk') os.system('cp aeq_iter-feat ...
7,524
34.163551
92
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case1/rd_forthon_case1.py
# This input file sets the parameters for the parallel test case # from uedge import * # flags also set in the workstation version. bbb.mhdgeo=-1 bbb.isnion=1 bbb.isupon=1 bbb.isteon=1 bbb.istion=1 bbb.isngon=0 bbb.svrpkg="vodpk" bbb.premeth="ilut" bbb.epscon1=1.e-2 bbb.ireorder=0 bbb.ncore=2.e19 bbb.tcoree=100 bbb.tc...
773
14.795918
64
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case4/plate.iter-feat.py
# define divertor plate for ITER-FEAT # derived from equilibrium from Kukushkin Jan 2002 ###integer oldecho=echo ###echo=no # for inboard half of mesh: grd.nplate1=15 grd.gchange("Mmod",0) grd.rplate1=[\ 3.96500E+00, 4.06360E+00, 4.29140E+00, 4.44480E+00, 4.48730E+00, \ 4.40860E+00, 4.23980E+00, 4.07090E+00, 4.341...
1,132
31.371429
68
py
UEDGE
UEDGE-master/test/Forthon_cases/Forthon_case4/rd_forthon_case4.py
###character*6 probname="itfa40" #Case of full toroidal equilibrium for ITER-FEAT # ####package flx;package grd;package bbb # Initialize pyuedge from uedge import * bbb.mhdgeo=1 bbb.isfixlb=0 bbb.isfixrb=0 os.system('rm -f aeqdsk neqdsk') os.system('cp aeq_iter-feat aeqdsk') os.system('cp geq_iter-feat neqdsk') ###...
4,740
28.08589
92
py
UEDGE
UEDGE-master/test/facets/example.py
# This is a simple example exercising the methods in uefacets.py from uefacets import * from Numeric import * print "Creating UEDGE instance" ue = Uedge() print "Reading input file 'testin.py' which is in the working directory" print "(Note: alternatively give the full path)" ue.ReadParams("testin.py") print "Set up M...
1,598
31.632653
81
py
UEDGE
UEDGE-master/test/facets/testin.py
#Coarse mesh (nx=16, ny=8) for DIII-D MHD equilibrium #Uses diffusive neutrals, so five variables (ni,upi,Te,Ti,ng) # ##package flx;package grd;package bbb # Initialize pyuedge from uedge import * # Set the geometry bbb.mhdgeo = 1 #use MHD equilibrium os.system('rm -f aeqdsk neqdsk') #change names of MHD eqil. fil...
3,181
35.574713
74
py
UEDGE
UEDGE-master/pytests/test_template.py
import unittest import os import numpy as np import sys,getopt def prhelp(): print(""" Usage: python test_slab.py [-r|--ref] [-h] or pytest --forked test_slab.py -r|--ref to produce reference files for future test runs """) # # Note the numbering of the tests. P...
1,282
18.439394
72
py
UEDGE
UEDGE-master/pytests/testscripts/rdinitdt.py
# Setup file to run time-dependently using dtreal # Change dtreal for starting dt and savefname to change pfb file name # Once variables are set, read rdrundt to execute a time-dependent run # IMPORT UEDGE (needed to define group name bbb) from uedge import * i_stor = 0 nfe_tot = 0 savefn = "savedt.hdf5" # name of h...
2,100
51.525
76
py
UEDGE
UEDGE-master/pytests/testscripts/uetests.py
import unittest import os import numpy as np import sys,getopt import uuid from importlib import import_module as im from multiprocessing import Process def saverefs(filename): import uedge as ue import uedge.hdf5 as h5 fnrm = ue.bbb.get_fnrm(ue.bbb.dtreal) nfe = ue.bbb.nfe[0][0] sclyl = ue.bbb.y...
4,934
24.050761
114
py
UEDGE
UEDGE-master/pytests/testscripts/rdcontdt.py
# This file runs a time-dependent case using dtreal. First, obtain a converged # solution for a (usually small) dtreal; xuedge must report iterm=1 at the end. # Then adjust control parameters in rdinitdt; read this file, which reads rdinitdt. # If a mistake is made, to restart this file without a Jacobian evaluation, ...
9,290
41.040724
88
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D_only/j.py
import uedge import rd_d3dHsm_in import uedge uedge.bbb.exmain() import uedge.uedgeplots as up up.plotmesh()
110
12.875
29
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D_only/rd_d3dHsm_in.py
# # ########################################################################### # DESCRIPTION OF PROBLEM (d3dHsm) from FACETS test suite: # DIII-D single-null geometry with 5 variables (ni,upi,te,ti,ng) and a # (16+2)*(8+2)=18x10 [poloidal*radial] mesh yielding 900 variables. # Solver used is Newton Krylov (svrpkg="nks...
2,997
41.828571
81
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D_only/test_d3d_snull_D_only.py
import unittest import os import numpy as np import sys,getopt from multiprocessing import Process thisfile=os.path.realpath(__file__) thispath=os.path.dirname(thisfile) sys.path.insert(0,thispath) sys.path.insert(0,os.path.dirname(os.path.dirname(thispath))+'/testscripts') import uetests as uet ftol = 1.e-9 name = '...
2,339
25.292135
92
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D+C_orthog/test_d3d_snull_D+C_orthog.py
import unittest import os import numpy as np import sys,getopt from multiprocessing import Process thisfile=os.path.realpath(__file__) thispath=os.path.dirname(thisfile) sys.path.insert(0,thispath) sys.path.insert(0,os.path.dirname(os.path.dirname(thispath))+'/testscripts') import uetests as uet ftol = 1.e-9 name = '...
2,355
25.47191
92
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D+C_orthog/rd_d3dHmsCog_strahl_Rp95.py
# # ########################################################################### # DESCRIPTION OF PROBLEM (d3dHmsCnog) using Strahl imp data; from FACETS : # DIII-D single-null geometry with 6 hydrogen variables (ni,ng,upi,upg,te,ti) # and 7 carbon variables (six charge-state densities ni and one ng) on a # (16+2)*(8+2...
7,614
32.995536
77
py
UEDGE
UEDGE-master/pytests/fast_tests/Slab_geometry/test_sgeom.py
import unittest import os import numpy as np import sys,getopt from multiprocessing import Process thisfile=os.path.realpath(__file__) thispath=os.path.dirname(thisfile) sys.path.insert(0,thispath) sys.path.insert(0,os.path.dirname(os.path.dirname(thispath))+'/testscripts') import uetests as uet ftol = 2.e-9 def prh...
2,382
26.079545
103
py
UEDGE
UEDGE-master/pytests/fast_tests/Slab_geometry/rd_slabH_in_w_h5.py
# # ########################################################################### # DESCRIPTION OF PROBLEM (slabH): # Slab model with 4 hydrogen variables (ni,upi,te,ti) and a (6+2)*(10+2) # = 8x12 [poloidal*radial] mesh yielding 384 variables. The +2 in the mesh # size description arises from one guard-cell at each ...
1,982
26.929577
79
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D+C_nonorthog/plate_d3d_2.py
# Set params for inner (1) and outer (2) plate line-segments from uedge import * #needed to define variables within this file grd.nplate1 = 5 grd.gchange("Mmod",0) grd.rplate1=[\ 1.600E+00, 1.27300E+00, 1.15310E+00, 1.01600E+00, 1.01600E+00] grd.zplate1=[\ 2.34100E-01, 2.34100E-01, 2.34100E-01, 3....
712
25.407407
66
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D+C_nonorthog/test_d3d_snull_D+C_nonorthog.py
import unittest import os import numpy as np import sys,getopt from multiprocessing import Process thisfile=os.path.realpath(__file__) thispath=os.path.dirname(thisfile) sys.path.insert(0,thispath) sys.path.insert(0,os.path.dirname(os.path.dirname(thispath))+'/testscripts') import uetests as uet ftol = 1.e-9 name = '...
2,359
25.516854
92
py
UEDGE
UEDGE-master/pytests/fast_tests/d3d_snull_D+C_nonorthog/rd_d3dHmsCnog_strahl_Rp95.py
# # ########################################################################### # DESCRIPTION OF PROBLEM (d3dHmsCnog) from FACETS test suite: # DIII-D single-null geometry with 6 hydrogen variables (ni,ng,upi,upg,te,ti) # and 7 carbon variables (six charge-state densities ni and one ng) on a # (16+2)*(8+2)=18x10 [polo...
7,525
33.054299
77
py
UEDGE
UEDGE-master/jupyter/case_setup.py
#Coarse mesh [com.nx=8, com.ny=4] for DIII-D MHD equilibrium #Uses diffusive neutrals, so five variables [bbb.ni,bbb.upi,Te,Ti,bbb.ng] # import sys,os from uedge import * # Set the com.geometry bbb.mhdgeo = 1 #use MHD equilibrium #com.rm -flx.f aeqdsk neqdsk #change names of MHD eqil. files flx.psi0min1 = 0.98 #n...
4,590
38.239316
79
py
StyleFusion
StyleFusion-master/src/main.py
from shared import * from tf_lib import * from dataset import * from model import * #from dialog_gui import * from classifier import load_classifier """ AUTHOR: Xiang Gao (xiag@microsoft.com) at Microsoft Research """ def run_master(mode, args): if mode not in ['train','continue'] and args.restore != '': aa = ar...
7,523
28.73913
137
py
StyleFusion
StyleFusion-master/src/decode.py
from shared import * from nltk.translate.bleu_score import SmoothingFunction """ AUTHOR: Sean Xiang Gao (xiag@microsoft.com) at Microsoft Research """ class Decoder: def __init__(self, dataset, model, decoder_depth, latent_dim, allowed_words=None): self.dataset = dataset self.model = model self.decoder_depth ...
11,359
29.455764
150
py
StyleFusion
StyleFusion-master/src/vis.py
from shared import * from tf_lib import * from main import run_master, get_model_fld from scipy.optimize import fmin_powell as fmin from mpl_toolkits.mplot3d import Axes3D from sklearn import manifold import scipy """ AUTHOR: Sean Xiang Gao (xiag@microsoft.com) at Microsoft Research """ def dist_mat(coord): n ...
9,316
25.850144
109
py
StyleFusion
StyleFusion-master/src/model.py
from shared import * from tf_lib import * from dataset import * from decode import * from evaluate import * """ AUTHOR: Xiang Gao (xiag@microsoft.com) at Microsoft Research """ class ModelBase: def __init__(self): self.fld = None # str self.n_trained = None # int self.max_n_trained = None # int self.d...
24,831
28.632458
127
py
StyleFusion
StyleFusion-master/src/tf_lib.py
from keras.models import Model, load_model, model_from_yaml from keras.layers import Input, GRU, Dense, Embedding, Dropout, Concatenate, Lambda, Add, Subtract, Multiply, GaussianNoise from keras.utils import plot_model from keras.callbacks import ModelCheckpoint from keras.optimizers import Adam, RMSprop from keras.ca...
455
37
123
py
StyleFusion
StyleFusion-master/src/classifier.py
from shared import * from tf_lib import * import json from dataset import load_vocab from sklearn import linear_model import pickle """ AUTHOR: Sean Xiang Gao (xiag@microsoft.com) at Microsoft Research """ class ClassifierNeural(): def __init__(self, fld): params = json.load(open(fld + '/args.json')) if params...
10,493
27.594005
114
py
StyleFusion
StyleFusion-master/src/dataset.py
from shared import * """ AUTHOR: Sean Xiang Gao (xiag@microsoft.com) at Microsoft Research """ def load_vocab(path): with io.open(path, encoding='utf-8') as f: lines = f.readlines() index2token = dict() token2index = dict() for i, line in enumerate(lines): token = line.strip('\n').strip() index2token[i +...
9,117
26.299401
97
py