コード例 #1
0
ファイル: yields.py プロジェクト: jobovy/flexce
    def load_rprocess_yields(self):
        """Load r-process element yields.

        Cescutti et al. (2006) r-process Ba & Eu yields for M = 12, 15, 30
        Msun that are metallicity independent.
        """
        self.rprocess_yields = pickle_read(
            join(self.path_rprocess, 'cescutti06_yields.pck'))
コード例 #2
0
ファイル: yields.py プロジェクト: bretthandrews/flexCE
    def load_rprocess_yields(self):
        """Load r-process element yields.

        Cescutti et al. (2006) r-process Ba & Eu yields for M = 12, 15, 30
        Msun that are metallicity independent.
        """
        self.rprocess_yields = pickle_read(join(self.path_rprocess,
                                                'cescutti06_yields.pck'))
コード例 #3
0
ファイル: yields.py プロジェクト: bretthandrews/flexCE
    def load_sprocess_yields(self, supersolar=False):
        """Load s-process element yields.

        Busso et al. (2001) s-process Ba yields for M < 8 Msun & Z =
        2e-4--4e-2 (twice solar and twice the maximum Limongi & Chieffi
        metallicity).

        supersolar: if True, use the yields that extend from solar (Z = 2e-2)
        to twice solar (Z = 4e-2), otherwise only use the yields up to solar.
        """
        if supersolar:
            self.sprocess_z = pickle_read(join(self.path_sprocess,
                                               'busso01ext_metallicity.pck'))
            self.sprocess_yields = pickle_read(join(self.path_sprocess,
                                                    'busso01ext_yields.pck'))
        else:
            self.sprocess_yields = pickle_read(join(self.path_sprocess,
                                                    'busso01_yields.pck'))
コード例 #4
0
ファイル: yields.py プロジェクト: bretthandrews/flexCE
    def load_snii_yields(self):
        """Load SNII yields.

        Limongi & Chieffi SN II Yields: 1001 metallicities, 92 masses from
        8 to 100 msun, 293 isotopes.

        WW95 yields are also on same metallicity--stellar mass--isotope grid.
        """
        self.snii_z = pickle_read(join(self.path_yldgen, 'interp_metallicity.pck'))
        self.snii_yields = pickle_read(join(self.path_snii, 'interp_yields.pck'))
        self.snii_mej = pickle_read(join(self.path_snii, 'interp_meject.pck'))
        self.snii_rem = pickle_read(join(self.path_snii, 'interp_mremnant.pck'))
        self.snii_agb_z = copy.deepcopy(self.snii_z)
        self.n_z = len(self.snii_agb_z)
        # adjust for a different upper mass limit to the IMF
        self.snii_yields = self.snii_yields[:, :self.n_bins_high, :]
        self.snii_mej = self.snii_mej[:, :self.n_bins_high]
        self.snii_rem = self.snii_rem[:, :self.n_bins_high]
コード例 #5
0
ファイル: yields.py プロジェクト: jobovy/flexce
    def load_sprocess_yields(self, supersolar=False):
        """Load s-process element yields.

        Busso et al. (2001) s-process Ba yields for M < 8 Msun & Z =
        2e-4--4e-2 (twice solar and twice the maximum Limongi & Chieffi
        metallicity).

        supersolar: if True, use the yields that extend from solar (Z = 2e-2)
        to twice solar (Z = 4e-2), otherwise only use the yields up to solar.
        """
        if supersolar:
            self.sprocess_z = pickle_read(
                join(self.path_sprocess, 'busso01ext_metallicity.pck'))
            self.sprocess_yields = pickle_read(
                join(self.path_sprocess, 'busso01ext_yields.pck'))
        else:
            self.sprocess_yields = pickle_read(
                join(self.path_sprocess, 'busso01_yields.pck'))
