Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LAMBERT Jean-charles
uns_projects
Commits
de622b13
Commit
de622b13
authored
Oct 17, 2018
by
LAMBERT Jean-charles
Browse files
switch to unsio module
parent
651e6ad7
Pipeline
#697
failed with stages
Changes
36
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
de622b13
...
...
@@ -9,6 +9,7 @@
# python
*.pyc
\#*
# Compiled Object files
*.slo
...
...
py/mains/add_age_to_mult4.py
View file @
de622b13
#!/usr/bin/python
# unsio
from
py_
unsio
import
*
from
unsio
import
*
import
numpy
as
np
# cnd line
import
sys
,
getopt
,
os
.
path
...
...
py/mains/age_to_density.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/array_to_density.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/compare_snapshots.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/decrease_nbody.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/decrease_nbody_by_rho.py
View file @
de622b13
#!/usr/bin/env python
from
py_
unsio
import
*
from
unsio
import
*
import
numpy
as
np
import
argparse
...
...
py/mains/enzo2gadget.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/gas_life.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/link_continue_snapshot.py
0 → 100755
View file @
de622b13
#!/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
()
py/mains/mdf_build_continue.py
0 → 100644
View file @
de622b13
#!/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
()
py/mains/metal_to_density.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/op_file_dir.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/out2uns.py
View file @
de622b13
...
...
@@ -3,7 +3,7 @@ from __future__ import print_function
import
sys
import
numpy
as
np
from
py_
unsio
import
*
from
unsio
import
*
import
argparse
...
...
py/mains/pot_to_density.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/process_analysis.py
View file @
de622b13
...
...
@@ -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
*
...
...
py/mains/remove_sim_halo.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/sim_mass.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/stars_age.py
View file @
de622b13
...
...
@@ -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
...
...
py/mains/stream.py
View file @
de622b13
...
...
@@ -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
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment