Commit 5d321fc4 authored by Shuai Feng's avatar Shuai Feng
Browse files

add justification of input pars range

parent 8b690ff1
Pipeline #6995 passed with stage
in 0 seconds
...@@ -268,13 +268,14 @@ class Map2d(object): ...@@ -268,13 +268,14 @@ class Map2d(object):
# Check Input Parameters # Check Input Parameters
if (vmax <= 0): if (vmax <= 0):
print("Notice: Your input maximum rotational velocity (vmax) is <= 0 km/s!") #print("Notice: Your input maximum rotational velocity (vmax) is <= 0 km/s!")
raise Exception("Maximum rotational velocity (vmax) should be >0 km/s!")
if (rt <= 0): if (rt <= 0):
#raise Exception("Turn-over radius (rt) should be > 0 arcsec!") #raise Exception("Turn-over radius (rt) should be > 0 arcsec!")
print("Turn-over radius (rt) should be > 0 arcsec!") raise Exception("Turn-over radius (rt) should be > 0 arcsec!")
if (ellip >= 1) or (ellip < 0): if (ellip > 1) or (ellip < 0):
#raise Exception("Ellipcity (ellip) should be >= 0 and < 1!") raise Exception("Ellipcity (ellip) should be >= 0 and < 1!")
print("Ellipcity (ellip) should be >= 0 and < 1!") #print("Ellipcity (ellip) should be >= 0 and < 1!")
if (theta > 180) or (theta < -180): if (theta > 180) or (theta < -180):
print("Notice: Your input position angle (theta) is > 180 degree or < -180 degree.") print("Notice: Your input position angle (theta) is > 180 degree or < -180 degree.")
...@@ -304,8 +305,8 @@ class Map2d(object): ...@@ -304,8 +305,8 @@ class Map2d(object):
""" """
# Check Input Parameters # Check Input Parameters
if (r_eff <= 0): if (r_eff <= 0):
#raise Exception("Effective radius (r_eff) should be > 0 arcsec!") raise Exception("Effective radius (r_eff) should be > 0 arcsec!")
print("Effective radius (r_eff) should be > 0 arcsec!") #print("Effective radius (r_eff) should be > 0 arcsec!")
if (ellip > 1) or (ellip < 0): if (ellip > 1) or (ellip < 0):
#raise Exception("Ellipcity (ellip) should be >= 0 and < 1!") #raise Exception("Ellipcity (ellip) should be >= 0 and < 1!")
print("Notice: Ellipcity (ellip) should be >= 0 and < 1!") print("Notice: Ellipcity (ellip) should be >= 0 and < 1!")
...@@ -331,6 +332,8 @@ class Map2d(object): ...@@ -331,6 +332,8 @@ class Map2d(object):
""" """
if np.ndim(image) == 2: if np.ndim(image) == 2:
self.map = resize(image, (self.nx, self.ny)) self.map = resize(image, (self.nx, self.ny))
else:
print("Input array should be a 2d-array!")
class StellarPopulationMap(): class StellarPopulationMap():
""" """
...@@ -364,26 +367,45 @@ class StellarPopulationMap(): ...@@ -364,26 +367,45 @@ class StellarPopulationMap():
self.fov_x = config.fov_x self.fov_x = config.fov_x
self.fov_y = config.fov_y self.fov_y = config.fov_y
self.sbright = sbright.map if (sbright == None):
self.logage = logage.map print('Input SurfaceBrightness Map is empty!')
self.feh = feh.map else:
self.vel = vel.map self.sbright = sbright.map
self.vdisp = vdisp.map self.mag = self.sbright - 2.5 * np.log10(self.dpix * self.dpix)
self.ebv = ebv.map
self.mag = self.sbright - 2.5 * np.log10(self.dpix * self.dpix) if (logage == None):
self.age = 10 ** self.logage / 1e9 print('Input Age Map is empty!')
else:
self.logage = logage.map
self.age = 10 ** self.logage / 1e9
# Check Input Maps if (feh == None):
ind_overrange = (self.vdisp < 10) print('Input Metallicity Map is empty!')
if len(self.vdisp[ind_overrange]) > 0: else:
print("Notice: Spaxel with <10km/s in the input vdisp map will be automatically adjusted to 10km/s.") self.feh = feh.map
self.vdisp[ind_overrange] = 10
if (vel == None):
ind_overrange = (self.ebv < 0) print('Input Velocity Map is empty!')
if len(self.ebv[ind_overrange]) > 0: else:
print("Notice: Spaxel with < 0 mag in the input ebv map will be automatically adjusted to 0 mag.") self.vel = vel.map
self.ebv[ind_overrange] = 0
if (vdisp == None):
print('Input VelocityDispersion Map is empty!')
else:
self.vdisp = vdisp.map
ind_overrange = (self.vdisp < 10)
if len(self.vdisp[ind_overrange]) > 0:
print("Notice: Spaxel with <10km/s in the input vdisp map will be automatically adjusted to 10km/s.")
self.vdisp[ind_overrange] = 10
if (ebv == None):
print('Input EBV Map is empty!')
else:
self.ebv = ebv.map
ind_overrange = (self.ebv < 0)
if len(self.ebv[ind_overrange]) > 0:
print("Notice: Spaxel with < 0 mag in the input ebv map will be automatically adjusted to 0 mag.")
self.ebv[ind_overrange] = 0
class IonizedGasMap(): class IonizedGasMap():
""" """
...@@ -407,29 +429,42 @@ class IonizedGasMap(): ...@@ -407,29 +429,42 @@ class IonizedGasMap():
Class of the map of dust extinction, by default None Class of the map of dust extinction, by default None
""" """
def __init__(self, config, halpha = None, zh = None, vel = None, vdisp = None, ebv = None): def __init__(self, config, halpha = None, zh = None, vel = None, vdisp = None, ebv = None):
self.nx = config.nx self.nx = config.nx
self.ny = config.ny self.ny = config.ny
self.dpix = config.dpix self.dpix = config.dpix
self.fov_x = config.fov_x self.fov_x = config.fov_x
self.fov_y = config.fov_y self.fov_y = config.fov_y
self.halpha = halpha.map if (halpha == None):
self.zh = zh.map print('Input Halpha Map is empty!')
self.vel = vel.map else:
self.vdisp = vdisp.map self.halpha = halpha.map
self.ebv = ebv.map
if (zh == None):
#self.vdisp[self.vdisp < 10] = 10 print('Input ZH Map is empty!')
#self.ebv[self.ebv < 0] = 0 else:
self.zh = zh.map
# Check Input Maps
ind_overrange = (self.vdisp < 10) if (vel == None):
if len(self.vdisp[ind_overrange]) > 0: print('Input Vel Map is empty!')
print("Notice: Spaxel with <10km/s in the input vdisp map will be automatically adjusted to 10km/s.") else:
self.vdisp[ind_overrange] = 10 self.vel = vel.map
ind_overrange = (self.ebv < 0) if (vdisp == None):
if len(self.ebv[ind_overrange]) > 0: print('Input Vdisp Map is empty!')
print("Notice: Spaxel with < 0 mag in the input ebv map will be automatically adjusted to 0 mag.") ind_overrange = (self.vdisp < 10)
self.ebv[ind_overrange] = 0 if len(self.vdisp[ind_overrange]) > 0:
\ No newline at end of file print("Notice: Spaxel with <10km/s in the input vdisp map will be automatically adjusted to 10km/s.")
self.vdisp[ind_overrange] = 10
else:
self.vdisp = vdisp.map
if (ebv == None):
print('Input EBV Map is empty!')
else:
self.ebv = ebv.map
ind_overrange = (self.ebv < 0)
if len(self.ebv[ind_overrange]) > 0:
print("Notice: Spaxel with < 0 mag in the input ebv map will be automatically adjusted to 0 mag.")
self.ebv[ind_overrange] = 0
\ No newline at end of file
...@@ -386,7 +386,7 @@ class HII_Region(): ...@@ -386,7 +386,7 @@ class HII_Region():
# Check Input Parameters # Check Input Parameters
#if (halpha < 0): #if (halpha < 0):
# print("Notice: Your input Halpha flux (halpha) is < 0 erg/s/A/cm^2. ") # print("Notice: Your input Halpha flux (halpha) is < 0 erg/s/A/cm^2. ")
if (logz > -2) & (logz < 0.5): if (logz >= -2) & (logz <= 0.5):
indz = np.argmin(np.abs(logz - temp.logz_grid)) indz = np.argmin(np.abs(logz - temp.logz_grid))
flux_ratio = temp.flux_ratio[indz, :] flux_ratio = temp.flux_ratio[indz, :]
else: else:
...@@ -1003,7 +1003,8 @@ class StellarContinuum(): ...@@ -1003,7 +1003,8 @@ class StellarContinuum():
else: else:
if sigma_gal < 0: if sigma_gal < 0:
print('Notice: Your input velocity dispersion (vdisp) is < 0 km/s, which will be automatically adjusted to 0 km/s. ') print('Notice: Your input velocity dispersion (vdisp) is < 0 km/s, which will be automatically adjusted to 0 km/s. ')
flux0 = Stellar
# Dust Reddening # Dust Reddening
if np.isscalar(ebv): if np.isscalar(ebv):
flux0 = reddening(wave, flux0, ebv = ebv) flux0 = reddening(wave, flux0, ebv = ebv)
...@@ -1119,10 +1120,10 @@ class SingleStar(): ...@@ -1119,10 +1120,10 @@ class SingleStar():
print("Notice: Your input magnitude (mag) is > 26 mag or < 8 mag.") print("Notice: Your input magnitude (mag) is > 26 mag or < 8 mag.")
if (teff < 2820) or (teff > 20129): if (teff < 2820) or (teff > 20129):
print("Notice: Your input effective tempreture (teff) is beyond the range of stellar template [2820, 20129], which will be automatically adjusted to the upper/lower limit.") print("Notice: Your input effective tempreture (teff) is beyond the range of stellar template [2820, 20129], which will be automatically adjusted to the upper/lower limit.")
if (feh > 0.81): if (feh > 0.81) or (feh < -2.69):
print("Notice: Your input metallicity (feh) is beyond the range of stellar template [-2.69, 0.81], which will be automatically adjusted to the upper limit.") print("Notice: Your input metallicity (feh) is beyond the range of stellar template [-2.69, 0.81], which will be automatically adjusted to the upper limit.")
if (feh < -2.69): #if (feh < -2.69):
raise Exception('Your input metallicity (feh) is beyond the range of stellar template [-2.69, 0.81]') # raise Exception('Your input metallicity (feh) is beyond the range of stellar template [-2.69, 0.81]')
StarTemp = template.templates StarTemp = template.templates
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment