@@ -4049,6 +4049,8 class PedestalInformation(Operation): | |||
|
4049 | 4049 | def __init__(self): |
|
4050 | 4050 | Operation.__init__(self) |
|
4051 | 4051 | self.filename = False |
|
4052 | self.delay = 20 | |
|
4053 | self.nTries = 3 | |
|
4052 | 4054 | |
|
4053 | 4055 | def find_file(self, timestamp): |
|
4054 | 4056 | |
@@ -4059,7 +4061,6 class PedestalInformation(Operation): | |||
|
4059 | 4061 | return False, False |
|
4060 | 4062 | fileList = glob.glob(os.path.join(path, '*.h5')) |
|
4061 | 4063 | fileList.sort() |
|
4062 | print(fileList) | |
|
4063 | 4064 | return fileList |
|
4064 | 4065 | |
|
4065 | 4066 | def find_next_file(self): |
@@ -4079,17 +4080,27 class PedestalInformation(Operation): | |||
|
4079 | 4080 | dt = datetime.datetime.utcfromtimestamp(self.utctime) |
|
4080 | 4081 | path = os.path.join(self.path, dt.strftime('%Y-%m-%dT%H-00-00')) |
|
4081 | 4082 | self.filename = os.path.join(path, 'pos@{}.000.h5'.format(int(self.utcfile))) |
|
4082 | print('ACQ time: ', self.utctime, 'POS time: ', self.utcfile) | |
|
4083 | print('Next file: ', self.filename) | |
|
4084 | if not os.path.exists(self.filename): | |
|
4085 | log.warning('Waiting for position files...', self.name) | |
|
4086 | ||
|
4087 | if not os.path.exists(self.filename): | |
|
4088 | ||
|
4083 | ||
|
4084 | for n in range(self.nTries): | |
|
4085 | ok = False | |
|
4086 | try: | |
|
4087 | if not os.path.exists(self.filename): | |
|
4088 | log.warning('Waiting {}s for position files...'.format(self.delay), self.name) | |
|
4089 | time.sleep(self.delay) | |
|
4090 | continue | |
|
4091 | self.fp.close() | |
|
4092 | self.fp = h5py.File(self.filename, 'r') | |
|
4093 | log.log('Opening file: {}'.format(self.filename), self.name) | |
|
4094 | ok = True | |
|
4095 | break | |
|
4096 | except: | |
|
4097 | log.error('No new position files found in {}'.format(path)) | |
|
4089 | 4098 | raise IOError('No new position files found in {}'.format(path)) |
|
4090 |
|
|
|
4091 | self.fp = h5py.File(self.filename, 'r') | |
|
4092 | log.log('Opening file: {}'.format(self.filename), self.name) | |
|
4099 | ||
|
4100 | if not ok: | |
|
4101 | log.error('No new position files found in {}'.format(path)) | |
|
4102 | raise IOError('No new position files found in {}'.format(path)) | |
|
4103 | ||
|
4093 | 4104 | |
|
4094 | 4105 | def get_values(self): |
|
4095 | 4106 | |
@@ -4099,7 +4110,7 class PedestalInformation(Operation): | |||
|
4099 | 4110 | index = int((self.utctime-self.utcfile)/self.interval) |
|
4100 | 4111 | return self.fp['Data']['azi_pos'][index], self.fp['Data']['ele_pos'][index] |
|
4101 | 4112 | |
|
4102 |
def setup(self, dataOut, path, conf, samples, interval, |
|
|
4113 | def setup(self, dataOut, path, conf, samples, interval, az_offset): | |
|
4103 | 4114 | |
|
4104 | 4115 | self.path = path |
|
4105 | 4116 | self.conf = conf |
@@ -4116,13 +4127,13 class PedestalInformation(Operation): | |||
|
4116 | 4127 | log.log('Opening file: {}'.format(self.filename), self.name) |
|
4117 | 4128 | self.fp = h5py.File(self.filename, 'r') |
|
4118 | 4129 | |
|
4119 |
def run(self, dataOut, path, conf=None, samples=1500, interval=0.04, |
|
|
4130 | def run(self, dataOut, path, conf=None, samples=1500, interval=0.04, az_offset=0, time_offset=0): | |
|
4120 | 4131 | |
|
4121 | 4132 | if not self.isConfig: |
|
4122 |
self.setup(dataOut, path, conf, samples, interval, |
|
|
4133 | self.setup(dataOut, path, conf, samples, interval, az_offset) | |
|
4123 | 4134 | self.isConfig = True |
|
4124 | 4135 | |
|
4125 | self.utctime = dataOut.utctime + offset | |
|
4136 | self.utctime = dataOut.utctime + time_offset | |
|
4126 | 4137 | |
|
4127 | 4138 | self.find_next_file() |
|
4128 | 4139 | |
@@ -4133,9 +4144,11 class PedestalInformation(Operation): | |||
|
4133 | 4144 | dataOut.flagNoData = True |
|
4134 | 4145 | return dataOut |
|
4135 | 4146 | |
|
4136 | dataOut.azimuth = az | |
|
4147 | dataOut.azimuth = az - az_offset | |
|
4148 | if dataOut.azimuth < 0: | |
|
4149 | dataOut.azimuth += 360 | |
|
4137 | 4150 | dataOut.elevation = el |
|
4138 | # print('AZ: ', az, ' EL: ', el) | |
|
4151 | ||
|
4139 | 4152 | return dataOut |
|
4140 | 4153 | |
|
4141 | 4154 | class Block360(Operation): |
General Comments 0
You need to be logged in to leave comments.
Login now