def prepare_data():
    '''remove center and normalize values'''
    with open('data/comuni1.json') as comuni:
        data = json.load(comuni)

    coords = np.array([[x['lat'], x['lng']] for x in data], dtype=np.float32)
    angle = 90
    theta = (angle/180.) * np.pi
    rot_matrix = np.array(
        [[np.cos(theta), -np.sin(theta)], [np.sin(theta),  np.cos(theta)]])
    coords = np.dot(coords, rot_matrix)

    coords = coords - \
        np.array([np.max(coords, axis=0), np.min(coords, axis=0)]).mean(axis=0)
    coords /= 1.5*(np.max(coords, axis=0) - np.min(coords, axis=0))
    coords += [0.5, 0.5]

    for d, c in zip(data, coords):
        d['lat'] = c[0]
        d['lng'] = c[1]
    with open('data/comuni1.json', 'w') as comuni:
        json.dump(data, comuni)
    return coords
dataset/ETHPy150Open dnlcrl/PyGraphArt/src/main.py/prepare_data/original