Commit de622b13 authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles
Browse files

switch to unsio module

parent 651e6ad7
Pipeline #697 failed with stages
......@@ -9,6 +9,7 @@
# python
*.pyc
\#*
# Compiled Object files
*.slo
......
#!/usr/bin/python
# unsio
from py_unsio import *
from unsio import *
import numpy as np
# cnd line
import sys, getopt,os.path
......
......@@ -6,7 +6,7 @@ from __future__ import print_function
# save stars particles to density field for displaying with glnemo2
# MANDATORY
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import numpy as np # arrays are treated as numpy arrays
import math
import argparse
......
......@@ -6,7 +6,7 @@ from __future__ import print_function
# save stars particles to density field for displaying with glnemo2
# MANDATORY
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import numpy as np # arrays are treated as numpy arrays
import math
import argparse
......
......@@ -12,7 +12,7 @@ import numpy as np # arrays are treated as numpy arrays
import os.path
#dirname, filename = os.path.split(os.path.abspath(__file__))
#sys.path.append(dirname+'../modules/') # trick to find modules directory
from py_unsio import *
from unsio import *
import copy
import tempfile
#from IPython import embed
......
......@@ -16,8 +16,8 @@
# unsio module loading
# ==> do not forget to update PYTHONPATH environment variable with
# py_unsio location path
from py_unsio import *
# unsio location path
from unsio import *
import numpy as np
# cmd line
......
#!/usr/bin/env python
from py_unsio import *
from unsio import *
import numpy as np
import argparse
......
......@@ -3,7 +3,7 @@
import yt
import numpy as np
import sys
from py_unsio import *
from unsio import *
from yt.data_objects.particle_filters import add_particle_filter
import math
import argparse
......
......@@ -6,7 +6,7 @@
# MANDATORY
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import numpy as np # arrays are treated as numpy arrays
import math
import argparse
......
#!/usr/bin/env python
from __future__ import print_function
import sys
sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/','/home/jcl/works/GIT/uns_projects/py/modules/simulations']+sys.path
import argparse
import os,glob
import errno
#from uns_simu import *
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# commandLine, parse the command line
def commandLine():
dbname=None
# help
parser = argparse.ArgumentParser(description="Link snapshot snapshot on continue MDF simulations",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
# options
parser.add_argument('simname', help='simulation name path')
parser.add_argument('contdir', help='continuation sim dir')
parser.add_argument('--verbose',help='verbose mode on', dest="verbose", action="store_true", default=False)
# parse
args = parser.parse_args()
# start main funciton
process(args)
# -----------------------------------------------------
# process, is the core function
dirname="/rudata/mdf"
def process(args):
for ff in sorted(glob.glob(args.contdir+"/"+args.simname+"/SNAPS/snapshot*")):
try:
ff2,ext=ff.split(".")
except:
pass
base=os.path.basename(ff)
name,id=base.split("_")
try:
id,dummy=id.split(".")
except:
pass
target=dirname+"/"+args.simname+"/SNAPS/"+args.simname+"_"+id
if not os.path.islink(target):
print("target ",target)
print("ff =",ff)
try:
os.symlink(ff,target)
except OSError as e:
if e.errno == errno.EEXIST:
try:
os.remove(target)
os.symlink(ff,target)
except:
print("unable to remove ",target)
else:
raise e
# -----------------------------------------------------
# process, is the core function
def process1(args):
snap_list = sorted(glob.glob(args.snapshot+'_?'))
snap_list = snap_list+sorted(glob.glob(args.snapshot+'_??'))
snap_list = snap_list+sorted(glob.glob(args.snapshot+'_???'))
snap_list = snap_list+sorted(glob.glob(args.snapshot+'_????'))
snap_list = snap_list+sorted(glob.glob(args.snapshot+'_?????'))
cpt=0
for mysnap in snap_list:
mylink="snapshot_"+str(cpt)
if not os.path.islink(mylink):
print(mysnap,"snapshot_"+str(cpt))
os.symlink(mysnap,mylink)
cpt=cpt+1
# -----------------------------------------------------
# main program
if __name__ == '__main__':
commandLine()
#!/usr/bin/env python
import sys
from uns_simu import *
from simulations.ccod import *
import argparse
sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/','/home/jcl/works/GIT/uns_projects/py/modules/simulations']+sys.path
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# commandLine, parse the command line
def commandLine():
dbname=None
ncores=None
fastcod=True
threshold=10000
# help
parser = argparse.ArgumentParser(description="Build continuation fro MDF",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
# options
parser.add_argument('simname', help='Simulation name')
parser.add_argument('--dbname',help='UNS database file name', default=dbname)
parser.add_argument('--verbose',help='verbose mode', default=False)
# parse
args = parser.parse_args()
# start main funciton
process(args)
# -----------------------------------------------------
# process, is the core function
def process(args):
pass
# -----------------------------------------------------
# main program
if __name__ == '__main__':
commandLine()
......@@ -6,7 +6,7 @@
# save stars particles to density field for displaying with glnemo2
# MANDATORY
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import numpy as np # arrays are treated as numpy arrays
import math
import argparse
......
......@@ -5,7 +5,7 @@ import sys
sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/','/home/jcl/works/GIT/uns_projects/py/modules/simulations']+sys.path
#from py_unstools import * # import py_unstools package
from py_unsio import *
from unsio import *
from uns_simu import *
from general.ctools import *
import argparse
......
......@@ -3,7 +3,7 @@ from __future__ import print_function
import sys
import numpy as np
from py_unsio import *
from unsio import *
import argparse
......
......@@ -6,7 +6,7 @@ from __future__ import print_function
# save stars particles to density field for displaying with glnemo2
# MANDATORY
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import numpy as np # arrays are treated as numpy arrays
import math
import argparse
......
......@@ -9,7 +9,7 @@ import numpy as np
import argparse
import matplotlib
matplotlib.use('Agg')
#sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/','/home/jcl/works/GIT/uns_projects/py/modules/simulations']+sys.path
sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/','/home/jcl/works/GIT/uns_projects/py/modules/simulations']+sys.path
from simulations.cuns_analysis import *
......
......@@ -5,7 +5,7 @@ import sys
sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/','/home/jcl/works/GIT/uns_projects/py/modules/simulations']+sys.path
#from py_unstools import * # import py_unstools package
from py_unsio import *
from unsio import *
from uns_simu import *
import argparse
......
......@@ -2,7 +2,7 @@
from __future__ import print_function
import sys
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import argparse
......
......@@ -6,7 +6,7 @@
# save stars particles born before/after a specific time
# MANDATORY
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import numpy as np # arrays are treated as numpy arrays
import math
import argparse
......
......@@ -2,7 +2,7 @@
from __future__ import print_function
import sys
from py_unsio import * # import py_unsio package (UNSIO)
from unsio import * # import unsio package (UNSIO)
import argparse
import time
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment