Пример #1
0
        final['CO'] = hh[1]['CO'][:]
        hh.close()
    else:
        binSizeP = (final['RPMAX'] - final['RPMIN']) / final['NP']
        binSizeT = (final['RTMAX'] - 0.) / final['NT']
        if not args.do_not_smooth_cov:
            print('INFO: The covariance will be smoothed')
            final['CO'] = smooth_cov(final['DA'],
                                     final['WE'],
                                     final['RP'],
                                     final['RT'],
                                     drt=binSizeT,
                                     drp=binSizeP)
        else:
            print('INFO: The covariance will not be smoothed')
            final['CO'] = cov(final['DA'], final['WE'])

    ### Test covariance matrix
    try:
        scipy.linalg.cholesky(final['CO'])
    except scipy.linalg.LinAlgError:
        print('WARNING: Matrix is not positive definite')

    ### Measurement
    final['DA'] = (final['DA'] * final['WE']).sum(axis=0)
    final['WE'] = final['WE'].sum(axis=0)
    w = final['WE'] > 0.
    final['DA'][w] /= final['WE'][w]

    ### Distortion matrix
    if args.dmat is not None:
Пример #2
0
            we = data['DD']['WE']
        else:
            dd = data['xDD']['WE']
            rr = data['xRR']['WE']
            d1r2 = data['xD1R2']['WE']
            d2r1 = data['xD2R1']['WE']
            w = rr>0.
            da = sp.zeros(dd.shape)
            da[w] = (dd[w]+rr[w]-d1r2[w]-d2r1[w])/rr[w]
            we = data['xDD']['WE']
        data['HLP_DA'] = da
        data['HLP_WE'] = we

        if args.do_not_smooth_cov:
            print('INFO: The covariance will not be smoothed')
            co = cov(da,we)
        else:
            print('INFO: The covariance will be smoothed')
            binSizeRP = (data['RPMAX']-data['RPMIN']) / data['NP']
            binSizeRT = (data['RTMAX']-0.) / data['NT']
            co = smooth_cov(da,we,data['RP'],data['RT'],drp=binSizeRP,drt=binSizeRT)
        data['CO'] = co

    try:
        scipy.linalg.cholesky(data['CO'])
    except scipy.linalg.LinAlgError:
        print('WARNING: Matrix is not positive definite')

    ### Distortion matrix
    data['DM'] = sp.eye(data['DA'].size)