aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-10-17 18:21:13 +0800
committerAaron LI <aaronly.me@outlook.com>2016-10-17 18:21:13 +0800
commit3fb0539004b621631ebdb02f538b2060d31b79f9 (patch)
treec243b24584225f188d883ccbc3bf297983ba73a5
parentd00427046e3a50148a0f40ad41ab550b62431965 (diff)
downloadfg21sim-3fb0539004b621631ebdb02f538b2060d31b79f9.tar.bz2
galactic: Move the "simulate()" method; Add "UNIT" keyword
-rw-r--r--fg21sim/galactic/freefree.py25
-rw-r--r--fg21sim/galactic/synchrotron.py29
2 files changed, 28 insertions, 26 deletions
diff --git a/fg21sim/galactic/freefree.py b/fg21sim/galactic/freefree.py
index 352621b..c20f0c1 100644
--- a/fg21sim/galactic/freefree.py
+++ b/fg21sim/galactic/freefree.py
@@ -198,6 +198,18 @@ class FreeFree:
hpmap_f = self.halphamap * ratio_K_R
return hpmap_f
+ def simulate(self, frequencies):
+ """Simulate the free-free map at the specified frequencies."""
+ hpmaps = []
+ for f in np.array(frequencies, ndmin=1):
+ logger.info("Simulating free-free map at {0} ({1}) ...".format(
+ f, self.freq_unit))
+ hpmap_f = self._simulate_frequency(f)
+ hpmaps.append(hpmap_f)
+ if self.save:
+ self.output(hpmap_f, f)
+ return hpmaps
+
def _make_header(self):
"""Make the header with detail information (e.g., parameters and
history) for the simulated products.
@@ -205,6 +217,7 @@ class FreeFree:
header = fits.Header()
header["COMP"] = ("Galactic free-free emission",
"Emission component")
+ header["UNIT"] = ("Kelvin", "Map unit")
header["CREATOR"] = (__name__, "File creator")
# TODO:
history = []
@@ -241,15 +254,3 @@ class FreeFree:
write_fits_healpix(filepath, hpmap, header=header,
clobber=self.clobber)
logger.info("Write simulated map to file: {0}".format(filepath))
-
- def simulate(self, frequencies):
- """Simulate the free-free map at the specified frequencies."""
- hpmaps = []
- for f in np.array(frequencies, ndmin=1):
- logger.info("Simulating free-free map at {0} ({1}) ...".format(
- f, self.freq_unit))
- hpmap_f = self._simulate_frequency(f)
- hpmaps.append(hpmap_f)
- if self.save:
- self.output(hpmap_f, f)
- return hpmaps
diff --git a/fg21sim/galactic/synchrotron.py b/fg21sim/galactic/synchrotron.py
index a4402c2..a5e8b57 100644
--- a/fg21sim/galactic/synchrotron.py
+++ b/fg21sim/galactic/synchrotron.py
@@ -149,6 +149,20 @@ class Synchrotron:
(frequency / self.template_freq) ** self.indexmap)
return hpmap_f
+ def simulate(self, frequencies):
+ """Simulate the synchrotron map at the specified frequencies."""
+ self._add_smallscales()
+ #
+ hpmaps = []
+ for f in np.array(frequencies, ndmin=1):
+ logger.info("Simulating synchrotron map at {0} ({1}) ...".format(
+ f, self.freq_unit))
+ hpmap_f = self._transform_frequency(f)
+ hpmaps.append(hpmap_f)
+ if self.save:
+ self.output(hpmap_f, f)
+ return hpmaps
+
def _make_header(self):
"""Make the header with detail information (e.g., parameters and
history) for the simulated products.
@@ -156,6 +170,7 @@ class Synchrotron:
header = fits.Header()
header["COMP"] = ("Galactic synchrotron (unpolarized)",
"Emission component")
+ header["UNIT"] = ("Kelvin", "Map unit")
header["CREATOR"] = (__name__, "File creator")
# TODO:
history = []
@@ -192,17 +207,3 @@ class Synchrotron:
write_fits_healpix(filepath, hpmap, header=header,
clobber=self.clobber)
logger.info("Write simulated map to file: {0}".format(filepath))
-
- def simulate(self, frequencies):
- """Simulate the synchrotron map at the specified frequencies."""
- self._add_smallscales()
- #
- hpmaps = []
- for f in np.array(frequencies, ndmin=1):
- logger.info("Simulating synchrotron map at {0} ({1}) ...".format(
- f, self.freq_unit))
- hpmap_f = self._transform_frequency(f)
- hpmaps.append(hpmap_f)
- if self.save:
- self.output(hpmap_f, f)
- return hpmaps