コード例 #1
0
def Ar_S_model_pyneb(Line_dict, diags, Ar3_atom, Ar4_atom, S3_atom, S4_atom):
 
    TSIII, NSII = diags.getCrossTemDen(diag_tem = '[SIII] 6312/9200+', diag_den = '[SII] 6731/6716',
                                            value_tem = Line_dict['6312A'] / (Line_dict['9068.62A'] + Line_dict['9532A']),
                                            value_den = Line_dict['6731A']/Line_dict['6716A']) 
 
    TOIII, NSII_2 = diags.getCrossTemDen(diag_tem = '[OIII] 4363/5007+', diag_den = '[SII] 6731/6716',
                                            value_tem = Line_dict['4363A']/(Line_dict['5007A'] + Line_dict['4959A']),
                                            value_den = Line_dict['6731A']/Line_dict['6716A']) 
 
         
    Ar3         = Ar3_atom.getIonAbundance(int_ratio = Line_dict['7751.11A'] + Line_dict['7135A'], tem=TSIII, den=NSII, to_eval = 'L(7751) + L(7136)', Hbeta = Line_dict['4861.36A'])
    Ar4         = Ar4_atom.getIonAbundance(int_ratio = Line_dict['4740.12A'] + Line_dict['4711.26A'], tem=TOIII, den=NSII, to_eval = 'L(4740) + L(4711)', Hbeta = Line_dict['4861.36A'])                             
          
    S3          = S3_atom.getIonAbundance(int_ratio = (Line_dict['9068.62A'] + Line_dict['9532A']), tem=TSIII, den=NSII, to_eval = 'L(9069)+L(9531)', Hbeta = Line_dict['4861.36A'])
    S4          = S4_atom.getIonAbundance(int_ratio = (Line_dict['10.51m']), tem=TOIII, den=NSII, wave = 105000., Hbeta = Line_dict['4861.36A'])
    x_axis      = nplog10(Ar3) - nplog10(Ar4)
    y_axis      = nplog10(S3) - nplog10(S4)
     
    indexes     = x_axis>0.0
  
    x_values, y_values = x_axis[indexes][0], y_axis[indexes][0]
    
    if (isinf(x_values) == False) & (isinf(y_values) == False):
        
        if (x_values < 3) and (y_values < 3):
            return x_values, y_values
        else:
            return None, None    
    else:
        return None, None
コード例 #2
0
ファイル: Cloudy_plotter4.py プロジェクト: Delosari/Dazer
def Ar_S_abundances_model(Line_dict, diags, Ar3_atom, Ar4_atom, S3_atom, S4_atom, threshold = 3):
  
    #Calculate sulfur properties
    TSIII, NSII = diags.getCrossTemDen(diag_tem = '[SIII] 6312/9200+', diag_den = '[SII] 6731/6716',
                                            value_tem = Line_dict['6312A'] / (Line_dict['9068.62A'] + Line_dict['9532A']),
                                            value_den = Line_dict['6731A']/Line_dict['6716A']) 
    #Calculate Oxygen properties
    TOIII, NSII_2 = diags.getCrossTemDen(diag_tem = '[OIII] 4363/5007+', diag_den = '[SII] 6731/6716',
                                            value_tem = Line_dict['4363A']/(Line_dict['5007A'] + Line_dict['4959A']),
                                            value_den = Line_dict['6731A']/Line_dict['6716A']) 
  
    #Determine ionic abundances
    Ar3         = Ar3_atom.getIonAbundance(int_ratio = Line_dict['7751.11A'] + Line_dict['7135A'], tem=TSIII, den=NSII, to_eval = 'L(7751) + L(7136)', Hbeta = Line_dict['4861.36A'])
    Ar4         = Ar4_atom.getIonAbundance(int_ratio = Line_dict['4740.12A'] + Line_dict['4711.26A'], tem=TOIII, den=NSII_2, to_eval = 'L(4740) + L(4711)', Hbeta = Line_dict['4861.36A'])                             
           
    S3          = S3_atom.getIonAbundance(int_ratio = (Line_dict['9068.62A'] + Line_dict['9532A']), tem=TSIII, den=NSII, to_eval = 'L(9069)+L(9531)', Hbeta = Line_dict['4861.36A'])
    S4          = S4_atom.getIonAbundance(int_ratio = (Line_dict['10.51m']), tem=TOIII, den=NSII_2, wave = 105000., Hbeta = Line_dict['4861.36A'])
     
    #Calculate the logaritmic axis for the plot
    x_axis      = nplog10(S3) - nplog10(S4)
    y_axis      = nplog10(Ar3) - nplog10(Ar4)
     
    if (isinf(x_axis) == False) & (isinf(y_axis) == False):   
        if (x_axis < threshold) and (y_axis < threshold):
            return x_axis, y_axis
        else:
            return None, None    
    else:
        return None, None
コード例 #3
0
def import_popstar_data(Model_dict):

    FilesFolder = '/home/vital/Dropbox/Astrophysics/Seminars/Cloudy School 2017/teporingos/'

    if Model_dict['den'] == 1:
        TableAddressn = 'mnras0403-2012-SD1_clusterTable1_10cm3.txt'
    elif Model_dict['den'] == 2:
        TableAddressn = 'mnras0403-2012-SD2_clusterTable2_100cm3.txt'

    print 'Popstar table is', TableAddressn

    Frame_MetalsEmission = pd.read_csv(FilesFolder + TableAddressn,
                                       delim_whitespace=True)

    nH = Model_dict['den']**2  #cm^-3
    c = 29979245800.0  #cm/s
    pc_to_cm = 3.0856776e18  #cm/pc

    Frame_MetalsEmission['logR_cm'] = nplog10(Frame_MetalsEmission['logR'] *
                                              pc_to_cm)
    Frame_MetalsEmission['Q'] = nplog10(
        power(10, Frame_MetalsEmission['logU']) * 4 * pi * c * nH *
        power(Frame_MetalsEmission['logR'] * pc_to_cm, 2))

    return Frame_MetalsEmission
コード例 #4
0
ファイル: Cloudy_plotter2.py プロジェクト: Delosari/Dazer
def Ar_S_model(Line_dict, threshold = 0.0):
    
#     Hbeta           = Line_dict['4861.36A']
#     x_axis = Line_dict['10.51m'] / Hbeta
#     y_axis = Line_dict['4740.12A'] / Hbeta
#     return x_axis, y_axis

#     S2_S3_ratio     = (Line_dict['6716A'] + Line_dict['6731A']) / (Line_dict['9068.62A'] + Line_dict['9532A'])
#      
#     x_axis = nplog10(S2_S3_ratio)
#           
#     return x_axis, None

    S2_S3_ratio     = (Line_dict['9068.62A'] + Line_dict['9532A']) / Line_dict['10.51m']
    Ar2_Ar3_ratio   = (Line_dict['7135A']) / (Line_dict['4740.12A'])

#     S2_S3_ratio     = (Line_dict['6716A'] + Line_dict['6731A']) / (Line_dict['9068.62A'] + Line_dict['9532A'])
#     Ar2_Ar3_ratio   = (Line_dict['3727A']) / (Line_dict['4959A'] + Line_dict['5007A'] )
      
    x_axis = nplog10(S2_S3_ratio)
    y_axis = nplog10(Ar2_Ar3_ratio)
      
    if (x_axis < threshold):
      
        print 'values',x_axis, y_axis
           
        return x_axis, y_axis
      
    else:
          
        return None, None
コード例 #5
0
def Ar_S_model(Line_dict, threshold=0.0):

    #     Hbeta           = Line_dict['4861.36A']
    #     x_axis = Line_dict['10.51m'] / Hbeta
    #     y_axis = Line_dict['4740.12A'] / Hbeta
    #     return x_axis, y_axis

    #     S2_S3_ratio     = (Line_dict['6716A'] + Line_dict['6731A']) / (Line_dict['9068.62A'] + Line_dict['9532A'])
    #
    #     x_axis = nplog10(S2_S3_ratio)
    #
    #     return x_axis, None

    S2_S3_ratio = (Line_dict['9068.62A'] +
                   Line_dict['9532A']) / Line_dict['10.51m']
    Ar2_Ar3_ratio = (Line_dict['7135A']) / (Line_dict['4740.12A'])

    #     S2_S3_ratio     = (Line_dict['6716A'] + Line_dict['6731A']) / (Line_dict['9068.62A'] + Line_dict['9532A'])
    #     Ar2_Ar3_ratio   = (Line_dict['3727A']) / (Line_dict['4959A'] + Line_dict['5007A'] )

    x_axis = nplog10(S2_S3_ratio)
    y_axis = nplog10(Ar2_Ar3_ratio)

    if (x_axis < threshold):

        print 'values', x_axis, y_axis

        return x_axis, y_axis

    else:

        return None, None
コード例 #6
0
def Ar_S_abundances_model(Line_dict,
                          diags,
                          Ar3_atom,
                          Ar4_atom,
                          S3_atom,
                          S4_atom,
                          threshold=3):

    #Calculate sulfur properties
    TSIII, NSII = diags.getCrossTemDen(
        diag_tem='[SIII] 6312/9200+',
        diag_den='[SII] 6731/6716',
        value_tem=Line_dict['6312A'] /
        (Line_dict['9068.62A'] + Line_dict['9532A']),
        value_den=Line_dict['6731A'] / Line_dict['6716A'])
    #Calculate Oxygen properties
    TOIII, NSII_2 = diags.getCrossTemDen(
        diag_tem='[OIII] 4363/5007+',
        diag_den='[SII] 6731/6716',
        value_tem=Line_dict['4363A'] /
        (Line_dict['5007A'] + Line_dict['4959A']),
        value_den=Line_dict['6731A'] / Line_dict['6716A'])

    #Determine ionic abundances
    Ar3 = Ar3_atom.getIonAbundance(int_ratio=Line_dict['7751.11A'] +
                                   Line_dict['7135A'],
                                   tem=TSIII,
                                   den=NSII,
                                   to_eval='L(7751) + L(7136)',
                                   Hbeta=Line_dict['4861.36A'])
    Ar4 = Ar4_atom.getIonAbundance(int_ratio=Line_dict['4740.12A'] +
                                   Line_dict['4711.26A'],
                                   tem=TOIII,
                                   den=NSII_2,
                                   to_eval='L(4740) + L(4711)',
                                   Hbeta=Line_dict['4861.36A'])

    S3 = S3_atom.getIonAbundance(int_ratio=(Line_dict['9068.62A'] +
                                            Line_dict['9532A']),
                                 tem=TSIII,
                                 den=NSII,
                                 to_eval='L(9069)+L(9531)',
                                 Hbeta=Line_dict['4861.36A'])
    S4 = S4_atom.getIonAbundance(int_ratio=(Line_dict['10.51m']),
                                 tem=TOIII,
                                 den=NSII_2,
                                 wave=105000.,
                                 Hbeta=Line_dict['4861.36A'])

    #Calculate the logaritmic axis for the plot
    x_axis = nplog10(S3) - nplog10(S4)
    y_axis = nplog10(Ar3) - nplog10(Ar4)

    if (isinf(x_axis) == False) & (isinf(y_axis) == False):
        if (x_axis < threshold) and (y_axis < threshold):
            return x_axis, y_axis
        else:
            return None, None
    else:
        return None, None
コード例 #7
0
def Ar_S_model(Line_dict, threshold=0.0):

    R3 = (Line_dict['9068.62A'] + Line_dict['9532A']) / Line_dict['6312A']
    TSIII_4 = (0.5147 + 0.0003187 * R3 + (23.6404 / R3))
    TOIII_4 = ((TSIII_4 + 0.0846) / 1.0807)

    TSIII = TSIII_4 * 10000
    TOIII = TOIII_4 * 10000

    logS3HI = nplog10(
        Line_dict['10.51m'] / Line_dict['4861.36A']
    ) + 6.3956 + 0.0416 / TOIII_4 - 0.4216 * nplog10(TOIII_4) - 12
    logS2HI = nplog10(
        (Line_dict['9068.62A'] + Line_dict['9532A']) / Line_dict['4861.36A']
    ) + 6.012 + 0.6309 / TSIII_4 - 0.5722 * nplog10(TSIII_4) - 12

    logAr3HI = nplog10(
        Line_dict['4740.12A'] / Line_dict['4861.36A']
    ) + 5.705 + 1.246 / TOIII_4 - 0.156 * nplog10(TOIII_4) - 12
    logAr2HI = nplog10(
        Line_dict['7135A'] / Line_dict['4861.36A']
    ) + 6.157 + 0.808 / TSIII_4 - 0.508 * nplog10(TSIII_4) - 12

    x_axis = logS2HI - logS3HI
    y_axis = logAr2HI - logAr3HI

    indexes = x_axis > 0.0

    return x_axis[indexes], y_axis[indexes], TSIII[indexes], TOIII[indexes]
コード例 #8
0
def import_popstar_data():
     
    FilesFolder                 = '/home/vital/Dropbox/Astrophysics/Lore/PopStar/' 
    TableAddressn100            = 'mnras0403-2012-SD2_clusterTable2.txt'
     
    Frame_MetalsEmission        = pd.read_csv(FilesFolder + TableAddressn100, delim_whitespace = True)
     
    nH          = 10.0 #cm^-3
    c           = 29979245800.0 #cm/s
    pc_to_cm    = 3.0856776e18 #cm/pc
     
    Frame_MetalsEmission['logR_cm'] = nplog10(Frame_MetalsEmission['logR'] * pc_to_cm)
    Frame_MetalsEmission['Q']       = nplog10(power(10, Frame_MetalsEmission['logU']) * 4 * pi * c * nH * power(Frame_MetalsEmission['logR'] * pc_to_cm, 2))
 
    return Frame_MetalsEmission
コード例 #9
0
ファイル: Cloudy_Launcher3.py プロジェクト: Delosari/Dazer
def import_popstar_data():
    
    FilesFolder                 = '/home/vital/Dropbox/Astrophysics/Lore/PopStar/' 
    TableAddressn100            = 'mnras0403-2012-SD2_clusterTable2.txt'
    
    Frame_MetalsEmission        = pd.read_csv(FilesFolder + TableAddressn100, delim_whitespace = True)
    
    nH          = 10.0 #cm^-3
    c           = 29979245800.0 #cm/s
    pc_to_cm    = 3.0856776e18 #cm/pc
    
    Frame_MetalsEmission['logR_cm'] = nplog10(Frame_MetalsEmission['logR'] * pc_to_cm)
    Frame_MetalsEmission['Q']       = nplog10(power(10, Frame_MetalsEmission['logU']) * 4 * pi * c * nH * power(Frame_MetalsEmission['logR'] * pc_to_cm, 2))

    return Frame_MetalsEmission
コード例 #10
0
def Ar_S_model_pyneb(Line_dict, diags, Ar3_atom, Ar4_atom, S3_atom, S4_atom):

    TSIII, NSII = diags.getCrossTemDen(
        diag_tem="[SIII] 6312/9200+",
        diag_den="[SII] 6731/6716",
        value_tem=Line_dict["6312.06A"] / (Line_dict["9068.62A"] + Line_dict["9532A"]),
        value_den=Line_dict["S2_6731A"] / Line_dict["S2_6716A"],
    )

    TOIII, NSII_2 = diags.getCrossTemDen(
        diag_tem="[OIII] 4363/5007+",
        diag_den="[SII] 6731/6716",
        value_tem=Line_dict["O3_4363A"] / (Line_dict["O3_5007A"] + Line_dict["O3_4959A"]),
        value_den=Line_dict["S2_6731A"] / Line_dict["S2_6716A"],
    )

    Ar3 = Ar3_atom.getIonAbundance(
        int_ratio=Line_dict["Ar3_7751A"] + Line_dict["Ar3_7135A"],
        tem=TSIII,
        den=NSII,
        to_eval="L(7751) + L(7136)",
        Hbeta=Line_dict["H1_4861A"],
    )
    Ar4 = Ar4_atom.getIonAbundance(
        int_ratio=Line_dict["Ar4_4740A"] + Line_dict["Ar4_4711A"],
        tem=TOIII,
        den=NSII,
        to_eval="L(4740) + L(4711)",
        Hbeta=Line_dict["H1_4861A"],
    )

    S3 = S3_atom.getIonAbundance(
        int_ratio=(Line_dict["9068.62A"] + Line_dict["9532A"]),
        tem=TSIII,
        den=NSII,
        to_eval="L(9069)+L(9531)",
        Hbeta=Line_dict["H1_4861A"],
    )
    S4 = S3_atom.getIonAbundance(
        int_ratio=(Line_dict["10.51m"]), tem=TOIII, den=NSII, to_eval="L(10.51)", Hbeta=Line_dict["H1_4861A"]
    )

    x_axis = nplog10(Ar3) - nplog10(Ar4)
    y_axis = nplog10(S3) - nplog10(S4)

    indexes = x_axis > 0.0

    return x_axis[indexes], y_axis[indexes], TSIII[indexes], TOIII[indexes]
コード例 #11
0
def Ar_S_model_pyneb(Line_dict, diags, Ar3_atom, Ar4_atom, S3_atom, S4_atom):

    TSIII, NSII = diags.getCrossTemDen(
        diag_tem='[SIII] 6312/9200+',
        diag_den='[SII] 6731/6716',
        value_tem=Line_dict['6312.06A'] /
        (Line_dict['9068.62A'] + Line_dict['9532A']),
        value_den=Line_dict['S2_6731A'] / Line_dict['S2_6716A'])

    TOIII, NSII_2 = diags.getCrossTemDen(
        diag_tem='[OIII] 4363/5007+',
        diag_den='[SII] 6731/6716',
        value_tem=Line_dict['O3_4363A'] /
        (Line_dict['O3_5007A'] + Line_dict['O3_4959A']),
        value_den=Line_dict['S2_6731A'] / Line_dict['S2_6716A'])

    Ar3 = Ar3_atom.getIonAbundance(int_ratio=Line_dict['Ar3_7751A'] +
                                   Line_dict['Ar3_7135A'],
                                   tem=TSIII,
                                   den=NSII,
                                   to_eval='L(7751) + L(7136)',
                                   Hbeta=Line_dict['H1_4861A'])
    Ar4 = Ar4_atom.getIonAbundance(int_ratio=Line_dict['Ar4_4740A'] +
                                   Line_dict['Ar4_4711A'],
                                   tem=TOIII,
                                   den=NSII,
                                   to_eval='L(4740) + L(4711)',
                                   Hbeta=Line_dict['H1_4861A'])

    S3 = S3_atom.getIonAbundance(int_ratio=(Line_dict['9068.62A'] +
                                            Line_dict['9532A']),
                                 tem=TSIII,
                                 den=NSII,
                                 to_eval='L(9069)+L(9531)',
                                 Hbeta=Line_dict['H1_4861A'])
    S4 = S3_atom.getIonAbundance(int_ratio=(Line_dict['10.51m']),
                                 tem=TOIII,
                                 den=NSII,
                                 to_eval='L(10.51)',
                                 Hbeta=Line_dict['H1_4861A'])

    x_axis = nplog10(Ar3) - nplog10(Ar4)
    y_axis = nplog10(S3) - nplog10(S4)

    indexes = x_axis > 0.0

    return x_axis[indexes], y_axis[indexes], TSIII[indexes], TOIII[indexes]
コード例 #12
0
ファイル: spectrum.py プロジェクト: peace098beat/fisig2
    def ave_power(self, mode="lin"):
        """
        事前にスライスされた帯域のスペクトルパワーの平均を算出
        :param mode:
        :return: 平均パワー[db]
        """
        from numpy import mean as npmean
        from numpy import log10 as nplog10

        power = self.get_pow()

        if mode == "lin":
            average_power = npmean(power)
            return 10*nplog10(average_power)
        elif mode == "log":
            average_power = npmean(10 * nplog10(power))
            return average_power
コード例 #13
0
    def ave_power(self, mode="lin"):
        """
        事前にスライスされた帯域のスペクトルパワーの平均を算出
        :param mode:
        :return: 平均パワー[db]
        """
        from numpy import mean as npmean
        from numpy import log10 as nplog10

        power = self.get_pow()

        if mode == "lin":
            average_power = npmean(power)
            return 10 * nplog10(average_power)
        elif mode == "log":
            average_power = npmean(10 * nplog10(power))
            return average_power
