예제 #1
0
    def add_derived_data(self,data):
        # this may need to get reorganized...
        new_fields=[]
        for post in self.postprocessors():
            new_fields+=post.postprocess(self,data)

        # units=[nf[2] for nf in new_fields] # for now, discard units
        to_add=[nf[:2] for nf in new_fields]
        
        return array_append.recarray_add_fields(data,to_add)
예제 #2
0
    def add_timestamps(self,basic_data):
        expanded=[]
        dt_us=1000000/float(self.header_data['sample_rate_hz'])
        for timestamp,frame in zip(self.timestamps,self.frames):
            # make sure timestamp is in microseconds, so we can add more microseconds
            expanded.append(timestamp.astype('<M8[us]') + (np.arange(len(frame))*dt_us).astype(np.int64))
        full_datetimes=np.concatenate(expanded)
        full_pydnums=full_datetimes.astype('int64')/86400.0e6 # into days...
        # fix offset
        dnum0=date2num(self.timestamps[0].astype(datetime.datetime))
        full_pydnums+= dnum0-full_pydnums[0]

        new_data=array_append.recarray_add_fields(basic_data,
                                                  [('timestamp',full_datetimes),
                                                   ('dn_py',full_pydnums),
                                                   ('dn_mat',full_pydnums+366)])
        return new_data