2222all_line_name = ['OII_3726' , 'OII_3729' ] + line_name [1 :]
2323wavelength_dict = dict (zip (all_line_name , all_lambda0 ))
2424
25- fitspath_reagen = '/Users/reagenleimbach/Desktop/Zcalbase_gal/'
26-
27- fitspath_caroline = 'C:/Users/carol/Google Drive/'
28-
29- fitspath_chun = '/Users/cly/GoogleDrive/Research/'
25+ fitspath_dict = {
26+ 'reagenleimbach' : '/Users/reagenleimbach/GoogleDrive/Research/' ,
27+ 'carol' : 'C:/Users/carol/Google Drive/' ,
28+ 'cly' : '/Users/cly/GoogleDrive/Research/' ,
29+ 'travis' : '/home/travis/' ,
30+ 'runner' : '/home/runner/'
31+ }
3032
3133scalefact = 1e-17
3234
@@ -59,35 +61,31 @@ def exclude_outliers(objno):
5961 return flag
6062
6163
62- def dir_date (org_name , path_init = '' , year = False ):
64+ def dir_date (folder_name , path_init = '' , year = False ):
6365 """
6466 Purpose:
65- This function finds and returns the path to a directory named after the
66- current date (MMDDYYYY). If the directory doesn't exist yet, it creates
67- a new directory named after the current date in the provided org_name
68- directory.
67+ This function finds and returns the path to a directory named after the
68+ current date (MMDDYYYY). If the directory doesn't exist yet, it creates
69+ a new directory named after the current date in the provided folder_name
70+ directory.
6971
7072 From https://github.com/rafia37/Evolution-of-Galaxies/blob/master/general.py
71- Usage:
72- fitspath = dir_date(org_name, path_init='', year=True)
73-
74- Params:
75- org_name --> a string of the directory that the date subdirectory will be in.
7673
77- Returns:
78- fitspath --> the path to the date directory.
74+ :param folder_name: str containing directory for date subdirectory will be in
75+ :param path_init: root path. Default: empty string
76+ :param year: Indicate whether to include year in date folder. Default: False
7977
80- Outputs:
81- "Path already exists" --> prints this message if the current date directory already exists.
82- fitspath --> prints the path to the directory.
78+ :return: fitspath: Full path to the date directory
8379
80+ Usage:
81+ fitspath = dir_date(folder_name, path_init='', year=True)
8482 """
8583
8684 today = date .today ()
8785
88- list_path = [path_init , org_name , "%02i%02i" % (today .month , today .day ), '' ]
86+ list_path = [path_init , folder_name , "%02i%02i" % (today .month , today .day ), '' ]
8987 if year :
90- list_path [- 2 ] + = "%02i " % today .year
88+ list_path [- 2 ] = "%i " % today .year + list_path [ - 2 ]
9189
9290 fitspath = os .path .join (* list_path )
9391 try :
@@ -103,13 +101,9 @@ def get_user(username=None):
103101 if isinstance (username , type (None )):
104102 username = getpass .getuser ()
105103
106- if username == 'reagenleimbach' :
107- fitspath = fitspath_reagen
108-
109- if username == 'carol' :
110- fitspath = fitspath_caroline
111-
112- if username == 'cly' :
113- fitspath = fitspath_chun
104+ if username in fitspath_dict .keys ():
105+ fitspath = fitspath_dict [username ]
106+ else :
107+ raise ValueError ("Incorrect username input" )
114108
115109 return fitspath
0 commit comments