made ratio() not use nan_to_num
implemented __setitem__