Ejemplo n.º 1
0
    def __init__(self, spec_window, gauss, v_macro, line_file, line, SN,
                 **kwargs):

        # Default optional parameters:

        # Writes star's name at the plot
        if ('star_name' in kwargs):
            self.name = kwargs['star_name']
        else:
            self.name = 'Unnamed star'

        # x_vel is the velocity shift to be applied to the x-axis
        if ('x_vel' in kwargs):
            self.vshift = kwargs['x_vel']
        else:
            self.vshift = 0.0

        # x_wl is the wavelengths shift to be applied to the x-axis
        if ('x_wl' in kwargs):
            self.xshift = kwargs['x_wl']
        else:
            self.xshift = 0.0

        # y_add is the additive shift to be applied to the spectrum
        if ('y_add' in kwargs):
            self.yadd = kwargs['y_add']
        else:
            self.yadd = 0.0

        # y_mult is the multiplicative shift to be applied to the spectrum
        if ('y_mult' in kwargs):
            self.ymult = kwargs['y_mult']
        else:
            self.ymult = 0.0

        # perf_radius is the number of points around the line center where
        # to evaluate the performance of the synthetic spectrum
        if ('perf_radius' in kwargs):
            self.radius = kwargs['perf_radius']
        else:
            self.radius = 5

        # bwing_w is the weight to be applied to the blue side of the line
        # when evaluating the performance
        if ('bwing_w' in kwargs):
            self.bwing_w = kwargs['bwing_w']
        else:
            self.bwing_w = 5.0

        # bwing_w is the weight to be applied to the red side of the line
        # when evaluating the performance
        if ('rwing_w' in kwargs):
            self.rwing_w = kwargs['rwing_w']
        else:
            self.rwing_w = 1.0

        # center_w is the weight to be applied to the line center when
        # evaluating the performance
        if ('center_w' in kwargs):
            self.center_w = kwargs['center_w']
        else:
            self.center_w = 10.0

        # Maximum number of points around the performance radius that are
        # allowed to be a bad fit (1 S/N sigma lower than observed signal)
        # If this limit is exceeded, the variable badfit_status will return
        # True after running find()
        # For high precision spectrum, set this to a very low number
        if ('badfit_tol' in kwargs):
            self.badfit_tol = kwargs['badfit_tol']
        else:
            self.badfit_tol = 10

        self.c = 2.998E18
        self.am = utils.arr_manage()
        self.spec = spec_window
        self.gauss = gauss
        self.v_m = v_macro
        self.lines = np.loadtxt(line_file, skiprows=1, usecols=(0, 1))
        self.Z = self.lines[line, 1]
        self.line_center = self.lines[line, 0]
        self.spec_sigma = 1. / SN
Ejemplo n.º 2
0
* s_twins.csv: contains the information of the stars
* filenames.lis: contains the list of names of the spectrum .fits files
* lines.dat: contains information about the lines to be analyzed
* continuum.dat: contains the wavelengths to be used to calibrate the continuum
"""

# Getting star names
star_names = np.loadtxt('s_twins.csv',
                        skiprows=1,
                        usecols=(0,),
                        dtype=str,
                        delimiter=',')
N = len(star_names)

# This is used to manage data arrays
u = utils.arr_manage()

# The following function is used to set the input files to be used by MOOG
# for a specific star from the list star_names.

def set_star(choice, **kwargs):

    if ('inverted_filelist' in kwargs):
        invert = kwargs['inverted_filelist']
    else:
        invert = False

    choice = int(choice)

    print 'Creating the stellar atmosphere file.'
Ejemplo n.º 3
0
    def __init__(self, spec_window, gauss, v_macro, line_file, line, SN,
                 **kwargs):

        # Default optional parameters:

        # Writes star's name at the plot
        if ('star_name' in kwargs):
            self.name = kwargs['star_name']
        else:
            self.name = 'Unnamed star'

        # x_vel is the velocity shift to be applied to the x-axis
        if ('x_vel' in kwargs):
            self.vshift = kwargs['x_vel']
        else:
            self.vshift = 0.0

        # x_wl is the wavelengths shift to be applied to the x-axis
        if ('x_wl' in kwargs):
            self.xshift = kwargs['x_wl']
        else:
            self.xshift = 0.0

        # y_add is the additive shift to be applied to the spectrum
        if ('y_add' in kwargs):
            self.yadd = kwargs['y_add']
        else:
            self.yadd = 0.0

        # y_mult is the multiplicative shift to be applied to the spectrum
        if ('y_mult' in kwargs):
            self.ymult = kwargs['y_mult']
        else:
            self.ymult = 0.0

        # perf_radius is the number of points around the line center where
        # to evaluate the performance of the synthetic spectrum
        if ('perf_radius' in kwargs):
            self.radius = kwargs['perf_radius']
        else:
            self.radius = 5

        # bwing_w is the weight to be applied to the blue side of the line
        # when evaluating the performance
        if ('bwing_w' in kwargs):
            self.bwing_w = kwargs['bwing_w']
        else:
            self.bwing_w = 5.0

        # bwing_w is the weight to be applied to the red side of the line
        # when evaluating the performance
        if ('rwing_w' in kwargs):
            self.rwing_w = kwargs['rwing_w']
        else:
            self.rwing_w = 1.0

        # center_w is the weight to be applied to the line center when
        # evaluating the performance
        if ('center_w' in kwargs):
            self.center_w = kwargs['center_w']
        else:
            self.center_w = 10.0

        # Maximum number of points around the performance radius that are
        # allowed to be a bad fit (1 S/N sigma lower than observed signal)
        # If this limit is exceeded, the variable badfit_status will return
        # True after running find()
        # For high precision spectrum, set this to a very low number
        if ('badfit_tol' in kwargs):
            self.badfit_tol = kwargs['badfit_tol']
        else:
            self.badfit_tol = 10

        self.c = 2.998E18
        self.am = utils.arr_manage()
        self.spec = spec_window
        self.gauss = gauss
        self.v_m = v_macro
        self.lines = np.loadtxt(line_file, skiprows=1, usecols=(0,1))
        self.Z = self.lines[line,1]
        self.line_center = self.lines[line,0]
        self.spec_sigma = 1./SN