コード例 #14
0
def Ar_S_model(Line_dict):
    
    R3          = (Line_dict['9068.62A'] + Line_dict['9532A']) / Line_dict['6312.06A']
    TSIII_4     = (0.5147 + 0.0003187 * R3 + (23.6404 / R3)) 
    TOIII_4     = ((TSIII_4 + 0.0846)/1.0807)

    TSIII       = TSIII_4 * 10000
    TOIII       = TOIII_4 * 10000
        
    logS3HI     = nplog10(Line_dict['10.51m']/Line_dict['4861.36A']) + 6.3956 + 0.0416/TOIII_4 - 0.4216 * nplog10(TOIII_4) - 12
    logS2HI     = nplog10((Line_dict['9068.62A'] + Line_dict['9532A']) / Line_dict['4861.36A']) + 6.012 + 0.6309 / TSIII_4 - 0.5722 * nplog10(TSIII_4)  -12 

    logAr3HI    = nplog10(Line_dict['4740.12A'] / Line_dict['4861.36A']) +  5.705 + 1.246/TOIII_4 - 0.156 * nplog10(TOIII_4) - 12 
    logAr2HI    = nplog10(Line_dict['7135A'] / Line_dict['4861.36A']) +  6.157 + 0.808/TSIII_4 - 0.508 * nplog10(TSIII_4) - 12 

    x_axis      = logS2HI - logS3HI
    y_axis      = logAr2HI - logAr3HI

    return x_axis, y_axis, TSIII, TOIII
コード例 #15
0
ファイル: Cloudy_plotter4.py プロジェクト: Delosari/Dazer
def Ar_S_lines_model(Line_dict, threshold = 0.0, z = None):
     
    #Argon - sufur lines
    S2_S3_ratio     = (Line_dict['9068.62A'] + Line_dict['9532A']) / Line_dict['10.51m']
    Ar2_Ar3_ratio   = (Line_dict['7135A']) / (Line_dict['4740.12A'])
    x_axis          = nplog10(S2_S3_ratio)
    y_axis          = nplog10(Ar2_Ar3_ratio)
 
#     #Argon - oxygen lines
#     S2_S3_ratio     = (Line_dict['6716A'] + Line_dict['6731A']) / (Line_dict['9068.62A'] + Line_dict['9532A'])
#     O2_O3_ratio     = (Line_dict['3727A']) / (Line_dict['4959A'] + Line_dict['5007A'])
#     x_axis          = nplog10(S2_S3_ratio)
#     y_axis          = nplog10(Ar2_Ar3_ratio)
 
    #Special threshold for the missing lines
    if (y_axis < threshold):
        return x_axis, y_axis
        
    else:
        return None, None
コード例 #16
0
def Ar_S_lines_model(Line_dict, threshold=0.0, z=None):

    #Argon - sufur lines
    S2_S3_ratio = (Line_dict['9068.62A'] +
                   Line_dict['9532A']) / Line_dict['10.51m']
    Ar2_Ar3_ratio = (Line_dict['7135A']) / (Line_dict['4740.12A'])
    x_axis = nplog10(S2_S3_ratio)
    y_axis = nplog10(Ar2_Ar3_ratio)

    #     #Argon - oxygen lines
    #     S2_S3_ratio     = (Line_dict['6716A'] + Line_dict['6731A']) / (Line_dict['9068.62A'] + Line_dict['9532A'])
    #     O2_O3_ratio     = (Line_dict['3727A']) / (Line_dict['4959A'] + Line_dict['5007A'])
    #     x_axis          = nplog10(S2_S3_ratio)
    #     y_axis          = nplog10(Ar2_Ar3_ratio)

    #Special threshold for the missing lines
    if (y_axis < threshold):
        return x_axis, y_axis

    else:
        return None, None
コード例 #17
0
def Ar_S_model_pyneb(Line_dict, diags, Ar3_atom, Ar4_atom, S3_atom, S4_atom):

    TSIII, NSII = diags.getCrossTemDen(diag_tem = '[SIII] 6312/9200+', diag_den = '[SII] 6731/6716',
                                            value_tem = Line_dict['6312.06A'] / (Line_dict['9068.62A'] + Line_dict['9532A']),
                                            value_den = Line_dict['S2_6731A']/Line_dict['S2_6716A']) 

    TOIII, NSII_2 = diags.getCrossTemDen(diag_tem = '[OIII] 4363/5007+', diag_den = '[SII] 6731/6716',
                                            value_tem = Line_dict['O3_4363A']/(Line_dict['O3_5007A'] + Line_dict['O3_4959A']),
                                            value_den = Line_dict['S2_6731A']/Line_dict['S2_6716A']) 

        
    Ar3         = Ar3_atom.getIonAbundance(int_ratio = Line_dict['Ar3_7751A'] + Line_dict['Ar3_7135A'], tem=TSIII, den=NSII, to_eval = 'L(7751) + L(7136)', Hbeta = Line_dict['H1_4861A'])
    Ar4         = Ar4_atom.getIonAbundance(int_ratio = Line_dict['Ar4_4740A'] + Line_dict['Ar4_4711A'], tem=TOIII, den=NSII, to_eval = 'L(4740) + L(4711)', Hbeta = Line_dict['H1_4861A'])                             
    
    S3          = S3_atom.getIonAbundance(int_ratio = (Line_dict['9068.62A'] + Line_dict['9532A']), tem=TSIII, den=NSII, to_eval = 'L(9069)+L(9531)', Hbeta = Line_dict['H1_4861A'])
    S4          = S3_atom.getIonAbundance(int_ratio = (Line_dict['10.51m']), tem=TOIII, den=NSII, to_eval = 'L(10.51)', Hbeta = Line_dict['H1_4861A'])
    
    x_axis      = nplog10(Ar3) - nplog10(Ar4)
    y_axis      = nplog10(S3) - nplog10(S4)
    
    indexes     = x_axis>0.0

    return x_axis[indexes], y_axis[indexes], TSIII[indexes], TOIII[indexes]