コード例 #6
0
ファイル: yields.py プロジェクト: jsobeck/flexCE
 def concat_ncapture_yields(self, r_elements, s_elements):
     """Create an array of r- and s-process isotopic yields."""
     nclib = pickle_read(self.path_yldgen + 'sneden08.pck')
     # unique elements arranged by atomic number
     elements = np.unique(r_elements + s_elements)
     at_num = []
     for item in elements:
         at_num.append(nclib[item]['Z'])
     at_num = np.array(at_num)
     elements = elements[np.argsort(at_num)]
     self.nc_sym = []
     self.nc_sym_mass = []
     for item in elements:
         n_tmp = len(nclib[item]['Isotope'])
         for i in range(n_tmp):
             self.nc_sym.append(item + str(nclib[item]['Isotope'][i]))
             self.nc_sym_mass.append(nclib[item]['Isotope'][i])
     self.nc_sym = np.array(self.nc_sym)
     self.nc_sym_mass = np.array(self.nc_sym_mass)
     self.n_nc_sym = len(self.nc_sym)
     u, indices = np.unique([item.rstrip('0123456789')
                             for item in self.nc_sym], return_index=True)
     indices_s = np.argsort(indices)
     self.nc_element = u[indices_s]
     # project elemental yields onto relative isotopic abundances
     self.nc_yields = np.zeros((self.n_z, self.n_bins, self.n_nc_sym))
     cnt = 0
     for i in range(len(elements)):
         el = elements[i]
         el_iso = len(nclib[el]['Isotope'])
         if el in r_elements:
             j = np.where(np.array(r_elements) == el)[0]
             self.nc_yields[:, -self.n_bins_high:, cnt:cnt+el_iso] = \
                            (np.ones((self.n_z, self.n_bins_high, el_iso)) *
                             self.rprocess_yields[:, -self.n_bins_high:, j] *
                             nclib[el]['isotopic_fraction[r]'])
         if el in s_elements:
             j = np.where(np.array(s_elements) == el)[0]
             self.nc_yields[:, :self.n_bins_low, cnt:cnt+el_iso] = \
                             (np.ones((self.n_z, self.n_bins_low, el_iso)) *
                              self.sprocess_yields[:, :, j] *
                              nclib[el]['isotopic_fraction[s]'])
         cnt += el_iso
     # update arrays
     self.sym = np.append(self.snii_sym, self.nc_sym)
     self.sym_mass = np.append(self.snii_sym_mass, self.nc_sym_mass)
     self.n_sym = len(self.sym)
     self.element = np.append(self.element, self.nc_element)
     self.n_elements = len(self.element)
     self.bbmf = np.append(self.bbmf, np.zeros(self.n_nc_sym))
     self.snia_yields = np.append(self.snia_yields, np.zeros(self.n_nc_sym))
     self.snii_yields = np.append(self.snii_yields,
                                  self.nc_yields[:, self.ind8:], axis=2)
     self.agb_yields = np.append(self.agb_yields,
                                 self.nc_yields[:, :self.ind8], axis=2)
     self.snii_agb_rem = np.concatenate((self.agb_rem, self.snii_rem),
                                        axis=1)
コード例 #7
0
ファイル: yields.py プロジェクト: jobovy/flexce
    def load_snii_yields(self):
        """Load SNII yields.

        Limongi & Chieffi SN II Yields: 1001 metallicities, 92 masses from
        8 to 100 msun, 293 isotopes.

        WW95 yields are also on same metallicity--stellar mass--isotope grid.
        """
        self.snii_z = pickle_read(
            join(self.path_yldgen, 'interp_metallicity.pck'))
        self.snii_yields = pickle_read(
            join(self.path_snii, 'interp_yields.pck'))
        self.snii_mej = pickle_read(join(self.path_snii, 'interp_meject.pck'))
        self.snii_rem = pickle_read(join(self.path_snii,
                                         'interp_mremnant.pck'))
        self.snii_agb_z = copy.deepcopy(self.snii_z)
        self.n_z = len(self.snii_agb_z)
        # adjust for a different upper mass limit to the IMF
        self.snii_yields = self.snii_yields[:, :self.n_bins_high, :]
        self.snii_mej = self.snii_mej[:, :self.n_bins_high]
        self.snii_rem = self.snii_rem[:, :self.n_bins_high]
