Ignore:
Timestamp:
04/23/12 13:28:06 (13 years ago)
Author:
neise
Message:
exchanged naming of cols, such that it fits to the way TB does it.
Location:
fact/tools/pyscripts/sandbox/dneise
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/sandbox/dneise/timecal.py

    r13404 r13415  
    1111from pyfact     import RawData
    1212from drs_spikes import DRSSpikes
    13 from extractors import ZeroXing
     13from extractor import ZeroXing
    1414class CalculateDrsTimeCalibrationConstants( object ):
    1515    """ basic analysis class for the calculation of DRS time aperture jitter calibration constants
     
    3434        self.fsampling = 2.         # sampling frequency
    3535        self.freq = 250.            # testfrequency
    36         self.P_nom = 1000./freq     # nominal Period due to testfrequency
     36        self.P_nom = 1000./self.freq     # nominal Period due to testfrequency
    3737        self.DAMPING = 0.02         # Damping applied to correction
    3838       
     
    4848        """       
    4949        # loop over events
     50        counter = 0
    5051        for event in self.run:
     52            print 'counter', counter
     53            counter +=1
    5154            # in the next() method, which is called during looping,
    5255            # the data is automatically amplitude calibrated.
     
    6063            start_cell = event['start_cells'][niners_ids,:]
    6164           
    62             data = despike( data )
     65            data = self.despike( data )
    6366           
    6467            # shift data down by the mean           # possible in one line
     
    111114           
    112115            # first we make the sublists of the lists to be numpy.arrays
    113             for i in len(float_slice_of_all_crossings): #both list have equal length
     116            for i in range(len(float_slice_of_all_crossings)): #both list have equal length
    114117                float_slice_of_all_crossings[i] = np.array(float_slice_of_all_crossings[i])
    115118                time_of_all_crossings[i] = np.array(time_of_all_crossings[i])
     
    120123                all_measured_periods.append(np.diff(chip_times))
    121124           
    122             for chid,chip_periods in enumerate(all_measured_periods):
     125            for chip,chip_periods in enumerate(all_measured_periods):
    123126               
    124127                for i,period in enumerate(chip_periods):
     
    144147                    total_negative_correction = rest * (interval * (pos_fraction/rest))
    145148                    # so we can call the product following 'rest' the 'neg_fraction
    146                     neg_fraction = -1 * interval/rest * important
    147                     assert total_positive_correction - total_negative_correction == 0
     149                    neg_fraction = -1 * interval/rest * pos_fraction
     150                    #print '1. should be zero', total_positive_correction - total_negative_correction
     151                    #assert total_positive_correction - total_negative_correction == 0
    148152                   
    149153                    correction = np.zeros(1024)
     
    151155                    correction[:start+1]      = neg_fraction
    152156                    correction[end+1:]        = neg_fraction
    153                     assert correction.sum() == 0
     157                    #print '2.   should be zero', correction.sum()
     158                    #assert correction.sum() == 0
    154159                   
    155160                    # now we have to add these correction values to self.time_calib
Note: See TracChangeset for help on using the changeset viewer.