コード例 #18
0
def Ar_S_model(Line_dict, threshold=0.0):

    R3 = (Line_dict["9068.62A"] + Line_dict["9532A"]) / Line_dict["6312A"]
    TSIII_4 = 0.5147 + 0.0003187 * R3 + (23.6404 / R3)
    TOIII_4 = (TSIII_4 + 0.0846) / 1.0807

    TSIII = TSIII_4 * 10000
    TOIII = TOIII_4 * 10000

    logS3HI = (
        nplog10(Line_dict["10.51m"] / Line_dict["4861.36A"])
        + 6.3956
        + 0.0416 / TOIII_4
        - 0.4216 * nplog10(TOIII_4)
        - 12
    )
    logS2HI = (
        nplog10((Line_dict["9068.62A"] + Line_dict["9532A"]) / Line_dict["4861.36A"])
        + 6.012
        + 0.6309 / TSIII_4
        - 0.5722 * nplog10(TSIII_4)
        - 12
    )

    logAr3HI = (
        nplog10(Line_dict["4740.12A"] / Line_dict["4861.36A"]) + 5.705 + 1.246 / TOIII_4 - 0.156 * nplog10(TOIII_4) - 12
    )
    logAr2HI = (
        nplog10(Line_dict["7135A"] / Line_dict["4861.36A"]) + 6.157 + 0.808 / TSIII_4 - 0.508 * nplog10(TSIII_4) - 12
    )

    x_axis = logS2HI - logS3HI
    y_axis = logAr2HI - logAr3HI

    indexes = x_axis > 0.0

    return x_axis[indexes], y_axis[indexes], TSIII[indexes], TOIII[indexes]
コード例 #19
0
ファイル: Cloudy_Launcher2.py プロジェクト: Delosari/Dazer
 
#Generate the scripts with the lines we want to print the flux
ct.lines_to_extract(ScriptFolder)
 
#Fore the each grid point run a cloudy simulation
Model_dict = OrderedDict()
for age in Grid_Values['age']:
    for zStar in Grid_Values['zStars']:
        for zGas in Grid_Values['zGas']:                                        
            for ionization_parameter in Grid_Values['u']: 
                 
                Model_dict['Name']      = 'S_Ar_Test_' + 'age'+ age + '_zStar' + zStar + '_zGas' + zGas + '_u' + ionization_parameter
                Model_dict['age']       = age
                Model_dict['zStars']    = zStar
                Model_dict['zGas']      = zGas
                Model_dict['u']         = ionization_parameter

                Model_dict['abundances_command'] = 'abundances H=0.0 He=-1.0'
                for key in Solar_abundances:
                    Model_dict['abundances_command'] = '{previous_line} {new_element}={abundance}'.format(previous_line = Model_dict['abundances_command'], new_element=key, abundance=round(Solar_abundances[key] + nplog10(float(zGas)), 3))
                
                ScriptName = Model_dict['Name'] + '.in'
     
                #Generate the script
                ct.popstar_S_Ar_Grid(ScriptFolder, Model_dict)
#                 ct.popstar_S_Ar_Grid_absAbundances(ScriptFolder, Model_dict)
                   
                #Run the cloudy script
                ct.run_script(ScriptName, ScriptFolder)
   
print 'Data treated'
コード例 #20
0
    for zStar in Grid_Values['zStars']:
        for zGas in Grid_Values['zGas']:
            for ionization_parameter in Grid_Values['u']:

                Model_dict[
                    'Name'] = 'S_Ar_Test_' + 'age' + age + '_zStar' + zStar + '_zGas' + zGas + '_u' + ionization_parameter
                Model_dict['age'] = age
                Model_dict['zStars'] = zStar
                Model_dict['zGas'] = zGas
                Model_dict['u'] = ionization_parameter

                Model_dict['abundances_command'] = 'abundances H=0.0 He=-1.0'
                for key in Solar_abundances:
                    Model_dict[
                        'abundances_command'] = '{previous_line} {new_element}={abundance}'.format(
                            previous_line=Model_dict['abundances_command'],
                            new_element=key,
                            abundance=round(
                                Solar_abundances[key] + nplog10(float(zGas)),
                                3))

                ScriptName = Model_dict['Name'] + '.in'

                #Generate the script
                ct.popstar_S_Ar_Grid(ScriptFolder, Model_dict)
                #                 ct.popstar_S_Ar_Grid_absAbundances(ScriptFolder, Model_dict)

                #Run the cloudy script
                ct.run_script(ScriptName, ScriptFolder)