コード例 #8
0
ファイル: yields.py プロジェクト: jobovy/flexce
    def load_agb_yields(self):
        """Load AGB yields.

        Karakas AGB Yields: 1001 metallicities, 79 masses from 0.1 to 8
        msun, 70 isotopes.

        Only works for Karakas et al. (2010) AGB yields.

        B8, O14, Ne19, and Si33 are not in the LC yields.  The latter three K10
        yields are always 0 and the B8 yield is essentially zero (<1e-17), so I
        have removed those from agb_sym, agb_yields_in, and agb_yields.
        """
        self._check_yield_grids(self.path_agb)
        agb_sym = pd.read_csv(join(self.path_agb, 'species.txt'),
                              delim_whitespace=True,
                              skiprows=1,
                              usecols=[1],
                              names=['name'])
        self.agb_sym = np.array(agb_sym['name'])
        self.agb_z = pickle_read(
            join(self.path_yldgen, 'interp_metallicity.pck'))
        agb_yields_in = pickle_read(join(self.path_agb, 'interp_yields.pck'))
        # remove isotopes not in the LC06 yields
        agb_yields_in = np.delete(agb_yields_in, np.s_[6, 13, 23, 47], axis=2)
        self.agb_mej = pickle_read(join(self.path_agb, 'interp_meject.pck'))
        self.agb_rem = pickle_read(join(self.path_agb, 'interp_mremnant.pck'))
        # Create an array with the same elements as the Limongi & Chieffi
        # (2006) SNII yields.
        self.agb_yields = np.zeros(
            (agb_yields_in.shape[0], agb_yields_in.shape[1],
             self.snii_yields.shape[2]))
        ind_agb = np.array([], dtype=int)
        for i in range(len(self.agb_sym)):
            tmp = np.where(self.agb_sym[i] == self.snii_sym)[0]
            ind_agb = np.append(ind_agb, tmp)
        self.agb_yields[:, :, ind_agb] = copy.deepcopy(agb_yields_in)
        if self.mlow == 0.2:
            self.agb_mej = self.agb_mej[:, 1:]
            self.agb_rem = self.agb_rem[:, 1:]
            self.agb_yields = self.agb_yields[:, 1:]
コード例 #9
0
ファイル: yields.py プロジェクト: jsobeck/flexCE
    def load_snia_yields(self, model):
        """Load SNIa yields.

        Iwamoto et al. (1999) models\:
        cdd1\: CDD1
        cdd2\: CDD2
        w7\: single-degenerate model from Nomoto et al. (1984)
        w70\: zero-metallicity version of W7
        wdd1\: WDD1
        wdd2\: WDD2
        wdd3\: WDD3
        """
        self.snia_yields = pickle_read(self.path_snia + model + '_yields.pck')
コード例 #10
0
ファイル: yields.py プロジェクト: jobovy/flexce
    def load_snia_yields(self, model):
        """Load SNIa yields.

        Iwamoto et al. (1999) models\:
        cdd1\: CDD1
        cdd2\: CDD2
        w7\: single-degenerate model from Nomoto et al. (1984)
        w70\: zero-metallicity version of W7
        wdd1\: WDD1
        wdd2\: WDD2
        wdd3\: WDD3
        """
        self.snia_yields = pickle_read(
            join(self.path_snia, model + '_yields.pck'))
コード例 #11
0
ファイル: yields.py プロジェクト: bretthandrews/flexCE
    def load_agb_yields(self):
        """Load AGB yields.

        Karakas AGB Yields: 1001 metallicities, 79 masses from 0.1 to 8
        msun, 70 isotopes.

        Only works for Karakas et al. (2010) AGB yields.

        B8, O14, Ne19, and Si33 are not in the LC yields.  The latter three K10
        yields are always 0 and the B8 yield is essentially zero (<1e-17), so I
        have removed those from agb_sym, agb_yields_in, and agb_yields.
        """
        self._check_yield_grids(self.path_agb)
        agb_sym = pd.read_csv(join(self.path_agb, 'species.txt'),
                              delim_whitespace=True, skiprows=1, usecols=[1],
                              names=['name'])
        self.agb_sym = np.array(agb_sym['name'])
        self.agb_z = pickle_read(join(self.path_yldgen, 'interp_metallicity.pck'))
        agb_yields_in = pickle_read(join(self.path_agb, 'interp_yields.pck'))
        # remove isotopes not in the LC06 yields
        agb_yields_in = np.delete(agb_yields_in, np.s_[6, 13, 23, 47], axis=2)
        self.agb_mej = pickle_read(join(self.path_agb, 'interp_meject.pck'))
        self.agb_rem = pickle_read(join(self.path_agb, 'interp_mremnant.pck'))
        # Create an array with the same elements as the Limongi & Chieffi
        # (2006) SNII yields.
        self.agb_yields = np.zeros((agb_yields_in.shape[0],
                                    agb_yields_in.shape[1],
                                    self.snii_yields.shape[2]))
        ind_agb = np.array([], dtype=int)
        for i in range(len(self.agb_sym)):
            tmp = np.where(self.agb_sym[i] == self.snii_sym)[0]
            ind_agb = np.append(ind_agb, tmp)
        self.agb_yields[:, :, ind_agb] = copy.deepcopy(agb_yields_in)
        if self.mlow == 0.2:
            self.agb_mej = self.agb_mej[:, 1:]
            self.agb_rem = self.agb_rem[:, 1:]
            self.agb_yields = self.agb_yields[:, 1:]
