Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Setup galaxy simulations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SoftenedJeansCriteria
Setup galaxy simulations
Commits
d83d954c
Commit
d83d954c
authored
1 year ago
by
Sylvia Plöckinger
Browse files
Options
Downloads
Patches
Plain Diff
Added setup fof script
parent
0376469c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup_fof.py
+73
-0
73 additions, 0 deletions
setup_fof.py
with
73 additions
and
0 deletions
setup_fof.py
0 → 100644
+
73
−
0
View file @
d83d954c
import
os
from
pathlib
import
Path
import
shutil
import
glob
import
re
##########################################
# Select mass resolution and snapshotnumber
##########################################
mass_resolution_levels
=
[
"
M5
"
]
snapshotnumber
=
100
##########################################
localdir
=
os
.
getcwd
()
for
mass
in
mass_resolution_levels
:
os
.
chdir
(
os
.
path
.
join
(
localdir
,
mass
))
for
runfolder
in
glob
.
glob
(
"
Galaxy*/
"
):
##########################################
# setting runfolder name and creating rerunfolder
##########################################
runfolder_absolute_path
=
os
.
path
.
join
(
localdir
,
mass
,
runfolder
)
rerunfolder_absolute_path
=
os
.
path
.
join
(
localdir
,
mass
+
"
_fofruns_snap%4.4i
"
%
(
snapshotnumber
),
"
FOF
"
+
runfolder
)
Path
(
rerunfolder_absolute_path
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
print
(
runfolder_absolute_path
)
##########################################
# change working directory to rerunfolder
##########################################
os
.
chdir
(
rerunfolder_absolute_path
)
##########################################
# copy files into foffolder
##########################################
shutil
.
copy2
(
"
../../fiducial_files/fof
"
,
"
./
"
)
shutil
.
copy2
(
"
../../fiducial_files/fof.yml
"
,
"
./
"
)
shutil
.
copy2
(
os
.
path
.
join
(
runfolder_absolute_path
,
"
isolated_galaxy.yml
"
),
"
./isolated_galaxy_fof.yml
"
)
shutil
.
copy2
(
os
.
path
.
join
(
runfolder_absolute_path
,
"
output_%4.4i.hdf5
"
%
(
int
(
snapshotnumber
))),
"
./
"
)
##########################################
# update yml file for fof run
##########################################
string_filename
=
"
file_name: output_%4.4i.hdf5
"
%
(
int
(
snapshotnumber
))
f
=
open
(
"
isolated_galaxy_fof.yml
"
,
"
rt
"
)
data
=
f
.
read
()
data
=
re
.
sub
(
r
'
^.*file_name.*$
'
,
string_filename
,
data
,
flags
=
re
.
MULTILINE
)
data
=
re
.
sub
(
r
'
^.*basename.*$
'
,
'
basename: fof_group_output
'
,
data
,
flags
=
re
.
MULTILINE
)
f
.
close
()
f
=
open
(
"
fof.yml
"
,
"
rt
"
)
datafof
=
f
.
read
()
f
.
close
()
f
=
open
(
"
isolated_galaxy_fof.yml
"
,
"
wt
"
)
f
.
write
(
data
)
f
.
write
(
datafof
)
f
.
close
()
##########################################
# start swift for one timestep
##########################################
os
.
system
(
"
./fof --stars isolated_galaxy_fof.yml
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment