aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-13 11:40:48 +0800
committerAaron LI <aly@aaronly.me>2017-08-13 11:40:48 +0800
commitc36c990656133dc0b7c159aad4f7faaa6ecc7e18 (patch)
treefa167b1f217c5c32cd21a680d7e4897bd0ac5057 /fg21sim
parent80389c40911fa154d041ea11d73833de088303fb (diff)
downloadfg21sim-c36c990656133dc0b7c159aad4f7faaa6ecc7e18.tar.bz2
sky.py: Add new properties to SkyBase
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/sky.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/fg21sim/sky.py b/fg21sim/sky.py
index eb9f824..99de963 100644
--- a/fg21sim/sky.py
+++ b/fg21sim/sky.py
@@ -9,6 +9,7 @@ maps.
import os
import logging
import copy
+from datetime import datetime, timezone
import numpy as np
from scipy import ndimage
@@ -85,7 +86,10 @@ class SkyBase:
The frequency of the sky image.
Unit: [MHz]
"""
- return self.frequency_
+ if self.frequency_ is not None:
+ return self.frequency_
+ else:
+ return self.header_.get("FREQ", None)
@frequency.setter
def frequency(self, value):
@@ -95,6 +99,36 @@ class SkyBase:
"""
self.frequency_ = value
+ @property
+ def creator(self):
+ """
+ The creator of the sky image.
+ """
+ if self.creator_ is not None:
+ return self.creator_
+ else:
+ return self.header_.get("CREATOR", None)
+
+ @creator.setter
+ def creator(self, value):
+ """
+ Set the creator of the sky image.
+ """
+ self.creator_ = value
+
+ @property
+ def header(self):
+ """
+ The FITS header of the current sky.
+ """
+ hdr = self.header_.copy()
+ hdr["SkyType"] = (self.type_, "Patch / HEALPix")
+ hdr["PixSize"] = (self.pixelsize, "Pixel size [arcsec]")
+ hdr["CREATOR"] = (self.creator, "Sky Creator")
+ hdr["DATE"] = (datetime.now(timezone.utc).astimezone().isoformat(),
+ "File creation date")
+ return hdr
+
def copy(self):
"""
Return a (deep) copy of this instance.