print 'Data treated'
コード例 #21
0
    va[i] = temp[0]
    # Insert value in Bellman Equation
    xBellman = xBellman.xreplace({sa[i, 0]: va[i]})

# The polynomial starts from the steady state
sctay = sctay.subs({skss: vkss})

# Insert coefficient values in the polynomial
for i in range(n + 1):
    sctay = sctay.xreplace({sa[i, 0]: va[i]})

## Make symbolic residual function:
# Copy Bellman equation into residual function
sResid = sBellman
# Replace all symbolic coefficients with their value
for i in range(n + 1):
    sResid = sResid.xreplace({sa[i, 0]: va[i]})
# Scale residual function by steady-state consumption times rho
sResid = sResid / (vrho * sctay.subs({sk: vkss}))

# Convert symbolic residual function to numeric residual function
fResid = lambdify(sk, sResid.subs({skss: vkss}), "numpy")

# Compute residuals
fResidData = fResid(linspace(.1, 2.5, 100))

# Plot residuals in logaritmic scale
fig1 = plt.figure()
ax1a = fig1.add_subplot(111)
ax1a.plot(nplog10(fResidData))
コード例 #22
0
def lightcurve_flux_measures(ftimes, fmags, ferrs, magsarefluxes=False):
    '''
    This calculates percentiles of the flux.

    '''

    ndet = len(fmags)

    if ndet > 9:

        # get the fluxes
        if magsarefluxes:
            series_fluxes = fmags
        else:
            series_fluxes = 10.0**(-0.4 * fmags)

        series_flux_median = npmedian(series_fluxes)

        # get the percent_amplitude for the fluxes
        series_flux_percent_amplitude = (npmax(npabs(series_fluxes)) /
                                         series_flux_median)

        # get the flux percentiles
        series_flux_percentiles = nppercentile(
            series_fluxes,
            [5.0, 10, 17.5, 25, 32.5, 40, 60, 67.5, 75, 82.5, 90, 95])
        series_frat_595 = (series_flux_percentiles[-1] -
                           series_flux_percentiles[0])
        series_frat_1090 = (series_flux_percentiles[-2] -
                            series_flux_percentiles[1])
        series_frat_175825 = (series_flux_percentiles[-3] -
                              series_flux_percentiles[2])
        series_frat_2575 = (series_flux_percentiles[-4] -
                            series_flux_percentiles[3])
        series_frat_325675 = (series_flux_percentiles[-5] -
                              series_flux_percentiles[4])
        series_frat_4060 = (series_flux_percentiles[-6] -
                            series_flux_percentiles[5])

        # calculate the flux percentile ratios
        series_flux_percentile_ratio_mid20 = series_frat_4060 / series_frat_595
        series_flux_percentile_ratio_mid35 = series_frat_325675 / series_frat_595
        series_flux_percentile_ratio_mid50 = series_frat_2575 / series_frat_595
        series_flux_percentile_ratio_mid65 = series_frat_175825 / series_frat_595
        series_flux_percentile_ratio_mid80 = series_frat_1090 / series_frat_595

        # calculate the ratio of F595/median flux
        series_percent_difference_flux_percentile = (series_frat_595 /
                                                     series_flux_median)
        series_percentile_magdiff = -2.5 * nplog10(
            series_percent_difference_flux_percentile)

        return {
            'flux_median': series_flux_median,
            'flux_percent_amplitude': series_flux_percent_amplitude,
            'flux_percentiles': series_flux_percentiles,
            'flux_percentile_ratio_mid20': series_flux_percentile_ratio_mid20,
            'flux_percentile_ratio_mid35': series_flux_percentile_ratio_mid35,
            'flux_percentile_ratio_mid50': series_flux_percentile_ratio_mid50,
            'flux_percentile_ratio_mid65': series_flux_percentile_ratio_mid65,
            'flux_percentile_ratio_mid80': series_flux_percentile_ratio_mid80,
            'percent_difference_flux_percentile': series_percentile_magdiff,
        }

    else:

        LOGERROR('not enough detections in this magseries '
                 'to calculate flux measures')
        return None
コード例 #23
0
    va[i] = temp[0]
    # Insert value in Bellman Equation
    xBellman = xBellman.xreplace({sa[i,0]: va[i]})

# The polynomial starts from the steady state
sctay = sctay.subs({skss: vkss})

# Insert coefficient values in the polynomial
for i in range(n+1):
    sctay = sctay.xreplace({sa[i,0]: va[i]})

## Make symbolic residual function:
# Copy Bellman equation into residual function
sResid = sBellman
# Replace all symbolic coefficients with their value
for i in range(n+1):
    sResid = sResid.xreplace({sa[i,0]: va[i]})
# Scale residual function by steady-state consumption times rho
sResid = sResid/(vrho*sctay.subs({sk: vkss}))

# Convert symbolic residual function to numeric residual function
fResid = lambdify(sk,sResid.subs({skss: vkss}),"numpy")

