source: branches/GUIdev/Original Trial Files (9 December 2013)/notes.py @ 1441

Last change on this file since 1441 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.
13params = {};
14
15# Open the given parameter file.
16paramfile = 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.
20for line in paramfile:
21    if line[0] != '#' and len(line) > 1:
22        linebits = line.split()
23 
24    params[linebits[0]] = linebits[1]
25 
26print(params);
27
28params['threshold'] = 0.05;
29 
30newfile = open('/u/hsu004/Kelvin/duchampHIPASSedited.in', 'w')
31 
32for par in params:
33    print(par, params[par]);
34 
35for par in params:
36    newfile.write('%s    %s\n'%(par, params[par]));
37 
38newfile.close();
Note: See TracBrowser for help on using the repository browser.