コード例 #12
0
ファイル: yields.py プロジェクト: jobovy/flexce
 def concat_ncapture_yields(self, r_elements, s_elements):
     """Create an array of r- and s-process isotopic yields."""
     nclib = pickle_read(join(self.path_yldgen, 'sneden08.pck'))
     # unique elements arranged by atomic number
     elements = np.unique(r_elements + s_elements)
     at_num = []
     for item in elements:
         at_num.append(nclib[item]['Z'])
     at_num = np.array(at_num)
     elements = elements[np.argsort(at_num)]
     self.nc_sym = []
     self.nc_sym_mass = []
     for item in elements:
         n_tmp = len(nclib[item]['Isotope'])
         for i in range(n_tmp):
             self.nc_sym.append(item + str(nclib[item]['Isotope'][i]))
             self.nc_sym_mass.append(nclib[item]['Isotope'][i])
     self.nc_sym = np.array(self.nc_sym)
     self.nc_sym_mass = np.array(self.nc_sym_mass)
     self.n_nc_sym = len(self.nc_sym)
     u, indices = np.unique(
         [item.rstrip('0123456789') for item in self.nc_sym],
         return_index=True)
     indices_s = np.argsort(indices)
     self.nc_element = u[indices_s]
     # project elemental yields onto relative isotopic abundances
     self.nc_yields = np.zeros((self.n_z, self.n_bins, self.n_nc_sym))
     cnt = 0
     for i in range(len(elements)):
         el = elements[i]
         el_iso = len(nclib[el]['Isotope'])
         if el in r_elements:
             j = np.where(np.array(r_elements) == el)[0]
             self.nc_yields[:, -self.n_bins_high:, cnt:cnt+el_iso] = \
                            (np.ones((self.n_z, self.n_bins_high, el_iso)) *
                             self.rprocess_yields[:, -self.n_bins_high:, j] *
                             nclib[el]['isotopic_fraction[r]'])
         if el in s_elements:
             j = np.where(np.array(s_elements) == el)[0]
             self.nc_yields[:, :self.n_bins_low, cnt:cnt+el_iso] = \
                             (np.ones((self.n_z, self.n_bins_low, el_iso)) *
                              self.sprocess_yields[:, :, j] *
                              nclib[el]['isotopic_fraction[s]'])
         cnt += el_iso
     # update arrays
     self.sym = np.append(self.snii_sym, self.nc_sym)
     self.sym_mass = np.append(self.snii_sym_mass, self.nc_sym_mass)
     self.n_sym = len(self.sym)
     self.element = np.append(self.element, self.nc_element)
     self.n_elements = len(self.element)
     self.bbmf = np.append(self.bbmf, np.zeros(self.n_nc_sym))
     if len(self.snia_yields.shape) == 1:
         # metallicity-independent SNIa yields
         self.snia_yields = np.append(self.snia_yields,
                                      np.zeros(self.n_nc_sym))
     elif len(self.snia_yields.shape) == 2:
         # metallicity-dependent SNIa yields
         self.snia_yields = np.append(self.snia_yields,
                                      np.zeros((self.nc_yields.shape[0],
                                                self.nc_yields.shape[2])),
                                      axis=1)
     self.snii_yields = np.append(self.snii_yields,
                                  self.nc_yields[:, self.ind8:],
                                  axis=2)
     self.agb_yields = np.append(self.agb_yields,
                                 self.nc_yields[:, :self.ind8],
                                 axis=2)
     self.snii_agb_rem = np.concatenate((self.agb_rem, self.snii_rem),
                                        axis=1)