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

add justification of input pars range

parent 8b690ff1
Loading
Loading
Loading
Loading
Loading
+80 −45
Original line number Diff line number Diff line
@@ -268,13 +268,14 @@ class Map2d(object):

        # Check Input Parameters
        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):
            #raise Exception("Turn-over radius (rt) should be > 0 arcsec!")
            print("Turn-over radius (rt) should be > 0 arcsec!")
        if (ellip >= 1) or (ellip < 0):
            #raise Exception("Ellipcity (ellip) should be >= 0 and < 1!")
            print("Ellipcity (ellip) should be >= 0 and < 1!")
            raise Exception("Turn-over radius (rt) should be > 0 arcsec!")
        if (ellip > 1) or (ellip < 0):
            raise Exception("Ellipcity (ellip) should be >= 0 and < 1!")
            #print("Ellipcity (ellip) should be >= 0 and < 1!")
        if (theta > 180) or (theta < -180):
            print("Notice: Your input position angle (theta) is > 180 degree or < -180 degree.")

@@ -304,8 +305,8 @@ class Map2d(object):
        """
        # Check Input Parameters
        if (r_eff <= 0):
            #raise Exception("Effective radius (r_eff) should be > 0 arcsec!")
            print("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!")
        if (ellip > 1) or (ellip < 0):
            #raise Exception("Ellipcity (ellip) should be >= 0 and < 1!")
            print("Notice: Ellipcity (ellip) should be >= 0 and < 1!")
@@ -331,6 +332,8 @@ class Map2d(object):
        """
        if np.ndim(image) == 2:
            self.map = resize(image, (self.nx, self.ny))
        else:
            print("Input array should be a 2d-array!")
            
class StellarPopulationMap():
    """
@@ -364,22 +367,41 @@ class StellarPopulationMap():
        self.fov_x = config.fov_x
        self.fov_y = config.fov_y
        
        if (sbright == None):
            print('Input SurfaceBrightness Map is empty!')
        else:
            self.sbright = sbright.map
            self.mag = self.sbright - 2.5 * np.log10(self.dpix * self.dpix)
        
        if (logage == None):
            print('Input Age Map is empty!')
        else:
            self.logage  = logage.map
            self.age = 10 ** self.logage / 1e9
        
        if (feh == None):
            print('Input Metallicity Map is empty!')
        else:
            self.feh     = feh.map
        self.vel     = vel.map
        self.vdisp   = vdisp.map
        self.ebv     = ebv.map
        
        self.mag = self.sbright - 2.5 * np.log10(self.dpix * self.dpix)
        self.age = 10 ** self.logage / 1e9
        if (vel == None):
            print('Input Velocity Map is empty!')
        else:
            self.vel     = vel.map
        
        # Check Input Maps
        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.")
@@ -414,21 +436,34 @@ class IonizedGasMap():
        self.fov_x  = config.fov_x
        self.fov_y  = config.fov_y
        
        if (halpha == None):
            print('Input Halpha Map is empty!')
        else:
            self.halpha = halpha.map

        if (zh == None):
            print('Input ZH Map is empty!')
        else:
            self.zh     = zh.map
        self.vel    = vel.map
        self.vdisp  = vdisp.map
        self.ebv    = ebv.map

        #self.vdisp[self.vdisp < 10] = 10
        #self.ebv[self.ebv < 0]      = 0
        if (vel == None):
            print('Input Vel Map is empty!')
        else:
            self.vel    = vel.map

        # Check Input Maps
        if (vdisp == None):
            print('Input Vdisp Map is empty!')
            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
        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.")
+6 −5
Original line number Diff line number Diff line
@@ -386,7 +386,7 @@ class HII_Region():
        # Check Input Parameters
        #if (halpha < 0):
        #    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))
            flux_ratio = temp.flux_ratio[indz, :]
        else:
@@ -1003,6 +1003,7 @@ class StellarContinuum():
        else:
            if sigma_gal < 0:
                print('Notice: Your input velocity dispersion (vdisp) is < 0 km/s, which will be automatically adjusted to 0 km/s. ')
            flux0 = Stellar

        # Dust Reddening
        if np.isscalar(ebv):
@@ -1119,10 +1120,10 @@ class SingleStar():
            print("Notice: Your input magnitude (mag) is > 26 mag or < 8 mag.")
        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.")
        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.")
        if (feh < -2.69):
            raise Exception('Your input metallicity (feh) is beyond the range of stellar template [-2.69, 0.81]')
        #if (feh < -2.69):
        #    raise Exception('Your input metallicity (feh) is beyond the range of stellar template [-2.69, 0.81]')
        
    
        StarTemp = template.templates