generic.py

changeset 33
2984158468e6
parent 32
022f6f2bc09c
equal deleted inserted replaced
32:022f6f2bc09c 33:2984158468e6
24 You can override the get_PT method to define a custom procedure to get ground temperature and pressure. 24 You can override the get_PT method to define a custom procedure to get ground temperature and pressure.
25 The one implemented by default is by using the MILOS meteorological station data. 25 The one implemented by default is by using the MILOS meteorological station data.
26 26
27 """ 27 """
28 28
29 def __init__(self, filelist= None): 29 def __init__(self, filelist = None):
30 self.info = {} 30 self.info = {}
31 self.dimensions = {} 31 self.dimensions = {}
32 self.variables = {} 32 self.variables = {}
33 self.channels = {} 33 self.channels = {}
34 self.attributes = {} 34 self.attributes = {}
35 self.files = [] 35 self.files = []
36 self.dark_measurement = None 36 self.dark_measurement = None
37
37 if filelist: 38 if filelist:
38 self.import_files(filelist) 39 self.import_files(filelist)
39 40
40 def import_files(self,filelist): 41 def import_files(self, filelist):
41 for f in filelist: 42 for f in filelist:
42 self.import_file(f) 43 self.import_file(f)
43 self.update() 44 self.update()
44 45
45 def import_file(self,filename): 46 def import_file(self,filename):
112 if current_time_scale == ts: 113 if current_time_scale == ts:
113 channel_timescales.append([channel_name,n]) 114 channel_timescales.append([channel_name,n])
114 self.variables['id_timescale'] = dict(channel_timescales) 115 self.variables['id_timescale'] = dict(channel_timescales)
115 116
116 def _get_duration(self, raw_start_in_seconds): 117 def _get_duration(self, raw_start_in_seconds):
117 ''' Return the duration for a given time scale. In some files (ex. Licel) this 118 ''' Return the duration for a given time scale. In some files (e.g. Licel) this
118 can be specified from the files themselves. In others this must be guessed. 119 can be specified from the files themselves. In others this must be guessed.
119 120
120 ''' 121 '''
121 # The old method, kept here for reference 122 # The old method, kept here for reference
122 #dt = np.mean(np.diff(raw_start_in_seconds)) 123 #dt = np.mean(np.diff(raw_start_in_seconds))
412 self.wavelength = channel_parameters['name'] 413 self.wavelength = channel_parameters['name']
413 self.name = str(self.wavelength) 414 self.name = str(self.wavelength)
414 self.binwidth = float(channel_parameters['binwidth']) # in microseconds 415 self.binwidth = float(channel_parameters['binwidth']) # in microseconds
415 self.data = {} 416 self.data = {}
416 self.resolution = self.binwidth * c / 2 417 self.resolution = self.binwidth * c / 2
417 self.z = np.arange(len(channel_parameters['data'])) * self.resolution + self.resolution/2.0 # Change: add half bin in the z 418 self.z = np.arange(len(channel_parameters['data'])) * self.resolution + self.resolution / 2.0 # Change: add half bin in the z
418 self.points = len(channel_parameters['data']) 419 self.points = len(channel_parameters['data'])
419 self.rc = [] 420 self.rc = []
420 self.duration = 60 421 self.duration = 60
421 422
422 def calculate_rc(self, idx_min = 4000, idx_max = 5000): 423 def calculate_rc(self, idx_min = 4000, idx_max = 5000):

mercurial