Last change
on this file since 1455 was
1306,
checked in by KelvinHsu, 11 years ago
|
Initial commit of early python tests
|
File size:
951 bytes
|
Line | |
---|
1 | #------------------------------------------------------------------------------- |
---|
2 | # Name: Notes |
---|
3 | # Purpose: |
---|
4 | # |
---|
5 | # Author: Kelvin |
---|
6 | # |
---|
7 | # Created: 27/11/2013 |
---|
8 | # Copyright: (c) Kelvin 2013 |
---|
9 | # Licence: <your licence> |
---|
10 | #------------------------------------------------------------------------------- |
---|
11 | |
---|
12 | # Initialise the empty Dictionary. |
---|
13 | params = {}; |
---|
14 | |
---|
15 | # Open the given parameter file. |
---|
16 | paramfile = open('/u/hsu004/IntroToDuchamp/duchampHIPASS.in') |
---|
17 | |
---|
18 | # Load files for lines of parameter data in the specified format and |
---|
19 | # store them into the dictionary. |
---|
20 | for line in paramfile: |
---|
21 | if line[0] != '#' and len(line) > 1: |
---|
22 | linebits = line.split() |
---|
23 | |
---|
24 | params[linebits[0]] = linebits[1] |
---|
25 | |
---|
26 | print(params); |
---|
27 | |
---|
28 | params['threshold'] = 0.05; |
---|
29 | |
---|
30 | newfile = open('/u/hsu004/Kelvin/duchampHIPASSedited.in', 'w') |
---|
31 | |
---|
32 | for par in params: |
---|
33 | print(par, params[par]); |
---|
34 | |
---|
35 | for par in params: |
---|
36 | newfile.write('%s %s\n'%(par, params[par])); |
---|
37 | |
---|
38 | newfile.close(); |
---|
Note: See
TracBrowser
for help on using the repository browser.