aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-26 14:38:41 +0800
committerAaron LI <aly@aaronly.me>2017-08-26 14:38:41 +0800
commit3162a3d40618e3c9c888fe5ab192248f973e5897 (patch)
treea3cdb667a73752867cee03cb758e097d091baf00 /fg21sim
parent40c1dee62168b2bff91bab06027fb4b7e3145fc8 (diff)
downloadfg21sim-3162a3d40618e3c9c888fe5ab192248f973e5897.tar.bz2
Return the list of filepath to the written sky files
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/extragalactic/clusters/main.py8
-rw-r--r--fg21sim/galactic/freefree.py8
-rw-r--r--fg21sim/galactic/snr.py8
-rw-r--r--fg21sim/galactic/synchrotron.py13
4 files changed, 34 insertions, 3 deletions
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index f7aba0e..800a471 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -400,13 +400,21 @@ class GalaxyClusters:
def simulate(self):
"""
Simulate the sky images of radio halos at each frequency.
+
+ Returns
+ -------
+ skyfiles : list[str]
+ List of the filepath to the written sky files
"""
logger.info("Simulating {name} ...".format(name=self.name))
+ skyfiles = []
for idx, freq in enumerate(self.frequencies):
sky = self.simulate_frequency(freqidx=idx)
outfile = self._outfilepath(frequency=freq)
sky.write(outfile)
+ skyfiles.append(outfile)
logger.info("Done simulate {name}!".format(name=self.name))
+ return skyfiles
def postprocess(self):
"""
diff --git a/fg21sim/galactic/freefree.py b/fg21sim/galactic/freefree.py
index d3c663f..16535ef 100644
--- a/fg21sim/galactic/freefree.py
+++ b/fg21sim/galactic/freefree.py
@@ -265,6 +265,11 @@ class FreeFree:
The frequencies where to simulate the emission map.
Unit: [MHz]
Default: None (i.e., use ``self.frequencies``)
+
+ Returns
+ -------
+ skyfiles : list[str]
+ List of the filepath to the written sky files
"""
if frequencies is None:
frequencies = self.frequencies
@@ -272,11 +277,14 @@ class FreeFree:
frequencies = np.array(frequencies, ndmin=1)
logger.info("Simulating {name} ...".format(name=self.name))
+ skyfiles = []
for freq in frequencies:
sky = self.simulate_frequency(freq)
outfile = self._outfilepath(frequency=freq)
sky.write(outfile)
+ skyfiles.append(outfile)
logger.info("Done simulate {name}!".format(name=self.name))
+ return skyfiles
def postprocess(self):
"""Perform the post-simulation operations before the end."""
diff --git a/fg21sim/galactic/snr.py b/fg21sim/galactic/snr.py
index e77e24e..74b9525 100644
--- a/fg21sim/galactic/snr.py
+++ b/fg21sim/galactic/snr.py
@@ -400,6 +400,11 @@ class SuperNovaRemnants:
The frequencies where to simulate the foreground map.
Unit: [MHz]
Default: None (i.e., use ``self.frequencies``)
+
+ Returns
+ -------
+ skyfiles : list[str]
+ List of the filepath to the written sky files
"""
if frequencies is None:
frequencies = self.frequencies
@@ -407,11 +412,14 @@ class SuperNovaRemnants:
frequencies = np.array(frequencies, ndmin=1)
logger.info("Simulating {name} ...".format(name=self.name))
+ skyfiles = []
for freq in frequencies:
sky = self.simulate_frequency(freq)
outfile = self._outfilepath(frequency=freq)
sky.write(outfile)
+ skyfiles.append(outfile)
logger.info("Done simulate {name}!".format(name=self.name))
+ return skyfiles
def postprocess(self):
"""Perform the post-simulation operations before the end."""
diff --git a/fg21sim/galactic/synchrotron.py b/fg21sim/galactic/synchrotron.py
index f2de2ce..2d1a59f 100644
--- a/fg21sim/galactic/synchrotron.py
+++ b/fg21sim/galactic/synchrotron.py
@@ -191,14 +191,13 @@ class Synchrotron:
sky = self.sky.copy()
sky.frequency = frequency
ff = frequency / self.template_freq
- data = self.template * ff ** (-np.abs(self.indexmap))
- sky.data = data
+ sky.data = self.template * ff ** (-np.abs(self.indexmap))
logger.info("Done simulate map at %.2f [MHz]." % frequency)
return sky
def simulate(self, frequencies=None):
"""
- Simulate the synchrotron map at the specified frequencies.
+ Simulate the synchrotron maps.
Parameters
----------
@@ -206,6 +205,11 @@ class Synchrotron:
The frequencies where to simulate the foreground map.
Unit: [MHz]
Default: None (i.e., use ``self.frequencies``)
+
+ Returns
+ -------
+ skyfiles : list[str]
+ List of the filepath to the written sky files
"""
if frequencies is None:
frequencies = self.frequencies
@@ -213,11 +217,14 @@ class Synchrotron:
frequencies = np.array(frequencies, ndmin=1)
logger.info("Simulating {name} ...".format(name=self.name))
+ skyfiles = []
for freq in frequencies:
sky = self.simulate_frequency(freq)
outfile = self._outfilepath(frequency=freq)
sky.write(outfile)
+ skyfiles.append(outfile)
logger.info("Done simulate {name}!".format(name=self.name))
+ return skyfiles
def postprocess(self):
"""Perform the post-simulation operations before the end."""