From 4a87cd796d882bafd2833d4e839f0ae78b849139 Mon Sep 17 00:00:00 2001
From: Sylvia Ploeckinger <sylvia.ploeckinger@univie.ac.at>
Date: Fri, 13 Oct 2023 14:31:26 +0200
Subject: [PATCH] Added data scripts

---
 data/create_ics_from_snapshot.py | 43 ++++++++++++++++++++++++++++++++
 data/getEaglePhotometryTable.sh  |  5 ++++
 data/getICs.sh                   |  6 +++++
 data/getPS20CoolingTables.sh     |  4 +++
 data/getYieldTable.sh            |  6 +++++
 data/getall.sh                   |  6 +++++
 6 files changed, 70 insertions(+)
 create mode 100644 data/create_ics_from_snapshot.py
 create mode 100755 data/getEaglePhotometryTable.sh
 create mode 100755 data/getICs.sh
 create mode 100755 data/getPS20CoolingTables.sh
 create mode 100755 data/getYieldTable.sh
 create mode 100755 data/getall.sh

diff --git a/data/create_ics_from_snapshot.py b/data/create_ics_from_snapshot.py
new file mode 100644
index 0000000..1144d71
--- /dev/null
+++ b/data/create_ics_from_snapshot.py
@@ -0,0 +1,43 @@
+
+import h5py
+import sys
+
+def ics_from_snapshot(inputfile, outputfile):
+    f_input  = h5py.File(inputfile, 'r')
+    f_output = h5py.File(outputfile, 'w')
+
+    f_input.copy('Header', f_output)
+    f_input.copy('Units', f_output)
+
+    g_PT0 = f_output.create_group('PartType0')
+    g_PT4 = f_output.create_group('PartType4')
+
+    f_input.copy('PartType0/Coordinates', g_PT0)
+    f_input.copy('PartType0/InternalEnergies', g_PT0)  # InternalEnergy
+    f_input.copy('PartType0/Masses', g_PT0)
+    f_input.copy('PartType0/ParticleIDs', g_PT0)
+    f_input.copy('PartType0/SmoothingLengths', g_PT0)   # SmoothingLength
+    f_input.copy('PartType0/Velocities', g_PT0)
+
+    f_input.copy('PartType4/Coordinates', g_PT4)
+    f_input.copy('PartType4/Masses', g_PT4)
+    f_input.copy('PartType4/ParticleIDs', g_PT4)
+    f_input.copy('PartType4/BirthTimes', g_PT4)  # StellarFormationTime 
+    f_input.copy('PartType4/Velocities', g_PT4)
+
+    f_output['PartType4/StellarFormationTime'] = f_output['PartType4/BirthTimes']
+    del f_output['PartType4/BirthTimes']
+
+    f_output['PartType0/SmoothingLength'] = f_output['PartType0/SmoothingLengths']
+    del f_output['PartType0/SmoothingLengths']
+
+    f_output['PartType0/InternalEnergy'] = f_output['PartType0/InternalEnergies']
+    del f_output['PartType0/InternalEnergies']
+
+    grp = f_output.create_group('Info')
+    grp.attrs["Input file"] = inputfile
+     
+    f_input.close()
+    f_output.close()
+
+    return
diff --git a/data/getEaglePhotometryTable.sh b/data/getEaglePhotometryTable.sh
new file mode 100755
index 0000000..8ef21a3
--- /dev/null
+++ b/data/getEaglePhotometryTable.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# from Swift IsolatedGalaxy_feedback example
+wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/YieldTables/EAGLE/photometry.tar.gz
+tar -xf photometry.tar.gz
diff --git a/data/getICs.sh b/data/getICs.sh
new file mode 100755
index 0000000..df2a886
--- /dev/null
+++ b/data/getICs.sh
@@ -0,0 +1,6 @@
+#!/bin/bash 
+
+# from Swift IsolatedGalaxy_feedback example (see Nobels et al. arXiv:2309.13750 for details)
+wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/ICs/IsolatedGalaxies_COLIBRE/M5_disk.hdf5
+wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/ICs/IsolatedGalaxies_COLIBRE/M6_disk.hdf5
+
diff --git a/data/getPS20CoolingTables.sh b/data/getPS20CoolingTables.sh
new file mode 100755
index 0000000..1131720
--- /dev/null
+++ b/data/getPS20CoolingTables.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+# get cooling tables from Ploeckinger & Schaye (2020)
+wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/CoolingTables/COLIBRE/UV_dust1_CR1_G1_shield1.hdf5
diff --git a/data/getYieldTable.sh b/data/getYieldTable.sh
new file mode 100755
index 0000000..045d22a
--- /dev/null
+++ b/data/getYieldTable.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# from Swift IsolatedGalaxy_feedback example
+wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/YieldTables/EAGLE/yieldtables.tar.gz
+tar -xf yieldtables.tar.gz
+
diff --git a/data/getall.sh b/data/getall.sh
new file mode 100755
index 0000000..30e27a2
--- /dev/null
+++ b/data/getall.sh
@@ -0,0 +1,6 @@
+#!/bin/bash 
+
+./getICs.sh
+./getEaglePhotometryTable.sh
+./getYieldTable.sh
+./getPS20CoolingTables.sh
-- 
GitLab