1
2
3 import os
4
5
6
8
9 '''
10 Read the relevant paths from the usr/Path.dat file.
11
12 Default values typically return an expected location for model related
13 folders, and an empty string for data locations (in which case no data are
14 used).
15
16 @return: The pathnames with associated path are returned.
17 @rtype: dict
18
19 '''
20
21 dd = dict([('gdata','GASTRoNOoM/src/data'),('gastronoom','GASTRoNOoM'),\
22 ('chemistry','Chemistry'),('csource',''),\
23 ('mcmax','MCMax'),('mobs','MCMax/Observation_Files'),\
24 ('mopac','MCMax/Opacities'),('data',''),('dradio',''),\
25 ('dpacs',''),('dspire',''),('dsed',''),('dphot',''),\
26 ('dcflux',''),('ll','LineLists'),('ivsdata',''),('atm',''),\
27 ('starf',''),('densf','')])
28 filename = os.path.join(usr,'Path.dat')
29 FILE = open(filename,'r')
30 lines = FILE.readlines()
31 FILE.close()
32 lines = [line.strip('\n').strip() for line in lines if line.strip('\n')]
33 dd.update(dict([line.split('=') for line in lines if line[0] != '#']))
34 for k,v in dd.items():
35 if not v:
36 dd[k] = ''
37 elif not v[0] == '/':
38 dd[k] = os.path.join(os.path.expanduser('~'),v)
39 return dd
40
41
42
43
44
45 home = os.path.dirname(__file__).replace('cc/path','')
46 if not home: home = os.getcwd()
47 usr = os.path.join(home,'usr')
48 aux = os.path.join(home,'aux')
49
50
51
52
53 globals().update(__readPaths())
54
55
56
57
58
59