# Compute residuals
fResidData = fResid(linspace(.1,2.5,100))

# Plot residuals in logaritmic scale
fig1 = plt.figure()
ax1a = fig1.add_subplot(111)
ax1a.plot(nplog10(fResidData))
コード例 #24
0
    for j in range(n+1):
        sResid = sResid.xreplace({sa[i,j]: va[i,j]})
        
# Scale residual function by steady-state consumption times rho
sResid = sResid/(vrho*su1.subs({sk: vkss, skss: vkss, ssigma: 0, sgamma: vgamma}).xreplace({sa[0,0]: va[0,0]}))

# Convert symbolic residual function to numeric residual function
fResid = lambdify([sk,ssigma],sResid.subs({skss: vkss, srho: vrho,\
    sgamma: vgamma}),"numpy")

# Compute residuals
kPoints = 100
sPoints = 100
kRange = linspace(.8,1.2,kPoints)
sRange = linspace(0,.001,sPoints)
fResidX = npzeros([kPoints,sPoints])
fResidY = npzeros([kPoints,sPoints])
fResidZ = npzeros([kPoints,sPoints])
for i in range(kPoints):
    fResidX[i,:] = kRange[i]
    fResidY[i,:] = sRange
    fResidZ[i,:] = nplog10(abs(fResid(kRange[i],sRange)))

# Plot residuals in logaritmic scale
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(fResidX, fResidY, fResidZ, rstride=10, cstride=10)

plt.show()

コード例 #25
0
ファイル: varfeatures.py プロジェクト: JinbiaoJi/astrobase
def lightcurve_flux_measures(ftimes, fmags, ferrs, magsarefluxes=False):
    '''This calculates percentiles and percentile ratios of the flux.

    Parameters
    ----------

    ftimes,fmags,ferrs : np.array
        The input mag/flux time-series with all non-finite elements removed.

    magsarefluxes : bool
        If the `fmags` array actually contains fluxes, will not convert `mags`
        to fluxes before calculating the percentiles.

    Returns
    -------

    dict
        A dict with all of the light curve flux percentiles and percentile
        ratios calculated.

    '''

    ndet = len(fmags)

    if ndet > 9:

        # get the fluxes
        if magsarefluxes:
            series_fluxes = fmags
        else:
            series_fluxes = 10.0**(-0.4 * fmags)

        series_flux_median = npmedian(series_fluxes)

        # get the percent_amplitude for the fluxes
        series_flux_percent_amplitude = (npmax(npabs(series_fluxes)) /
                                         series_flux_median)

        # get the flux percentiles
        series_flux_percentiles = nppercentile(
            series_fluxes,
            [5.0, 10, 17.5, 25, 32.5, 40, 60, 67.5, 75, 82.5, 90, 95])
        series_frat_595 = (series_flux_percentiles[-1] -
                           series_flux_percentiles[0])
        series_frat_1090 = (series_flux_percentiles[-2] -
                            series_flux_percentiles[1])
        series_frat_175825 = (series_flux_percentiles[-3] -
                              series_flux_percentiles[2])
        series_frat_2575 = (series_flux_percentiles[-4] -
                            series_flux_percentiles[3])
        series_frat_325675 = (series_flux_percentiles[-5] -
                              series_flux_percentiles[4])
        series_frat_4060 = (series_flux_percentiles[-6] -
                            series_flux_percentiles[5])

        # calculate the flux percentile ratios
        series_flux_percentile_ratio_mid20 = series_frat_4060 / series_frat_595
        series_flux_percentile_ratio_mid35 = series_frat_325675 / series_frat_595
        series_flux_percentile_ratio_mid50 = series_frat_2575 / series_frat_595
        series_flux_percentile_ratio_mid65 = series_frat_175825 / series_frat_595
        series_flux_percentile_ratio_mid80 = series_frat_1090 / series_frat_595

        # calculate the ratio of F595/median flux
        series_percent_difference_flux_percentile = (series_frat_595 /
                                                     series_flux_median)
        series_percentile_magdiff = -2.5 * nplog10(
            series_percent_difference_flux_percentile)

        return {
            'flux_median': series_flux_median,
            'flux_percent_amplitude': series_flux_percent_amplitude,
            'flux_percentiles': series_flux_percentiles,
            'flux_percentile_ratio_mid20': series_flux_percentile_ratio_mid20,
            'flux_percentile_ratio_mid35': series_flux_percentile_ratio_mid35,
            'flux_percentile_ratio_mid50': series_flux_percentile_ratio_mid50,
            'flux_percentile_ratio_mid65': series_flux_percentile_ratio_mid65,
            'flux_percentile_ratio_mid80': series_flux_percentile_ratio_mid80,
            'percent_difference_flux_percentile': series_percentile_magdiff,
        }

    else:

        LOGERROR('not enough detections in this magseries '
                 'to calculate flux measures')
        return None
コード例 #26
0
 def transform_non_affine(self, a):
     masked = ma.masked_where(a > 1 - 10**(-1 - self.nines), a)
     if masked.mask.any():
         return -ma.log10(1 - a)
     else:
         return -nplog10(1 - a)