Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122201008
makesnapshot.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 16, 14:00
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Jul 18, 14:00 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27448884
Attached To
rPNBODY pNbody
makesnapshot.py
View Options
#!/usr/bin/env python
from
pNbody
import
*
from
pNbody
import
ic
from
optparse
import
OptionParser
########################################
#
# parser
#
########################################
def
parse_options
():
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"-t"
,
action
=
"store"
,
dest
=
"ftype"
,
type
=
"string"
,
default
=
'simpleformat'
,
help
=
"type of the file"
,
metavar
=
" TYPE"
)
parser
.
add_option
(
"-f"
,
action
=
"store"
,
dest
=
"file"
,
type
=
"string"
,
default
=
'snap.dat'
,
help
=
"output file name"
,
metavar
=
" FILE"
)
parser
.
add_option
(
"-n"
,
action
=
"store"
,
dest
=
"n"
,
type
=
"int"
,
default
=
2
**
14
,
help
=
"number of particles"
,
metavar
=
" INT"
)
(
options
,
args
)
=
parser
.
parse_args
()
files
=
args
return
files
,
options
#################################
#
# main
#
#################################
files
,
opt
=
parse_options
()
ftype
=
opt
.
ftype
file
=
opt
.
file
# create file and save it
nb
=
ic
.
expd
(
n
=
opt
.
n
,
Hr
=
3.
,
Hz
=
0.3
,
Rmax
=
20
,
Zmax
=
2
,
irand
=
1
,
name
=
file
,
ftype
=
ftype
)
nb
.
write
()
print
"
%s
as been dumped."
%
file
Event Timeline
Log In to Comment