def normalizeDatBySize()

in analysis/analyze.py [0:0]


def normalizeDatBySize(dat, normalize_by=None, sqrt=True, inplace=False):
    if not inplace:
        dat = copy.deepcopy(dat)
        
    if normalize_by is None:
        return dat
    
    if sqrt:
        dat.error *= np.sqrt(dat[normalize_by])
    else:
        dat.error *= dat[normalize_by]
        
    return dat