Skip to content

Commit

Permalink
Update init to master version via git checkout (iss #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochun committed Mar 9, 2020
1 parent 963cedf commit 52e9f71
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Metallicity_Stack_Commons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
from datetime import date
import os
import getpass
import numpy as np

version = "0.1.0"

lambda0 = [3726.18, 4101.73, 4340.46, 4363.21, 4861.32, 4958.91, 5006.84]
line_type = ['Oxy2', 'Balmer', 'Balmer', 'Single', 'Balmer', 'Single', 'Single']
line_name = ['OII_3727', 'HDELTA', 'HGAMMA', 'OIII_4363', 'HBETA', 'OIII_4958', 'OIII_5007']

fitting_lines_dict = {"lambda0":lambda0, "line_type":line_type, "line_name":line_name}
fitting_lines_dict = {"lambda0": lambda0, "line_type": line_type, "line_name": line_name}

all_lambda0 = [lambda0[0]] + [3728.91] + lambda0[1:]
all_line_name = ['OII_3726', 'OII_3729'] + line_name[1:]
Expand All @@ -22,13 +23,16 @@

scalefact = 1e-17

# Flux ratio of [OIII]5007 to [OIII]4959
OIII_r = 3.1

# Define k values for dust attenuation
k_values = cardelli(lambda0 * u.Angstrom)
k_dict = dict(zip(line_name,k_values))
k_dict = dict(zip(line_name, k_values))


def exclude_outliers(objno):
'''
"""
Exclude spectra that are identified as outliers.
Generally this is because the spectra have very high S/N on the continuum.
Expand All @@ -37,19 +41,19 @@ def exclude_outliers(objno):
:return:
flag: numpy array of zeros and ones
'''
"""

flag = np.zeros(len(objno), dtype=int)
bad_data = np.array(['32007727', '32101412', '42006031', '32035286', '14023705'])
for ii in range(len(bad_data)):
idx = [xx for xx in range(len(objno)) if bad_data[ii] == str(objno[xx])][0]
idx = [xx for xx in range(len(objno)) if bad_data[ii] in str(objno[xx])]
flag[idx] = 1

return flag


def dir_date(org_name, path_init='', year=False):
'''
"""
Purpose:
This function finds and returns the path to a directory named after the
current date (MMDDYYYY). If the directory doesn't exist yet, it creates
Expand All @@ -70,13 +74,13 @@ def dir_date(org_name, path_init='', year=False):
"Path already exists" --> prints this message if the current date directory already exists.
fitspath --> prints the path to the directory.
'''
"""

today = date.today()

list_path = [path_init, org_name, "%02i%02i" % (today.month, today.day), '']
if year:
list_path[-2] += "i%02i%02i" % today.year
list_path[-2] += "%02i" % today.year

fitspath = os.path.join(*list_path)
try:
Expand All @@ -86,6 +90,7 @@ def dir_date(org_name, path_init='', year=False):

return fitspath


def get_user():
username = getpass.getuser()
if username == 'reagenleimbach':
Expand Down

0 comments on commit 52e9f71

Please sign in to comment.